Skip to content

Commit 2aaaa2b

Browse files
committed
feat: filter apps if id isn't recieved
1 parent 6be4a5b commit 2aaaa2b

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.11.0-pre-9-beta-2",
3+
"version": "1.11.0-pre-9-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Common.service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ import {
5151
UserRole,
5252
EnvAppsMetaDTO,
5353
GetAppsInfoForEnvProps,
54+
AppMeta,
5455
} from './Types'
5556
import { ApiResourceType, STAGE_MAP } from '../Pages'
5657
import { RefVariableType, VariableTypeFormat } from './CIPipeline.Types'
5758
import { get, post } from './API'
59+
import { StatusType } from '@Shared/Components'
5860

5961
export const getTeamListMin = (): Promise<TeamList> => {
6062
// ignore active field
@@ -526,6 +528,14 @@ export const getAppsInfoForEnv = async ({ envId, appIds }: GetAppsInfoForEnvProp
526528

527529
return {
528530
appCount: response.result?.appCount ?? 0,
529-
apps: response.result?.apps ?? [],
531+
apps: (response.result?.apps ?? []).reduce<AppMeta[]>((agg, {appId, appName, appStatus}) => {
532+
if (!appId) {
533+
return agg
534+
}
535+
agg.push({
536+
appId, appName: appName || '',
537+
appStatus: appStatus || StatusType.UNKNOWN,
538+
})
539+
}, []),
530540
}
531541
}

src/Common/Types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ export interface GetAppsInfoForEnvProps {
11161116
appIds?: number[]
11171117
}
11181118

1119-
interface AppMeta {
1119+
export interface AppMeta {
11201120
appId: number
11211121
appStatus: StatusType
11221122
appName: string

0 commit comments

Comments
 (0)