Skip to content

Commit 0398da6

Browse files
committed
Update based on Atif's comments (#8558, #9202)
Signed-off-by: Keith Chong <kykchong@redhat.com>
1 parent 37e06a4 commit 0398da6

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

src/gitops/components/appset/graph/AppSetUtils.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,25 @@ export function getAppSetHealthStatus(appSet: ApplicationSetKind): HealthStatusC
3636
}
3737

3838
// Check for missing resources
39-
const missingResourceExist = resources.find((r) => r.health.status === HealthStatus.MISSING);
39+
const missingResourceExist = resources.find((r) => r.health?.status === HealthStatus.MISSING);
4040
if (missingResourceExist) {
4141
return 'Missing';
4242
}
4343

44-
const degradedResourceExist = resources.find((r) => r.health.status === HealthStatus.DEGRADED);
44+
const degradedResourceExist = resources.find((r) => r.health?.status === HealthStatus.DEGRADED);
4545
if (degradedResourceExist) {
4646
return 'Degraded';
4747
}
4848

4949
const progressingResourceExist = resources.find(
50-
(r) => r.health.status === HealthStatus.PROGRESSING,
50+
(r) => r.health?.status === HealthStatus.PROGRESSING,
5151
);
5252
if (progressingResourceExist) {
5353
return 'Progressing';
5454
}
5555

56-
const allHealthyResources = resources.every((r) => r.health.status === HealthStatus.HEALTHY);
57-
if (allHealthyResources) {
58-
return 'Healthy';
59-
}
60-
return 'Healthy';
56+
const allHealthyResources = resources.every((r) => r.health?.status === HealthStatus.HEALTHY);
57+
return allHealthyResources ? 'Healthy' : 'Unknown';
6158
}
6259
return 'Unknown';
6360
}

src/gitops/components/appset/graph/graph-utils.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const getInitialNodes = (
158158
const isStepGroupExpanded = stepGroupId ? expandedStepGroups.has(stepGroupId) : false;
159159

160160
let isOwnerRefOnly = false;
161-
if (isStepGroupExpanded && appResource?.step > '0') {
161+
if (isStepGroupExpanded && parseInt(appResource?.step) > 0) {
162162
const targetApp = applicationSet.status?.applicationStatus?.find(
163163
(appStatus) => appStatus.application === application.metadata.name,
164164
);
@@ -313,7 +313,7 @@ export const getInitialNodes = (
313313
};
314314

315315
export const getInitialEdges = (
316-
application: ApplicationSetKind,
316+
applicationSet: ApplicationSetKind,
317317
applications: ApplicationKind[],
318318
nodes: NodeModel[],
319319
isOwnerReferenceView: boolean,
@@ -334,11 +334,11 @@ export const getInitialEdges = (
334334
id: 'e-applicationset',
335335
type: isOwnerReferenceView ? 'edge' : 'task-edge',
336336
source:
337-
application.kind +
337+
applicationSet.kind +
338338
'-' +
339-
(application.metadata?.name ?? '') +
339+
(applicationSet.metadata?.name ?? '') +
340340
'-' +
341-
application.metadata?.namespace,
341+
applicationSet.metadata?.namespace,
342342
target: isOwnerReferenceView ? 'applicationset-node-spacer' : '1-step-group',
343343
nodeSeparation: 0,
344344
edgeStyle: EdgeStyle.default,

src/gitops/models/ApplicationSetModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export interface ApplicationStatusContent {
131131
application: string;
132132
status: 'Waiting' | 'Pending' | 'Progressing' | 'Healthy';
133133
message?: string;
134-
lastTransitionTime?: string;
134+
lastTransitionTime?: Time;
135135
step?: string;
136136
targetRevisions?: string[];
137137
}

0 commit comments

Comments
 (0)