diff --git a/frontend/packages/kubevirt-plugin/src/components/dashboards-page/overview-dashboard/inventory.tsx b/frontend/packages/kubevirt-plugin/src/components/dashboards-page/overview-dashboard/inventory.tsx index 032980e4529..f93d12ffd45 100644 --- a/frontend/packages/kubevirt-plugin/src/components/dashboards-page/overview-dashboard/inventory.tsx +++ b/frontend/packages/kubevirt-plugin/src/components/dashboards-page/overview-dashboard/inventory.tsx @@ -50,6 +50,7 @@ export const getVMStatusGroups: StatusGroupMapper = ( VMStatusSimpleLabel.Migrating, VMStatusSimpleLabel.Stopping, StatusSimpleLabel.Pending, + VMStatusSimpleLabel.Deleting, ], count: 0, filterType: 'vm-status', diff --git a/frontend/packages/kubevirt-plugin/src/components/vms/vm.tsx b/frontend/packages/kubevirt-plugin/src/components/vms/vm.tsx index a4da1af58fd..cc703458467 100644 --- a/frontend/packages/kubevirt-plugin/src/components/vms/vm.tsx +++ b/frontend/packages/kubevirt-plugin/src/components/vms/vm.tsx @@ -8,14 +8,11 @@ import { dimensifyHeader, dimensifyRow, getCreationTimestamp, - getDeletetionTimestamp, getName, getNamespace, - getOwnerReferences, getUID, getLabels, } from '@console/shared'; -import { compareOwnerReference } from '@console/shared/src/utils/owner-references'; import { NamespaceModel, PodModel, @@ -46,7 +43,7 @@ import { VirtualMachineModel, } from '../../models'; import { VMIKind, VMKind } from '../../types'; -import { buildOwnerReferenceForModel, getBasicID, getLoadedData } from '../../utils'; +import { getBasicID, getLoadedData } from '../../utils'; import { getVMStatus } from '../../statuses/vm/vm-status'; import { getVmiIpAddresses, getVMINodeName } from '../../selectors/vmi'; import { isVMImport, isVM, isVMI } from '../../selectors/check-type'; @@ -359,21 +356,7 @@ const VirtualMachinesPage: React.FC = (props) => { ...objectBundle, }; }) - .filter(({ vm, vmi, vmImport, metadata }) => { - if (vmImport && metadata.vmImportStatus?.isCompleted()) { - return false; - } - - if (vm || !getDeletetionTimestamp(vmi)) { - return true; - } - const vmOwnerReference = buildOwnerReferenceForModel(VirtualMachineModel, getName(vmi)); - - // show finalizing VMIs only if they are not owned by VM - return !(getOwnerReferences(vmi) || []).some((o) => - compareOwnerReference(o, vmOwnerReference), - ); - }); + .filter(({ vmImport, metadata }) => !(vmImport && metadata.vmImportStatus?.isCompleted())); }; const createAccessReview = skipAccessReview ? null : { model: VirtualMachineModel, namespace }; diff --git a/frontend/packages/kubevirt-plugin/src/constants/vm/vm-status.ts b/frontend/packages/kubevirt-plugin/src/constants/vm/vm-status.ts index 550540b04e0..60e9b7e2e0b 100644 --- a/frontend/packages/kubevirt-plugin/src/constants/vm/vm-status.ts +++ b/frontend/packages/kubevirt-plugin/src/constants/vm/vm-status.ts @@ -13,6 +13,7 @@ export enum VMStatusSimpleLabel { Stopping = 'Stopping', Running = 'Running', Off = 'Off', + Deleting = 'Deleting', } export const VM_STATUS_SIMPLE_LABELS = [ @@ -43,6 +44,9 @@ export class VMStatus extends StatusEnum { return null; }; +const isDeleting = (vm: VMKind, vmi: VMIKind): VMStatusBundle => + (vm && !!getDeletetionTimestamp(vm)) || (!vm && vmi && !!getDeletetionTimestamp(vmi)) + ? { status: VMStatus.DELETING } + : null; + const isBeingStopped = (vm: VMKind): VMStatusBundle => { if (vm && !isVMExpectedRunning(vm) && isVMCreated(vm)) { return { @@ -310,6 +320,7 @@ export const getVMStatus = ({ isBeingMigrated(vm, vmi, migrations) || isBeingImported(vm, pods, pvcs, dataVolumes) || isVMError(vm) || + isDeleting(vm, vmi) || isBeingStopped(vm) || isOff(vm) || isError(vm, vmi, launcherPod) || diff --git a/frontend/packages/kubevirt-plugin/src/topology/components/nodes/VmNode.tsx b/frontend/packages/kubevirt-plugin/src/topology/components/nodes/VmNode.tsx index f1cc6e4c933..13334287f0a 100644 --- a/frontend/packages/kubevirt-plugin/src/topology/components/nodes/VmNode.tsx +++ b/frontend/packages/kubevirt-plugin/src/topology/components/nodes/VmNode.tsx @@ -125,6 +125,7 @@ const ObservedVmNode: React.FC = ({ case VMStatus.STARTING: statusClass = 'kubevirt-m-not-ready'; break; + case VMStatus.DELETING: case VMStatus.STOPPING: statusClass = 'kubevirt-m-terminating'; break;