Skip to content

Commit

Permalink
Merge pull request #4100 from rawagner/fix_control_plane
Browse files Browse the repository at this point in the history
Bug 1797454: Fix Not available state for Control Plane
  • Loading branch information
openshift-merge-robot committed Feb 3, 2020
2 parents a80edeb + be4f5f2 commit 0602c35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as React from 'react';
import {
GreenCheckCircleIcon,
YellowExclamationTriangleIcon,
RedExclamationCircleIcon,
} from '@console/shared';
import { HealthState } from '@console/shared/src/components/dashboard/status-card/states';
HealthState,
healthStateMapping,
} from '@console/shared/src/components/dashboard/status-card/states';
import { PrometheusResponse } from '@console/internal/components/graphs';
import { getControlPlaneComponentHealth } from './status';

Expand All @@ -13,12 +11,8 @@ const ResponseRate: React.FC<ResponseRateProps> = ({ response, children, error }
let icon: React.ReactNode;
if (health.state === HealthState.LOADING) {
icon = <div className="skeleton-health" />;
} else if (health.state === HealthState.OK) {
icon = <GreenCheckCircleIcon />;
} else if (health.state === HealthState.WARNING) {
icon = <YellowExclamationTriangleIcon />;
} else if (health.state === HealthState.ERROR) {
icon = <RedExclamationCircleIcon />;
} else if (health.state !== HealthState.NOT_AVAILABLE) {
icon = healthStateMapping[health.state].icon;
}
return (
<div className="co-overview-status__row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const getControlPlaneComponentHealth = (
response.status === 'success' &&
_.isNil(_.get(response, 'data.result[0].value[1]')))
) {
return { state: HealthState.NOT_AVAILABLE };
return { state: HealthState.NOT_AVAILABLE, message: 'Not available' };
}
if (!response) {
return { state: HealthState.LOADING };
Expand All @@ -81,7 +81,7 @@ export const getControlPlaneHealth: PrometheusHealthHandler = (responses = [], e
const errComponents = componentsHealth.filter(({ state }) => errorStates.includes(state));
if (errComponents.length) {
return {
state: errComponents.length === 4 ? HealthState.UNKNOWN : HealthState.WARNING,
state: errComponents.length === 4 ? HealthState.NOT_AVAILABLE : HealthState.WARNING,
message: errComponents.length === 4 ? null : `${errComponents.length} components degraded`,
};
}
Expand Down

0 comments on commit 0602c35

Please sign in to comment.