Added more health filters in UI (#2160)

This commit is contained in:
Simon Behar 2019-08-15 11:14:06 -07:00 committed by Alex Collins
parent 5b4c132e36
commit db6146a25c

View file

@ -118,8 +118,10 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{ na
{ value: 'sync:OutOfSync', label: 'OutOfSync' },
{ content: () => <span>Health</span> },
{ value: 'health:Healthy', label: 'Healthy' },
// Unhealthy includes 'Unknown', 'Progressing', 'Degraded' and 'Missing'
{ value: 'health:Unhealthy', label: 'Unhealthy' },
{ value: 'health:Progressing', label: 'Progressing' },
{ value: 'health:Degraded', label: 'Degraded' },
{ value: 'health:Missing', label: 'Missing' },
{ value: 'health:Unknown', label: 'Unknown' },
{ content: (setSelection) => (
<div>
Kinds <a onClick={() => setSelection(noKindsFilter.concat(kinds.map((kind) => `kind:${kind}`)))}>all</a> / <a
@ -352,12 +354,10 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{ na
private filterTreeNode(node: ResourceTreeNode, filter: {kind: string[], health: string[], sync: string[]}): boolean {
const syncStatuses = filter.sync.map((item) => item === 'OutOfSync' ? ['OutOfSync', 'Unknown'] : [item] ).reduce(
(first, second) => first.concat(second), []);
const healthStatuses = filter.health.map((item) => item === 'Unhealthy' ? ['Unknown', 'Progressing', 'Degraded', 'Missing'] : [item] ).reduce(
(first, second) => first.concat(second), []);
return (filter.kind.length === 0 || filter.kind.indexOf(node.kind) > -1) &&
(syncStatuses.length === 0 || node.root.hook || node.root.status && syncStatuses.indexOf(node.root.status) > -1) &&
(healthStatuses.length === 0 || node.root.hook || node.root.health && healthStatuses.indexOf(node.root.health.status) > -1);
(filter.health.length === 0 || node.root.hook || node.root.health && filter.health.indexOf(node.root.health.status) > -1);
}
private loadAppInfo(name: string): Observable<{application: appModels.Application, tree: appModels.ApplicationTree}> {