Skip to content

Commit

Permalink
Disable remove extended partition for efi OS
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Nov 12, 2024
1 parent a686f00 commit 42ddf9f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/storage/ReclaimSpaceModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,10 @@ const getDeviceRow = (disk, devices, level = 0, unappliedActions, setUnappliedAc
idPrefix + "-device-level-" + level,
];

if (!device.children.v.length) {
const parentDevice = device.parents.v[0] ? devices[device.parents.v[0]] : undefined;
const siblings = parentDevice?.children.v;
const isLastChild = !siblings || siblings.findIndex((child) => child === disk) === siblings.length - 1;
const isLastChild = device.attrs?.v.isleaf === "True";

if (isLastChild) {
classNames.push(idPrefix + "-device-leaf");
}
if (isLastChild) {
classNames.push(idPrefix + "-device-leaf");
}

let deviceType = getDeviceTypeInfo(device);
Expand Down Expand Up @@ -359,14 +355,16 @@ const DeviceActionDelete = ({ device, hasBeenRemoved, newDeviceSize, onAction })

// Disable the remove action for disk devices without partitions
const isRemoveDisabled = device.type.v === "disk" && device.children.v.length === 0;
// Disable the remove action for partitions without children witch is not leaf node
const isExtendedPartition = device.attrs?.v.isleaf === "False" && device.children.v.length === 0;

// Do not show 'delete' text for disks directly, we show 'delete' text for the contained partitions
const deleteText = device.type.v !== "disk" ? <DeleteText /> : "";
const deleteButton = (
<Button
aria-label={_("delete")}
icon={<TrashIcon />}
isDisabled={isRemoveDisabled}
isDisabled={isRemoveDisabled || isExtendedPartition}
onClick={onRemove}
variant="plain"
/>
Expand Down

0 comments on commit 42ddf9f

Please sign in to comment.