Skip to content

Commit e469d59

Browse files
committed
feat: add other app list api from fe-lib
1 parent 0a808e2 commit e469d59

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/Common/Common.service.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ import {
4949
GlobalVariableDTO,
5050
GlobalVariableOptionType,
5151
UserRole,
52+
EnvAppsMetaDTO,
53+
GetAppsInfoForEnvProps,
5254
} from './Types'
5355
import { ApiResourceType, STAGE_MAP } from '../Pages'
5456
import { 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+
}

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

162164
export enum KEY_VALUE {

src/Common/Types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
TargetPlatformItemDTO,
2828
ButtonProps,
2929
ComponentLayoutType,
30+
StatusType,
3031
} from '../Shared'
3132
import {
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+
}

0 commit comments

Comments
 (0)