@@ -21,20 +21,21 @@ import (
21
21
"encoding/json"
22
22
"errors"
23
23
"fmt"
24
+ bean2 "github.com/devtron-labs/devtron/api/bean/AppView"
24
25
client "github.com/devtron-labs/devtron/api/helm-app/gRPC"
25
26
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode"
26
27
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deploymentTypeChange"
27
28
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/resource"
28
29
util3 "github.com/devtron-labs/devtron/pkg/appStore/util"
29
30
"github.com/devtron-labs/devtron/pkg/bean"
31
+ "github.com/devtron-labs/devtron/pkg/cluster/read"
30
32
"gopkg.in/go-playground/validator.v9"
31
33
"net/http"
32
34
"reflect"
33
35
"strconv"
34
36
"strings"
35
37
"time"
36
38
37
- bean2 "github.com/devtron-labs/devtron/api/bean"
38
39
"github.com/devtron-labs/devtron/api/restHandler/common"
39
40
"github.com/devtron-labs/devtron/client/argocdServer/application"
40
41
"github.com/devtron-labs/devtron/client/cron"
@@ -50,7 +51,6 @@ import (
50
51
"github.com/devtron-labs/devtron/pkg/auth/user"
51
52
"github.com/devtron-labs/devtron/pkg/cluster"
52
53
"github.com/devtron-labs/devtron/util"
53
- "github.com/devtron-labs/devtron/util/argo"
54
54
"github.com/devtron-labs/devtron/util/rbac"
55
55
"github.com/devtron-labs/devtron/util/response"
56
56
"github.com/go-pg/pg"
@@ -88,11 +88,11 @@ type InstalledAppRestHandlerImpl struct {
88
88
appStoreDeploymentService service.AppStoreDeploymentService
89
89
appStoreDeploymentDBService service.AppStoreDeploymentDBService
90
90
helmAppClient client.HelmAppClient
91
- argoUserService argo.ArgoUserService
92
91
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler
93
92
installedAppRepository repository.InstalledAppRepository
94
93
appCrudOperationService app2.AppCrudOperationService
95
94
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService
95
+ clusterReadService read.ClusterReadService
96
96
}
97
97
98
98
func NewInstalledAppRestHandlerImpl (Logger * zap.SugaredLogger , userAuthService user.UserService ,
@@ -102,11 +102,13 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
102
102
chartGroupService chartGroup.ChartGroupService , validator * validator.Validate , clusterService cluster.ClusterService ,
103
103
acdServiceClient application.ServiceClient , appStoreDeploymentService service.AppStoreDeploymentService ,
104
104
appStoreDeploymentDBService service.AppStoreDeploymentDBService ,
105
- helmAppClient client.HelmAppClient , argoUserService argo.ArgoUserService ,
105
+ helmAppClient client.HelmAppClient ,
106
+
106
107
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler ,
107
108
installedAppRepository repository.InstalledAppRepository ,
108
109
appCrudOperationService app2.AppCrudOperationService ,
109
- installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService ) * InstalledAppRestHandlerImpl {
110
+ installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService ,
111
+ clusterReadService read.ClusterReadService ) * InstalledAppRestHandlerImpl {
110
112
return & InstalledAppRestHandlerImpl {
111
113
Logger : Logger ,
112
114
userAuthService : userAuthService ,
@@ -122,11 +124,11 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
122
124
appStoreDeploymentService : appStoreDeploymentService ,
123
125
appStoreDeploymentDBService : appStoreDeploymentDBService ,
124
126
helmAppClient : helmAppClient ,
125
- argoUserService : argoUserService ,
126
127
cdApplicationStatusUpdateHandler : cdApplicationStatusUpdateHandler ,
127
128
installedAppRepository : installedAppRepository ,
128
129
appCrudOperationService : appCrudOperationService ,
129
130
installedAppDeploymentTypeChangeService : installedAppDeploymentTypeChangeService ,
131
+ clusterReadService : clusterReadService ,
130
132
}
131
133
}
132
134
func (handler * InstalledAppRestHandlerImpl ) FetchAppOverview (w http.ResponseWriter , r * http.Request ) {
@@ -550,7 +552,7 @@ func (impl *InstalledAppRestHandlerImpl) DefaultComponentInstallation(w http.Res
550
552
return
551
553
}
552
554
impl .Logger .Errorw ("request payload, DefaultComponentInstallation" , "clusterId" , clusterId )
553
- cluster , err := impl .clusterService .FindById (clusterId )
555
+ cluster , err := impl .clusterReadService .FindById (clusterId )
554
556
if err != nil {
555
557
impl .Logger .Errorw ("service err, DefaultComponentInstallation" , "error" , err , "clusterId" , clusterId )
556
558
common .WriteJsonResp (w , err , nil , http .StatusInternalServerError )
@@ -648,13 +650,6 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
648
650
return
649
651
}
650
652
//rback block ends here
651
- acdToken , err := handler .argoUserService .GetLatestDevtronArgoCdUserToken ()
652
- if err != nil {
653
- handler .Logger .Errorw ("error in getting acd token" , "err" , err )
654
- common .WriteJsonResp (w , err , nil , http .StatusInternalServerError )
655
- return
656
- }
657
- ctx := context .WithValue (r .Context (), "token" , acdToken )
658
653
request := & appStoreBean.InstallAppVersionDTO {}
659
654
request .InstalledAppId = installedAppId
660
655
request .AppName = installedApp .AppName
@@ -668,7 +663,7 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
668
663
request .Namespace = installedApp .Namespace
669
664
request .AcdPartialDelete = true
670
665
671
- request , err = handler .appStoreDeploymentService .DeleteInstalledApp (ctx , request )
666
+ request , err = handler .appStoreDeploymentService .DeleteInstalledApp (r . Context () , request )
672
667
if err != nil {
673
668
handler .Logger .Errorw ("service err, DeleteInstalledApp" , "err" , err , "installAppId" , installedAppId )
674
669
common .WriteJsonResp (w , err , nil , http .StatusInternalServerError )
0 commit comments