Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webui: Update request IDs when removing mount point row #5077

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ui/webui/src/components/storage/MountPointMapping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ const MountPointColumn = ({ handleRequestChange, idPrefix, isRequiredMountPoint,

const swapMountpoint = mountpoint === "swap";

useEffect(() => {
setMountPointText(request["mount-point"] || "");
}, [request]);

return (
<Flex direction={{ default: "column" }} spaceItems={{ default: "spaceItemsNone" }}>
<Flex spaceItems={{ default: "spaceItemsMd" }}>
Expand Down Expand Up @@ -298,7 +302,13 @@ const FormatColumn = ({ deviceData, handleRequestChange, idPrefix, request, requ

const MountPointRowRemove = ({ request, setRequests }) => {
const handleRemove = () => {
setRequests(requests => requests.filter(r => r["request-id"] !== request["request-id"]));
// remove row from requests and update requests with higher ID
setRequests(requests => requests.filter(r => r["request-id"] !== request["request-id"]).map(({
...r
}) => ({
...r,
"request-id": r["request-id"] > request["request-id"] ? r["request-id"] - 1 : r["request-id"],
})));
};

return (
Expand Down
20 changes: 19 additions & 1 deletion ui/webui/test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
# * either also reformatted if selected
# * either not selected (not part of the mountpoint assignment table)
self.remove_row(5)
self.remove_row(6)
self.remove_row(5)
self.wait_mount_point_table_column_helper(3, "format", present=False)
self.wait_mount_point_table_column_helper(4, "format", present=False)

Expand Down Expand Up @@ -866,6 +866,24 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
r.check_disk_row(disk, 3, f"{vgname}-home, 8.12 GB: mount, /home")
r.check_disk_row(disk, 4, f"{vgname}-swap, 902 MB: mount, swap")

i.back(previous_page=i.steps.CUSTOM_MOUNT_POINT)

# remove the /home row and check that row 3 is now swap
self.remove_row(3)

self.check_row_mountpoint(3, "swap")
self.check_row_device(3, f"{vgname}-swap")

i.next()

# verify review screen
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")

r.check_disk_row(disk, 1, "vda2, 1.07 GB: mount, /boot")
r.check_disk_row(disk, 2, f"{vgname}-root, 6.01 GB: format as ext4, /")
r.check_disk_row(disk, 3, f"{vgname}-swap, 902 MB: mount, swap")

@nondestructive
def testUnusableFormats(self):
b = self.browser
Expand Down