diff --git a/locales/en/plugin__kubevirt-plugin.json b/locales/en/plugin__kubevirt-plugin.json index ac21e5360..6ee09687a 100644 --- a/locales/en/plugin__kubevirt-plugin.json +++ b/locales/en/plugin__kubevirt-plugin.json @@ -398,6 +398,7 @@ "Local storage (LSO)": "Local storage (LSO)", "MAC address": "MAC address", "MAC Address": "MAC Address", + "Machine type": "Machine type", "Make sure to have clone permissions in the destination namespace. <2>Learn more <1>": "Make sure to have clone permissions in the destination namespace. <2>Learn more <1>", "Manual Connection": "Manual Connection", "Map of string keys and values that can be used to organize and categorize (scope and select) objects": "Map of string keys and values that can be used to organize and categorize (scope and select) objects", diff --git a/src/utils/resources/vm/utils/selectors.ts b/src/utils/resources/vm/utils/selectors.ts index 6425ed438..be0fad682 100644 --- a/src/utils/resources/vm/utils/selectors.ts +++ b/src/utils/resources/vm/utils/selectors.ts @@ -118,3 +118,11 @@ export const getBootDisk = (vm: V1VirtualMachine): V1Disk => .reduce((acc, disk) => { return acc.bootOrder < disk.bootOrder ? acc : disk; }, getDisks(vm)?.[0]); + +/** + * A selector for the QEMU machine's type + * @param {V1VirtualMachine} vm the virtual machine + * @returns {string} the machine type + */ +export const getMachineType = (vm: V1VirtualMachine): string => + vm?.spec?.template?.spec?.domain?.machine?.type; diff --git a/src/views/templates/details/tabs/details/components/TemplateDetailsLeftGrid.tsx b/src/views/templates/details/tabs/details/components/TemplateDetailsLeftGrid.tsx index 3dbd0793f..d83efb0ea 100644 --- a/src/views/templates/details/tabs/details/components/TemplateDetailsLeftGrid.tsx +++ b/src/views/templates/details/tabs/details/components/TemplateDetailsLeftGrid.tsx @@ -10,6 +10,9 @@ import Owner from 'src/views/templates/details/tabs/details/components/Owner'; import { TemplateDetailsGridProps } from 'src/views/templates/details/tabs/details/TemplateDetailsPage'; import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; +import { getTemplateVirtualMachineObject } from '@kubevirt-utils/resources/template'; +import { getMachineType } from '@kubevirt-utils/resources/vm'; +import { NO_DATA_DASH } from '@kubevirt-utils/resources/vm/utils/constants'; import { getOperatingSystemName } from '@kubevirt-utils/resources/vm/utils/operation-system/operationSystem'; import { DescriptionList } from '@patternfly/react-core'; @@ -21,6 +24,7 @@ import WorkloadProfile from './WorkloadProfile'; const TemplateDetailsLeftGrid: React.FC = ({ template, editable }) => { const { t } = useKubevirtTranslation(); + const machineType = getMachineType(getTemplateVirtualMachineObject(template)) || NO_DATA_DASH; return ( @@ -33,6 +37,7 @@ const TemplateDetailsLeftGrid: React.FC = ({ template, + diff --git a/src/views/virtualmachines/details/tabs/details/components/grid/leftGrid/VirtualMachineDetailsLeftGrid.tsx b/src/views/virtualmachines/details/tabs/details/components/grid/leftGrid/VirtualMachineDetailsLeftGrid.tsx index 69324f31e..b3a2994fd 100644 --- a/src/views/virtualmachines/details/tabs/details/components/grid/leftGrid/VirtualMachineDetailsLeftGrid.tsx +++ b/src/views/virtualmachines/details/tabs/details/components/grid/leftGrid/VirtualMachineDetailsLeftGrid.tsx @@ -21,9 +21,11 @@ import { asAccessReview, getAnnotation, getLabel } from '@kubevirt-utils/resourc import { LABEL_USED_TEMPLATE_NAMESPACE } from '@kubevirt-utils/resources/template'; import { DESCRIPTION_ANNOTATION, + getMachineType, useVMIAndPodsForVM, VM_TEMPLATE_ANNOTATION, } from '@kubevirt-utils/resources/vm'; +import { NO_DATA_DASH } from '@kubevirt-utils/resources/vm/utils/constants'; import { useGuestOS } from '@kubevirt-utils/resources/vmi'; import { k8sPatch, @@ -227,6 +229,10 @@ const VirtualMachineDetailsLeftGrid: React.FC +