File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ import {
4949 GlobalVariableDTO ,
5050 GlobalVariableOptionType ,
5151 UserRole ,
52+ EnvAppsMetaDTO ,
53+ GetAppsInfoForEnvProps ,
5254} from './Types'
5355import { ApiResourceType , STAGE_MAP } from '../Pages'
5456import { RefVariableType , VariableTypeFormat } from './CIPipeline.Types'
@@ -515,3 +517,15 @@ export const getGlobalVariables = async ({
515517 throw err
516518 }
517519}
520+
521+ export const getAppsInfoForEnv = async ( { envId, appIds } : GetAppsInfoForEnvProps ) : Promise < EnvAppsMetaDTO > => {
522+ const url = getUrlWithSearchParams ( `${ ROUTES . ENV } /${ envId } /${ ROUTES . APP_METADATA } ` , {
523+ appIds : appIds ?. join ( ) ,
524+ } )
525+ const response = await get < EnvAppsMetaDTO > ( url )
526+
527+ return {
528+ appCount : response . result ?. appCount ?? 0 ,
529+ apps : response . result ?. apps ?? [ ] ,
530+ }
531+ }
Original file line number Diff line number Diff line change @@ -157,6 +157,8 @@ export const ROUTES = {
157157 ENVIRONMENT_DATA : 'global/environment-variables' ,
158158 DASHBOARD_EVENT : 'dashboard-event' ,
159159 LICENSE_DATA : 'license/data' ,
160+ ENV : 'env' ,
161+ APP_METADATA : 'app-metadata' ,
160162} as const
161163
162164export enum KEY_VALUE {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727 TargetPlatformItemDTO ,
2828 ButtonProps ,
2929 ComponentLayoutType ,
30+ StatusType ,
3031} from '../Shared'
3132import {
3233 ACTION_STATE ,
@@ -1109,3 +1110,19 @@ export enum ActionTypes {
11091110 EDIT = 'edit' ,
11101111 APPROVER = 'approver' ,
11111112}
1113+
1114+ export interface GetAppsInfoForEnvProps {
1115+ envId : number
1116+ appIds ?: number [ ]
1117+ }
1118+
1119+ interface AppMeta {
1120+ appId : number
1121+ appStatus : StatusType
1122+ appName : string
1123+ }
1124+
1125+ export interface EnvAppsMetaDTO {
1126+ appCount : number
1127+ apps : AppMeta [ ]
1128+ }
You can’t perform that action at this time.
0 commit comments