Skip to content

Commit

Permalink
Merge pull request #38 from merenbach/503-indicate-overrides
Browse files Browse the repository at this point in the history
Label apps with overrides
  • Loading branch information
merenbach authored Sep 7, 2018
2 parents 2fa93fd + fca687f commit 9e45d5c
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,24 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{ na
private getResourceLabels(resource: appModels.ResourceNode | appModels.ResourceState): string[] {
const labels: string[] = [];
const {resourceNode} = AppUtils.getStateAndNode(resource);
if (resourceNode.state.kind === 'Pod') {
const {reason} = AppUtils.getPodStateReason(resourceNode.state);
if (reason) {
labels.push(reason);
}

const allStatuses = resourceNode.state.status.containerStatuses;
const readyStatuses = allStatuses.filter((s: ContainerStatus) => ('running' in s.state));
const readyContainers = '' + readyStatuses.length + '/' + allStatuses.length + ' containers ready';
labels.push(readyContainers);
switch (resourceNode.state.kind) {
case 'Pod':
const {reason} = AppUtils.getPodStateReason(resourceNode.state);
if (reason) {
labels.push(reason);
}

const allStatuses = resourceNode.state.status.containerStatuses;
const readyStatuses = allStatuses.filter((s: ContainerStatus) => ('running' in s.state));
const readyContainers = '' + readyStatuses.length + '/' + allStatuses.length + ' containers ready';
labels.push(readyContainers);
break;

case 'Application':
const appSrc = resourceNode.state.spec.source;
const countOfOverrides = 'componentParameterOverrides' in appSrc && appSrc.componentParameterOverrides.length || 0;
labels.push('' + countOfOverrides + ' parameter override(s)');
break;
}
return labels;
}
Expand Down

0 comments on commit 9e45d5c

Please sign in to comment.