-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for HCI Phase 2<RHSTOR-4885>
Adds list page for Clients Adds Modal for generating onboarding token for clients Updates ODF dashboard to add Client Status Adds flags for Provider Mode Disables StorageClass and BlockPool creation in Provider mode Signed-off-by: Bipul Adhikari <[email protected]>
- Loading branch information
Showing
18 changed files
with
757 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ard/status-card/storage-system-popup.scss → ...oard/status-card/status-card-popover.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.odf-storageSystemPopup__item--margin { | ||
.odf-status-card__popup--margin { | ||
// Overriding PF default margin for FlexItem | ||
margin-bottom: 0 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/odf/components/odf-dashboard/status-card/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { StorageConsumerKind, StorageConsumerState } from '@odf/shared'; | ||
import { getTimeDifferenceInSeconds } from '@odf/shared/details-page/datetime'; | ||
import { HealthState } from '@openshift-console/dynamic-plugin-sdk'; | ||
import { TFunction } from 'i18next'; | ||
|
||
export const getClientHealthState = ( | ||
client: StorageConsumerKind | ||
): HealthState => { | ||
const state = client.status.state; | ||
let health = HealthState.UNKNOWN; | ||
switch (state) { | ||
case StorageConsumerState.Ready: | ||
health = HealthState.OK; | ||
break; | ||
case StorageConsumerState.Configuring: | ||
case StorageConsumerState.Deleting: | ||
health = HealthState.LOADING; | ||
break; | ||
case StorageConsumerState.Disabled: | ||
case StorageConsumerState.Failed: | ||
health = HealthState.ERROR; | ||
break; | ||
default: | ||
health = HealthState.UNKNOWN; | ||
} | ||
return health; | ||
}; | ||
|
||
export const getAggregateClientHealthState = ( | ||
clients: StorageConsumerKind[] | ||
) => { | ||
const connectedClients = clients.filter( | ||
(client) => client.status.state === StorageConsumerState.Ready | ||
); | ||
|
||
const healthyClients = connectedClients.filter( | ||
(client) => getTimeDifferenceInSeconds(client.status.lastHeartbeat) < 120 | ||
); | ||
const healthyClientsCount = healthyClients.length; | ||
const totalClientsCount = clients.length; | ||
if (totalClientsCount === healthyClientsCount) { | ||
return HealthState.OK; | ||
} | ||
if (totalClientsCount > healthyClientsCount && healthyClientsCount > 0) { | ||
return HealthState.ERROR; | ||
} | ||
if (totalClientsCount === 0) { | ||
return HealthState.NOT_AVAILABLE; | ||
} | ||
return HealthState.UNKNOWN; | ||
}; | ||
|
||
export const getClientText = (clients: StorageConsumerKind[], t: TFunction) => { | ||
const connectedClients = clients.filter( | ||
(client) => client.status.state === StorageConsumerState.Ready | ||
); | ||
|
||
const healthyClients = connectedClients.filter( | ||
(client) => getTimeDifferenceInSeconds(client.status.lastHeartbeat) < 120 | ||
); | ||
const healthyClientsCount = healthyClients.length; | ||
const totalClientsCount = clients.length; | ||
if (totalClientsCount === 0) { | ||
return t('0 connected'); | ||
} else { | ||
return t('{{connected}} / {{total}} connected', { | ||
connected: healthyClientsCount, | ||
total: totalClientsCount, | ||
}); | ||
} | ||
}; |
Oops, something went wrong.