-
Notifications
You must be signed in to change notification settings - Fork 63
MGMT-21058: Expose BareMetalHost (BMH) Status and Events in the Assisted Installer / CIM Console #3363
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
Merged
openshift-merge-bot
merged 5 commits into
openshift-assisted:master
from
jgyselov:bmc_events
Jan 27, 2026
Merged
MGMT-21058: Expose BareMetalHost (BMH) Status and Events in the Assisted Installer / CIM Console #3363
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
be2f89f
Add 'deleting' status
jgyselov e86d907
Split tableUtils and tableColumns
jgyselov ea33416
Use PF bold class instead of 'strong' element
jgyselov 454de1c
Expose BMH status and events
jgyselov 197b2ac
Event sorting, time display
jgyselov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
15 changes: 3 additions & 12 deletions
15
libs/ui-lib/lib/cim/components/Agent/AgentsSelectionTable.tsx
This file contains hidden or 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 hidden or 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,87 @@ | ||
| import React from 'react'; | ||
| import { | ||
| Modal, | ||
| ModalVariant, | ||
| ModalHeader, | ||
| ModalBody, | ||
| Content, | ||
| ContentVariants, | ||
| } from '@patternfly/react-core'; | ||
| import { Table, Thead, Tr, Th, Tbody, Td, InnerScrollContainer } from '@patternfly/react-table'; | ||
| import { getHumanizedDateTime, LoadingState, useTranslation } from '../../../common'; | ||
| import { useEvents } from '../../hooks'; | ||
|
|
||
| export const BMHEventsModal = ({ | ||
| isOpen, | ||
| onClose, | ||
| namespace, | ||
| bmhName, | ||
| }: { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| namespace: string; | ||
| bmhName: string; | ||
| }) => { | ||
| const { t } = useTranslation(); | ||
| const [events, loaded, error] = useEvents({ | ||
| namespace: namespace, | ||
| isList: true, | ||
| fieldSelector: `involvedObject.name=${bmhName}`, | ||
| }); | ||
|
|
||
| let modalBody: React.ReactNode; | ||
| if (!loaded) { | ||
| modalBody = <LoadingState />; | ||
| } else if (error) { | ||
| modalBody = <Content component={ContentVariants.p}>{error as string}</Content>; | ||
| } else if (!events.length) { | ||
| modalBody = <Content component={ContentVariants.p}>{t('ai:No BMH events found.')}</Content>; | ||
| } else { | ||
| modalBody = ( | ||
| <div style={{ height: '400px' }}> | ||
| <InnerScrollContainer> | ||
| <Table | ||
| variant="compact" | ||
| borders={false} | ||
| className="pf-v6-u-mb-sm" | ||
| gridBreakPoint="" | ||
| isStickyHeader | ||
| > | ||
| <Thead> | ||
| <Tr> | ||
| <Th width={25}>{t('ai:Time')}</Th> | ||
| <Th>{t('ai:Type')}</Th> | ||
| <Th>{t('ai:Message')}</Th> | ||
| </Tr> | ||
| </Thead> | ||
| <Tbody> | ||
| {events | ||
| .sort( | ||
|
jgyselov marked this conversation as resolved.
|
||
| (a, b) => | ||
| b.metadata?.creationTimestamp?.localeCompare( | ||
| a.metadata?.creationTimestamp || '', | ||
| ) || 0, | ||
| ) | ||
| .map((e, i) => ( | ||
| <Tr key={`bmc-event-${i}`}> | ||
| <Td className="pf-v6-u-font-weight-bold"> | ||
| {getHumanizedDateTime(e.metadata?.creationTimestamp)} | ||
| </Td> | ||
| <Td>{e.type}</Td> | ||
| <Td>{e.message}</Td> | ||
| </Tr> | ||
| ))} | ||
|
jgyselov marked this conversation as resolved.
|
||
| </Tbody> | ||
| </Table> | ||
| </InnerScrollContainer> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Modal isOpen={isOpen} onClose={onClose} variant={ModalVariant.medium}> | ||
| <ModalHeader title={t('ai:Bare metal host events')} /> | ||
| <ModalBody>{modalBody}</ModalBody> | ||
| </Modal> | ||
| ); | ||
| }; | ||
This file contains hidden or 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,27 +1,27 @@ | ||
| import { Button, Popover } from '@patternfly/react-core'; | ||
| import * as React from 'react'; | ||
| import { getBMHStatus } from '../helpers/status'; | ||
| import { BareMetalHostK8sResource } from '../../types'; | ||
| import { BMHStatusInfo } from './BMHStatusInfo'; | ||
|
|
||
| type BMHStatusProps = { | ||
| bmhStatus: ReturnType<typeof getBMHStatus>; | ||
| bmh: BareMetalHostK8sResource; | ||
| }; | ||
|
|
||
| const BMHStatus: React.FC<BMHStatusProps> = ({ bmhStatus }) => | ||
| bmhStatus.errorMessage ? ( | ||
| <Popover | ||
| headerContent="Error" | ||
| bodyContent={bmhStatus.errorMessage} | ||
| minWidth="30rem" | ||
| maxWidth="50rem" | ||
| hideOnOutsideClick | ||
| zIndex={300} | ||
| > | ||
| <Button variant="link" isInline> | ||
| {bmhStatus.state.title} | ||
| </Button> | ||
| </Popover> | ||
| ) : ( | ||
| <>{bmhStatus.state.title}</> | ||
| ); | ||
| const BMHStatus: React.FC<BMHStatusProps> = ({ bmhStatus, bmh }) => ( | ||
| <Popover | ||
| aria-label="Bare metal host status details" | ||
| bodyContent={<BMHStatusInfo bmhStatus={bmhStatus} bmh={bmh} />} | ||
| minWidth="30rem" | ||
| maxWidth="50rem" | ||
| hideOnOutsideClick | ||
| zIndex={300} | ||
|
jgyselov marked this conversation as resolved.
|
||
| > | ||
| <Button variant="link" isInline> | ||
| {bmhStatus.state.title} | ||
| </Button> | ||
| </Popover> | ||
| ); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| export default BMHStatus; | ||
This file contains hidden or 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,94 @@ | ||
| import React from 'react'; | ||
| import { | ||
| Level, | ||
| LevelItem, | ||
| Alert, | ||
| AlertVariant, | ||
| Content, | ||
| ContentVariants, | ||
| Button, | ||
| ButtonVariant, | ||
| } from '@patternfly/react-core'; | ||
| import { CheckCircleIcon } from '@patternfly/react-icons/dist/js/icons/check-circle-icon'; | ||
| import { PendingIcon } from '@patternfly/react-icons/dist/js/icons/pending-icon'; | ||
| import { ExclamationTriangleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon'; | ||
| import { t_global_color_status_success_default as okColor } from '@patternfly/react-tokens/dist/js/t_global_color_status_success_default'; | ||
| import { t_global_icon_color_status_warning_default as warningColor } from '@patternfly/react-tokens/dist/js/t_global_icon_color_status_warning_default'; | ||
|
|
||
| import { getHumanizedDateTime, useTranslation } from '../../../common'; | ||
| import { BareMetalHostK8sResource } from '../../types'; | ||
| import { getBMHStatus } from '../helpers'; | ||
| import { BMHEventsModal } from './BMHEventsModal'; | ||
|
|
||
| export const BMHStatusInfo = ({ | ||
| bmhStatus, | ||
| bmh, | ||
| }: { | ||
| bmhStatus: ReturnType<typeof getBMHStatus>; | ||
| bmh: BareMetalHostK8sResource; | ||
| }) => { | ||
| const { t } = useTranslation(); | ||
| const [isModalOpen, setModalOpen] = React.useState(false); | ||
|
|
||
| let alertVariant = AlertVariant.warning; | ||
| if (!!bmh.status?.errorMessage) { | ||
| alertVariant = AlertVariant.danger; | ||
| } else if ( | ||
| bmh.status?.provisioning?.state === 'provisioned' || | ||
| bmh.status?.provisioning?.state === 'externally provisioned' | ||
| ) { | ||
| alertVariant = AlertVariant.success; | ||
| } | ||
|
|
||
| let icon: React.ReactNode; | ||
| switch (bmh.status?.operationalStatus) { | ||
| case 'OK': | ||
| case 'discovered': | ||
| icon = <CheckCircleIcon color={okColor.value} />; | ||
| break; | ||
| case 'error': | ||
| icon = <ExclamationTriangleIcon color={warningColor.value} />; | ||
| break; | ||
| default: | ||
| icon = <PendingIcon />; | ||
| break; | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <Level> | ||
| <LevelItem className="pf-v6-u-font-weight-bold">{t('ai:Bare metal host')}</LevelItem> | ||
| <LevelItem> | ||
| {bmh.status?.operationalStatus} {icon} | ||
| </LevelItem> | ||
| </Level> | ||
|
jgyselov marked this conversation as resolved.
|
||
| <Alert title={bmhStatus.state.title} variant={alertVariant} isInline> | ||
| {!!bmh.status?.errorMessage && ( | ||
| <Content component={ContentVariants.p}>{bmh.status?.errorMessage}</Content> | ||
| )} | ||
|
|
||
| <Level hasGutter> | ||
| <LevelItem> | ||
| <Button variant={ButtonVariant.link} isInline onClick={() => setModalOpen(true)}> | ||
| {t('ai:View BMH events')} | ||
| </Button> | ||
| </LevelItem> | ||
| <LevelItem> | ||
| <Content component={ContentVariants.small}> | ||
| {t('ai:Last updated:')} {getHumanizedDateTime(bmh.status?.lastUpdated)} | ||
| </Content> | ||
| </LevelItem> | ||
| </Level> | ||
| </Alert> | ||
|
|
||
| {isModalOpen && ( | ||
| <BMHEventsModal | ||
| isOpen={isModalOpen} | ||
| onClose={() => setModalOpen(false)} | ||
| namespace={bmh.metadata?.namespace || ''} | ||
| bmhName={bmh.metadata?.name || ''} | ||
| /> | ||
| )} | ||
|
jgyselov marked this conversation as resolved.
|
||
| </> | ||
| ); | ||
| }; | ||
This file contains hidden or 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,3 +1,5 @@ | ||
| export { default as AgentTable } from './AgentTable'; | ||
| export { default as BMCForm } from './BMCForm'; | ||
| export * from './types'; | ||
| export * from './tableColumns'; | ||
| export * from './tableUtils'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.