-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #984 from avivtur/fix-os-name-win
Bug 2136425: Windows 11 is detected as Windows 10
- Loading branch information
Showing
9 changed files
with
137 additions
and
59 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
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,6 +1,16 @@ | ||
import { V1VirtualMachineInstance } from '@kubevirt-ui/kubevirt-api/kubevirt'; | ||
import { | ||
V1VirtualMachineInstance, | ||
V1VirtualMachineInstanceGuestAgentInfo, | ||
} from '@kubevirt-ui/kubevirt-api/kubevirt'; | ||
|
||
export const isGuestAgentConnected = (vmi: V1VirtualMachineInstance): boolean => | ||
vmi?.status?.conditions?.some( | ||
(condition) => condition?.type === 'AgentConnected' && condition?.status === 'True', | ||
); | ||
|
||
export const getOsNameFromGuestAgent = ( | ||
guestAgentData: V1VirtualMachineInstanceGuestAgentInfo, | ||
): string => | ||
guestAgentData?.os?.name?.includes('Windows') && guestAgentData?.os?.version?.includes('Windows') | ||
? guestAgentData?.os?.version | ||
: `${guestAgentData?.os?.name} ${guestAgentData?.os?.version}`; |
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
25 changes: 25 additions & 0 deletions
25
.../VirtualMachinesOverviewTabDetails/components/StatusPopoverButton/StatusPopoverButton.tsx
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,25 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import { Button, ButtonVariant } from '@patternfly/react-core'; | ||
import { getVMStatusIcon } from '@virtualmachines/utils'; | ||
|
||
type StatusPopoverButtonProps = { | ||
vmPrintableStatus: string; | ||
}; | ||
|
||
const StatusPopoverButton: FC<StatusPopoverButtonProps> = ({ vmPrintableStatus }) => { | ||
if (!vmPrintableStatus) return null; | ||
|
||
const Icon = getVMStatusIcon(vmPrintableStatus); | ||
|
||
return ( | ||
<span> | ||
<Icon />{' '} | ||
<Button variant={ButtonVariant.link} isInline> | ||
{vmPrintableStatus} | ||
</Button> | ||
</span> | ||
); | ||
}; | ||
|
||
export default StatusPopoverButton; |
34 changes: 34 additions & 0 deletions
34
...erviewTabDetails/components/VirtualMachineOverviewStatus/VirtualMachineOverviewStatus.tsx
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,34 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
import { NO_DATA_DASH } from '@kubevirt-utils/resources/vm/utils/constants'; | ||
import { Popover, PopoverPosition } from '@patternfly/react-core'; | ||
|
||
import StatusPopoverButton from '../StatusPopoverButton/StatusPopoverButton'; | ||
|
||
type VirtualMachineOverviewStatusProps = { | ||
vmPrintableStatus: string; | ||
}; | ||
|
||
const VirtualMachineOverviewStatus: FC<VirtualMachineOverviewStatusProps> = ({ | ||
vmPrintableStatus, | ||
}) => { | ||
const { t } = useKubevirtTranslation(); | ||
if (!vmPrintableStatus) return <>{NO_DATA_DASH}</>; | ||
|
||
return ( | ||
<> | ||
<Popover | ||
headerContent={vmPrintableStatus} | ||
bodyContent={t('VirtualMachine is currently {{status}}', { | ||
status: vmPrintableStatus, | ||
})} | ||
position={PopoverPosition.right} | ||
> | ||
<StatusPopoverButton vmPrintableStatus={vmPrintableStatus} /> | ||
</Popover> | ||
</> | ||
); | ||
}; | ||
|
||
export default VirtualMachineOverviewStatus; |
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
24 changes: 17 additions & 7 deletions
24
...hinesinstance/details/tabs/details/components/Details/OperatingSystem/OperatingSystem.tsx
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