Skip to content

Commit

Permalink
Merge pull request #4985 from marusak/review_size
Browse files Browse the repository at this point in the history
webui: Show partition size on review page
  • Loading branch information
KKoukiou authored Aug 2, 2023
2 parents 04656ae + e9fd6c8 commit 3e24991
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
15 changes: 10 additions & 5 deletions ui/webui/src/components/review/ReviewConfiguration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,19 @@ const DeviceRow = ({ deviceData, disk, requests }) => {
const name = data.name.v;

const renderRow = row => {
const format = row["format-type"] ? cockpit.format(_("format as $0"), row["format-type"]) : null;
const name = row["device-spec"];
const action = (
row.reformat
? (row["format-type"] ? cockpit.format(_("format as $0"), row["format-type"]) : null)
: ((row["format-type"] === "biosboot") ? row["format-type"] : _("mount"))
);
const mount = row["mount-point"] || null;
const reformat = row.reformat ? _("reformat") : null;
const actions = [format, mount, reformat].filter(Boolean).join(", ");
const actions = [action, mount].filter(Boolean).join(", ");
const size = cockpit.format_bytes(deviceData[name].size.v);

return (
<ListItem className="pf-u-font-size-s">
{row["device-spec"]}: {actions}
<ListItem className="pf-u-font-size-s" key={name}>
{name}, {size}: {actions}
</ListItem>
);
};
Expand Down
2 changes: 1 addition & 1 deletion ui/webui/src/components/storage/MountPointMapping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const getLockedLUKSDevices = (requests, deviceData) => {
};

const MountPointColumn = ({ handleRequestChange, idPrefix, isRequiredMountPoint, request, requests }) => {
const mountpoint = request["mount-point"];
const mountpoint = request["mount-point"] || "";

const [mountPointText, setMountPointText] = useState(mountpoint);

Expand Down
34 changes: 17 additions & 17 deletions ui/webui/test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")

r.check_disk_row(disk, 1, "vda1: format as biosboot")
r.check_disk_row(disk, 2, "vda2: format as ext4, /boot, reformat")
r.check_disk_row(disk, 3, "btrfstest: format as btrfs, /, reformat")
r.check_disk_row(disk, 4, "vda4: format as xfs, /home")
r.check_disk_row(disk, 1, "vda1, 1.05 MB: biosboot")
r.check_disk_row(disk, 2, "vda2, 1.07 GB: format as ext4, /boot")
r.check_disk_row(disk, 3, "btrfstest, 10.7 GB: format as btrfs, /")
r.check_disk_row(disk, 4, "vda4, 4.29 GB: mount, /home")

@nondestructive
def testNoRootMountPoint(self):
Expand Down Expand Up @@ -592,13 +592,13 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
# verify review screen
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")
r.check_disk_row(disk, 1, "vda1: format as biosboot")
r.check_disk_row(disk, 2, "vda2: format as xfs, /boot")
r.check_disk_row(disk, 3, "vda3: format as xfs, /, reformat")
r.check_disk_row(disk, 1, "vda1, 1.05 MB: biosboot")
r.check_disk_row(disk, 2, "vda2, 1.07 GB: mount, /boot")
r.check_disk_row(disk, 3, "vda3, 15.0 GB: format as xfs, /")

disk = "vdb"
r.check_disk(disk, "10.7 GB vdb (0x1af4)")
r.check_disk_row(disk, 1, "vdb1: format as xfs, /home")
r.check_disk_row(disk, 1, "vdb1, 10.7 GB: mount, /home")

b.assert_pixels(
"#app",
Expand Down Expand Up @@ -734,10 +734,10 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")

r.check_disk_row(disk, 1, "vda1: format as biosboot")
r.check_disk_row(disk, 2, "vda2: format as ext4, /boot, reformat")
r.check_disk_row(disk, 3, "root: format as btrfs, /, reformat")
r.check_disk_row(disk, 4, "home: format as btrfs, /home")
r.check_disk_row(disk, 1, "vda1, 1.05 MB: biosboot")
r.check_disk_row(disk, 2, "vda2, 1.07 GB: format as ext4, /boot")
r.check_disk_row(disk, 3, "root, 15.0 GB: format as btrfs, /")
r.check_disk_row(disk, 4, "home, 15.0 GB: mount, /home")

@nondestructive
def testLVM(self):
Expand All @@ -757,7 +757,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
self.partition_disk(disk, [("1MiB", "biosboot"), ("1GB", "ext4"), ("", None)])
m.execute(f"""
vgcreate -y -f {vgname} {disk}3
lvcreate -y -l50%FREE -n root {vgname}
lvcreate -y -l40%FREE -n root {vgname}
mkfs.ext4 -F /dev/{vgname}/root
lvcreate -y -l100%FREE -n home {vgname}
mkfs.ext4 -F /dev/{vgname}/home
Expand Down Expand Up @@ -801,10 +801,10 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
disk = "vda"
r.check_disk(disk, "16.1 GB vda (0x1af4)")

r.check_disk_row(disk, 1, "vda1: format as biosboot")
r.check_disk_row(disk, 2, "vda2: format as ext4, /boot, reformat")
r.check_disk_row(disk, 3, f"{vgname}-root: format as ext4, /, reformat")
r.check_disk_row(disk, 4, f"{vgname}-home: format as ext4, /home")
r.check_disk_row(disk, 1, "vda1, 1.05 MB: biosboot")
r.check_disk_row(disk, 2, "vda2, 1.07 GB: format as ext4, /boot")
r.check_disk_row(disk, 3, f"{vgname}-root, 6.01 GB: format as ext4, /")
r.check_disk_row(disk, 4, f"{vgname}-home, 9.02 GB: mount, /home")

if __name__ == '__main__':
test_main()

0 comments on commit 3e24991

Please sign in to comment.