-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RGW Support in Object Service Dashboard #6070
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import { | |
} from '@console/plugin-sdk'; | ||
import { | ||
HealthState, | ||
healthPriority, | ||
healthStateMapping, | ||
} from '@console/shared/src/components/dashboard/status-card/states'; | ||
import { coFetch } from '@console/internal/co-fetch'; | ||
import { | ||
|
@@ -52,15 +52,15 @@ export const getControlPlaneComponentHealth = ( | |
if (error) { | ||
return { | ||
state: HealthState.NOT_AVAILABLE, | ||
message: healthPriority[HealthState.NOT_AVAILABLE].message, | ||
message: healthStateMapping[HealthState.NOT_AVAILABLE].message, | ||
}; | ||
} | ||
if (!response) { | ||
return { state: HealthState.LOADING }; | ||
} | ||
const value = response.data?.result?.[0]?.value?.[1]; | ||
if (_.isNil(value)) { | ||
return { state: HealthState.UNKNOWN, message: healthPriority[HealthState.UNKNOWN].message }; | ||
return { state: HealthState.UNKNOWN, message: healthStateMapping[HealthState.UNKNOWN].message }; | ||
} | ||
const perc = humanizePercentage(value); | ||
if (perc.value > 90) { | ||
|
@@ -72,10 +72,10 @@ export const getControlPlaneComponentHealth = ( | |
return { state: HealthState.ERROR, message: perc.string }; | ||
}; | ||
|
||
const getWorstStatus = ( | ||
export const getWorstStatus = ( | ||
componentsHealth: SubsystemHealth[], | ||
): { state: HealthState; message: string; count: number } => { | ||
const withPriority = componentsHealth.map((h) => healthPriority[h.state]); | ||
const withPriority = componentsHealth.map((h) => healthStateMapping[h.state]); | ||
const mostImportantState = Math.max(...withPriority.map(({ priority }) => priority)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe even better and less error prone would be to make sure that export const healthStateMapping: { [key in HealthState]: PriorityHealthState } = {
[HealthState.OK]: {
priority: 0,
health: HealthState.OK,
icon: <GreenCheckCircleIcon />,
},
[HealthState.UNKNOWN]: {
priority: 1,
health: HealthState.UNKNOWN,
icon: <GrayUnknownIcon />,
message: 'Unknown',
},
[HealthState.PROGRESS]: {
priority: 2,
health: HealthState.PROGRESS,
icon: <InProgressIcon />,
message: 'Pending',
},
[HealthState.UPDATING]: {
priority: 3,
health: HealthState.UPDATING,
icon: <BlueSyncIcon />,
message: 'Updating',
},
[HealthState.WARNING]: {
priority: 4,
health: HealthState.WARNING,
icon: <YellowExclamationTriangleIcon />,
message: 'Degraded',
},
[HealthState.ERROR]: {
priority: 5,
health: HealthState.ERROR,
icon: <RedExclamationCircleIcon />,
message: 'Degraded',
},
[HealthState.LOADING]: {
priority: 6,
health: HealthState.LOADING,
icon: <div className="skeleton-health" />,
},
[HealthState.NOT_AVAILABLE]: {
priority: 7,
health: HealthState.NOT_AVAILABLE,
icon: <GrayUnknownIcon />,
message: 'Not available',
},
}; Can you try that ? |
||
const worstStatuses = withPriority.filter(({ priority }) => priority === mostImportantState); | ||
return { | ||
|
@@ -109,15 +109,15 @@ export const getClusterOperatorStatusPriority: GetOperatorStatusPriority<Cluster | |
) => { | ||
const status = getClusterOperatorStatus(co); | ||
if (status === OperatorStatus.Degraded) { | ||
return { ...healthPriority[HealthState.WARNING], title: status }; | ||
return { ...healthStateMapping[HealthState.WARNING], title: status }; | ||
} | ||
if (status === OperatorStatus.Unknown) { | ||
return { ...healthPriority[HealthState.UNKNOWN], title: status }; | ||
return { ...healthStateMapping[HealthState.UNKNOWN], title: status }; | ||
} | ||
if (status === OperatorStatus.Updating) { | ||
return { ...healthPriority[HealthState.UPDATING], title: status }; | ||
return { ...healthStateMapping[HealthState.UPDATING], title: status }; | ||
} | ||
return { ...healthPriority[HealthState.OK], title: status }; | ||
return { ...healthStateMapping[HealthState.OK], title: status }; | ||
}; | ||
|
||
export const getClusterOperatorHealthStatus: GetOperatorsWithStatuses<ClusterOperator> = ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question here - Shouldn't you be checking
labelNames[i]
too here, before applying it in caselabelNames[i]
is undefined?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need as there a few cases where we pass label names and for those cases, we can put the correct number of items, in the array. I have created a map for those special cases.