@@ -21,18 +21,14 @@ import (
2121 "encoding/json"
2222 "errors"
2323 "fmt"
24- service2 "github.com/devtron-labs/devtron/api/helm-app/service"
25- "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
26- "net/http"
27- "strconv"
28- "strings"
29- "time"
30-
3124 openapi "github.com/devtron-labs/devtron/api/helm-app/openapiClient"
25+ service2 "github.com/devtron-labs/devtron/api/helm-app/service"
3226 "github.com/devtron-labs/devtron/api/restHandler/common"
3327 "github.com/devtron-labs/devtron/internal/util"
3428 appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean"
3529 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service"
30+ "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode"
31+ bean2 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/bean"
3632 "github.com/devtron-labs/devtron/pkg/attributes"
3733 "github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
3834 "github.com/devtron-labs/devtron/pkg/auth/user"
@@ -43,10 +39,11 @@ import (
4339 "github.com/gorilla/mux"
4440 "go.uber.org/zap"
4541 "gopkg.in/go-playground/validator.v9"
42+ "net/http"
43+ "strconv"
44+ "strings"
4645)
4746
48- const HELM_APP_UPDATE_COUNTER = "HelmAppUpdateCounter"
49-
5047type AppStoreDeploymentRestHandler interface {
5148 InstallApp (w http.ResponseWriter , r * http.Request )
5249 GetInstalledAppsByAppStoreId (w http.ResponseWriter , r * http.Request )
@@ -68,17 +65,17 @@ type AppStoreDeploymentRestHandlerImpl struct {
6865 validator * validator.Validate
6966 helmAppService service2.HelmAppService
7067 argoUserService argo.ArgoUserService
71- attributesService attributes.AttributesService
7268 installAppService EAMode.InstalledAppDBService
69+ attributesService attributes.AttributesService
7370}
7471
7572func NewAppStoreDeploymentRestHandlerImpl (Logger * zap.SugaredLogger , userAuthService user.UserService ,
7673 enforcer casbin.Enforcer , enforcerUtil rbac.EnforcerUtil , enforcerUtilHelm rbac.EnforcerUtilHelm ,
7774 appStoreDeploymentService service.AppStoreDeploymentService ,
7875 appStoreDeploymentDBService service.AppStoreDeploymentDBService ,
7976 validator * validator.Validate , helmAppService service2.HelmAppService ,
80- argoUserService argo.ArgoUserService , attributesService attributes. AttributesService ,
81- installAppService EAMode.InstalledAppDBService ) * AppStoreDeploymentRestHandlerImpl {
77+ argoUserService argo.ArgoUserService ,
78+ installAppService EAMode.InstalledAppDBService , attributesService attributes. AttributesService ) * AppStoreDeploymentRestHandlerImpl {
8279 return & AppStoreDeploymentRestHandlerImpl {
8380 Logger : Logger ,
8481 userAuthService : userAuthService ,
@@ -90,8 +87,8 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
9087 validator : validator ,
9188 helmAppService : helmAppService ,
9289 argoUserService : argoUserService ,
93- attributesService : attributesService ,
9490 installAppService : installAppService ,
91+ attributesService : attributesService ,
9592 }
9693}
9794
@@ -488,7 +485,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
488485 }
489486 ctx = context .WithValue (r .Context (), "token" , acdToken )
490487 }
491- triggeredAt := time .Now ()
492488 res , err := handler .appStoreDeploymentService .UpdateInstalledApp (ctx , & request )
493489 if err != nil {
494490 if strings .Contains (err .Error (), "application spec is invalid" ) {
@@ -498,13 +494,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
498494 common .WriteJsonResp (w , err , nil , http .StatusInternalServerError )
499495 return
500496 }
501- err1 := handler .appStoreDeploymentService .UpdatePreviousDeploymentStatusForAppStore (res , triggeredAt , err )
502- if err1 != nil {
503- handler .Logger .Errorw ("error while update previous installed app version history" , "err" , err , "installAppVersionRequest" , res )
504- //if installed app is updated and error is in updating previous deployment status, then don't block user, just show error.
505- }
506-
507- err = handler .attributesService .UpdateKeyValueByOne (HELM_APP_UPDATE_COUNTER )
497+ err = handler .attributesService .UpdateKeyValueByOne (bean2 .HELM_APP_UPDATE_COUNTER )
508498
509499 common .WriteJsonResp (w , err , res , http .StatusOK )
510500}
0 commit comments