Skip to content

Commit

Permalink
Merge pull request #2341 from avivtur/it-vm-in-template-vm-nic-flow
Browse files Browse the repository at this point in the history
CNV-50766: Cannot delete NIC from VM
  • Loading branch information
openshift-merge-bot[bot] authored Jan 6, 2025
2 parents e6d4508 + 0e9c928 commit c442411
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import KebabToggle from '@kubevirt-utils/components/toggles/KebabToggle';
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
import { getInterfaces, getNetworks } from '@kubevirt-utils/resources/vm';
import { NetworkPresentation } from '@kubevirt-utils/resources/vm/utils/network/constants';
import { vmSignal } from '@kubevirt-utils/store/customizeInstanceType';
import { isEmpty } from '@kubevirt-utils/utils/utils';
import { ButtonVariant, Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core';

Expand All @@ -19,17 +18,18 @@ type NetworkInterfaceActionsProps = {
nicName: string;
nicPresentation: NetworkPresentation;
onUpdateVM?: (updateVM: V1VirtualMachine) => Promise<void>;
vm: V1VirtualMachine;
};

const NetworkInterfaceActions: FC<NetworkInterfaceActionsProps> = ({
nicName,
nicPresentation,
onUpdateVM,
vm,
}) => {
const { t } = useKubevirtTranslation();
const { updateVM, vm: vmContext } = useWizardVMContext();
const { updateVM } = useWizardVMContext();
const { createModal } = useModal();
const vm = vmSignal.value || vmContext;
const onUpdate = onUpdateVM || updateVM;
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const label = t('Delete NIC?');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const NetworkInterfaceList: React.FC<NetworkInterfaceListProps> = ({ onUpdateVM,
loaded
loadError={false}
Row={NetworkInterfaceRow}
rowData={{ onUpdateVM }}
rowData={{ onUpdateVM, vm }}
unfilteredData={data}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ export type NetworkInterfaceRowProps = {
};

const NetworkInterfaceRow: FC<
RowProps<NetworkPresentation, { onUpdateVM?: (updateVM: V1VirtualMachine) => Promise<void> }>
> = ({ activeColumnIDs, obj: { iface, network }, rowData: { onUpdateVM } }) => {
RowProps<
NetworkPresentation,
{ onUpdateVM?: (updateVM: V1VirtualMachine) => Promise<void>; vm: V1VirtualMachine }
>
> = ({ activeColumnIDs, obj: { iface, network }, rowData: { onUpdateVM, vm } }) => {
const { t } = useKubevirtTranslation();
return (
<>
Expand Down Expand Up @@ -43,6 +46,7 @@ const NetworkInterfaceRow: FC<
nicName={network?.name}
nicPresentation={{ iface, network }}
onUpdateVM={onUpdateVM}
vm={vm}
/>
</TableData>
</>
Expand Down

0 comments on commit c442411

Please sign in to comment.