Skip to content

Commit

Permalink
Merge pull request #3498 from jamsman94/feature/licenseToFree
Browse files Browse the repository at this point in the history
mutiple functionality moved to free tier
  • Loading branch information
jamsman94 authored Apr 26, 2024
2 parents 72c0409 + c0a5ab3 commit 83ebf32
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
1 change: 0 additions & 1 deletion pkg/microservice/aslan/core/delivery/handler/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func ListDeliveryArtifacts(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

if err != nil {

ctx.Err = fmt.Errorf("authorization Info Generation failed: err %s", err)
ctx.UnAuthorized = true
return
Expand Down
1 change: 0 additions & 1 deletion pkg/microservice/aslan/core/project/handler/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ func GetAgentAccessCmd(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

if err != nil {

ctx.Err = fmt.Errorf("authorization Info Generation failed: err %s", err)
ctx.UnAuthorized = true
return
Expand Down
25 changes: 0 additions & 25 deletions pkg/microservice/aslan/core/project/handler/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
commonservice "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/service"
commontypes "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/types"
"github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/util"
commonutil "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/util"
projectservice "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/project/service"
internalhandler "github.com/koderover/zadig/v2/pkg/shared/handler"
e "github.com/koderover/zadig/v2/pkg/tool/errors"
Expand Down Expand Up @@ -108,14 +107,6 @@ func CreateProductTemplate(c *gin.Context) {
return
}

err = util.CheckZadigProfessionalLicense()
if err != nil {
if args.AutoDeploy != nil && args.AutoDeploy.Enable {
ctx.Err = e.ErrLicenseInvalid.AddDesc("")
return
}
}

args.UpdateBy = ctx.UserName
ctx.Err = projectservice.CreateProductTemplate(args, ctx.Logger)
}
Expand Down Expand Up @@ -161,14 +152,6 @@ func UpdateProductTemplate(c *gin.Context) {
}
}

err = commonutil.CheckZadigProfessionalLicense()
if err != nil {
if args.AutoDeploy.Enable == true {
ctx.Err = e.ErrLicenseInvalid.AddDesc("")
return
}
}

args.UpdateBy = ctx.UserName
ctx.Err = projectservice.UpdateProductTemplate(c.Param("name"), args, ctx.Logger)
}
Expand Down Expand Up @@ -264,14 +247,6 @@ func UpdateProject(c *gin.Context) {
}
}

err = commonutil.CheckZadigProfessionalLicense()
if err != nil {
if args.AutoDeploy != nil && args.AutoDeploy.Enable == true {
ctx.Err = e.ErrLicenseInvalid.AddDesc("")
return
}
}

ctx.Err = projectservice.UpdateProject(productName, args, ctx.Logger)
}

Expand Down
16 changes: 12 additions & 4 deletions pkg/microservice/aslan/core/stat/service/stat_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,24 @@ func GetStatsDashboardGeneralData(startTime, endTime int64, logger *zap.SugaredL
logger.Errorf("failed to get total and success build count, error: %s", err)
return nil, err
}
testStat, err := GetTestDashboard(startTime, endTime, "", logger)
testJobs, err := commonrepo.NewJobInfoColl().GetTestJobs(startTime, endTime, "")
if err != nil {
logger.Errorf("failed to get total and success test count, error: %s", err)
logger.Errorf("failed to get test jobs, error: %s", err)
return nil, err
}
totalTestExecution := 0
totalTestSuccess := 0
for _, job := range testJobs {
totalTestExecution++
if job.Status == "passed" {
totalTestSuccess++
}
}
return &StatDashboardBasicData{
BuildTotal: totalBuildSuccess + totalBuildFailure,
BuildSuccess: totalBuildSuccess,
TestTotal: int64(testStat.TotalExecCount),
TestSuccess: int64(testStat.Success),
TestTotal: int64(totalTestExecution),
TestSuccess: int64(totalTestSuccess),
DeployTotal: totalDeploySuccess + totalDeployFailure,
DeploySuccess: totalDeploySuccess,
}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func CreateConnector(c *gin.Context) {
defer func() { internalhandler.JSONResponse(c, ctx) }()

if err != nil {

ctx.Err = fmt.Errorf("authorization Info Generation failed: err %s", err)
ctx.UnAuthorized = true
return
Expand Down
14 changes: 14 additions & 0 deletions pkg/microservice/systemconfig/core/connector/service/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ func CreateConnector(ct *Connector, logger *zap.SugaredLogger) error {
return err
}

cfg := make(map[string]interface{})
err = json.Unmarshal(cf, &cfg)
if err != nil {
logger.Errorf("Failed to unmarshal config, err: %s", err)
return fmt.Errorf("invalid config")
}

if string(ct.Type) != "oauth" && ct.EnableLogOut {
return fmt.Errorf("logout is only available in oauth2 connector")
}
Expand All @@ -175,6 +182,13 @@ func UpdateConnector(ct *Connector, logger *zap.SugaredLogger) error {
logger.Errorf("Failed to marshal config, err: %s", err)
return err
}

cfg := make(map[string]interface{})
err = json.Unmarshal(cf, &cfg)
if err != nil {
logger.Errorf("Failed to unmarshal config, err: %s", err)
return fmt.Errorf("invalid config")
}

if string(ct.Type) != "oauth" && ct.EnableLogOut {
return fmt.Errorf("logout is only available in oauth2 connector")
Expand Down

0 comments on commit 83ebf32

Please sign in to comment.