diff --git a/pkg/microservice/aslan/core/delivery/handler/artifact.go b/pkg/microservice/aslan/core/delivery/handler/artifact.go index cff822a6c0..bf01849b25 100644 --- a/pkg/microservice/aslan/core/delivery/handler/artifact.go +++ b/pkg/microservice/aslan/core/delivery/handler/artifact.go @@ -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 diff --git a/pkg/microservice/aslan/core/project/handler/host.go b/pkg/microservice/aslan/core/project/handler/host.go index 3e24cdd613..36bd6a63bd 100644 --- a/pkg/microservice/aslan/core/project/handler/host.go +++ b/pkg/microservice/aslan/core/project/handler/host.go @@ -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 diff --git a/pkg/microservice/aslan/core/project/handler/product.go b/pkg/microservice/aslan/core/project/handler/product.go index 15939797a6..69cecf37d3 100644 --- a/pkg/microservice/aslan/core/project/handler/product.go +++ b/pkg/microservice/aslan/core/project/handler/product.go @@ -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" @@ -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) } @@ -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) } @@ -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) } diff --git a/pkg/microservice/aslan/core/stat/service/stat_v2.go b/pkg/microservice/aslan/core/stat/service/stat_v2.go index 9e674c4030..4510082832 100644 --- a/pkg/microservice/aslan/core/stat/service/stat_v2.go +++ b/pkg/microservice/aslan/core/stat/service/stat_v2.go @@ -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 diff --git a/pkg/microservice/systemconfig/core/connector/handler/connector.go b/pkg/microservice/systemconfig/core/connector/handler/connector.go index 1aac217bd6..b4dfcd82ae 100644 --- a/pkg/microservice/systemconfig/core/connector/handler/connector.go +++ b/pkg/microservice/systemconfig/core/connector/handler/connector.go @@ -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 diff --git a/pkg/microservice/systemconfig/core/connector/service/connector.go b/pkg/microservice/systemconfig/core/connector/service/connector.go index 5570bd004c..6bf0fac2cb 100644 --- a/pkg/microservice/systemconfig/core/connector/service/connector.go +++ b/pkg/microservice/systemconfig/core/connector/service/connector.go @@ -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") } @@ -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")