@@ -54,7 +54,9 @@ type ConfigMapService interface {
54
54
CMEnvironmentFetch (appId int , envId int ) (* bean.ConfigDataRequest , error )
55
55
CMGlobalFetchForEdit (name string , id int ) (* bean.ConfigDataRequest , error )
56
56
CMEnvironmentFetchForEdit (name string , id int , appId int , envId int ) (* bean.ConfigDataRequest , error )
57
- ConfigGlobalFetchEditUsingAppId (name string , appId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error )
57
+
58
+ CmCsConfigGlobalFetchUsingAppId (name string , appId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error )
59
+ CmCsConfigOverrideFetchUsingAppAndEnvId (name string , appId , envId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error )
58
60
59
61
CSGlobalAddUpdate (configMapRequest * bean.ConfigDataRequest ) (* bean.ConfigDataRequest , error )
60
62
CSGlobalFetch (appId int ) (* bean.ConfigDataRequest , error )
@@ -1938,7 +1940,7 @@ func (impl ConfigMapServiceImpl) FetchCmCsNamesAppAndEnvLevel(appId int, envId i
1938
1940
return cMCSNamesAppLevel , cMCSNamesEnvLevel , nil
1939
1941
}
1940
1942
1941
- func (impl ConfigMapServiceImpl ) ConfigGlobalFetchEditUsingAppId (name string , appId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error ) {
1943
+ func (impl ConfigMapServiceImpl ) CmCsConfigGlobalFetchUsingAppId (name string , appId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error ) {
1942
1944
var fetchGlobalConfigFunc func (int ) (* bean.ConfigDataRequest , error )
1943
1945
if resourceType == bean .CS {
1944
1946
fetchGlobalConfigFunc = impl .CSGlobalFetch
@@ -1959,3 +1961,25 @@ func (impl ConfigMapServiceImpl) ConfigGlobalFetchEditUsingAppId(name string, ap
1959
1961
configDataRequest .ConfigData = configs
1960
1962
return configDataRequest , nil
1961
1963
}
1964
+
1965
+ func (impl ConfigMapServiceImpl ) CmCsConfigOverrideFetchUsingAppAndEnvId (name string , appId , envId int , resourceType bean.ResourceType ) (* bean.ConfigDataRequest , error ) {
1966
+ var fetchGlobalConfigFunc func (int , int ) (* bean.ConfigDataRequest , error )
1967
+ if resourceType == bean .CS {
1968
+ fetchGlobalConfigFunc = impl .CSEnvironmentFetch
1969
+ } else if resourceType == bean .CM {
1970
+ fetchGlobalConfigFunc = impl .CMEnvironmentFetch
1971
+ }
1972
+ configDataRequest , err := fetchGlobalConfigFunc (appId , envId )
1973
+ if err != nil {
1974
+ impl .logger .Errorw ("error in fetching global cm using app id " , "cmName" , name , "appId" , appId , "err" , err )
1975
+ return nil , err
1976
+ }
1977
+ configs := make ([]* bean.ConfigData , 0 , len (configDataRequest .ConfigData ))
1978
+ for _ , configData := range configDataRequest .ConfigData {
1979
+ if configData .Name == name {
1980
+ configs = append (configs , configData )
1981
+ }
1982
+ }
1983
+ configDataRequest .ConfigData = configs
1984
+ return configDataRequest , nil
1985
+ }
0 commit comments