From 3c0566387c52e872471302f4b74baa003d836254 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 27 Sep 2024 14:16:30 +0200 Subject: [PATCH] storaged: Adjust stratis fs limits layout in creation dialog Clean up the dialog changes from commit 236ffd3fb612 as per [1]: - Visually merge both options into "Stratis filesystem" and avoid extra top-level labels. - Point out that the sizes are Stratis specific, as it doesn't say anywhere else in the dialog. - Remove redundant "virtual filesystem" words in the options - Avoid "Manage", pretty much all of Cockpit is "managing" something. [1] https://github.com/cockpit-project/cockpit/pull/21039#issuecomment-2373963643 --- pkg/storaged/stratis/pool.jsx | 29 ++++++++++++++++++----------- test/verify/check-storage-stratis | 8 ++++---- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/pkg/storaged/stratis/pool.jsx b/pkg/storaged/stratis/pool.jsx index e9a77a86bac1..c678270fd690 100644 --- a/pkg/storaged/stratis/pool.jsx +++ b/pkg/storaged/stratis/pool.jsx @@ -92,28 +92,35 @@ function create_fs(pool) { { validate: name => validate_fs_name(null, name, filesystems) }), - CheckBoxes("size_options", _("Manage virtual size"), + CheckBoxes("set_custom_size", _("Stratis filesystem"), { value: { - custom_size: !pool.Overprovisioning, - custom_limit: false, + enabled: !pool.Overprovisioning, }, fields: [ - { tag: "custom_size", title: _("Specify initial virtual filesystem size") }, - { tag: "custom_limit", title: _("Limit virtual filesystem size") }, + { tag: "enabled", title: _("Set initial size") }, ] }), - SizeSlider("size", _("Initial virtual size"), + SizeSlider("size", "", { - visible: vals => vals.size_options.custom_size, + visible: vals => vals.set_custom_size.enabled, min: fsys_min_size, max: pool.Overprovisioning ? stats.pool_total : stats.pool_free, allow_infinite: pool.Overprovisioning, round: 512 }), - SizeSlider("limit", _("Virtual size limit"), + CheckBoxes("set_custom_limit", "", { - visible: vals => vals.size_options.custom_limit, + value: { + enabled: false, + }, + fields: [ + { tag: "enabled", title: _("Limit size") }, + ] + }), + SizeSlider("limit", "", + { + visible: vals => vals.set_custom_limit.enabled, min: fsys_min_size, max: pool.Overprovisioning ? stats.pool_total : stats.pool_free, allow_infinite: true, @@ -136,9 +143,9 @@ function create_fs(pool) { Variants: action_variants, action: async function (vals) { let size_spec = [false, ""]; let limit_spec = [false, ""]; - if (vals.size_options.custom_size) + if (vals.set_custom_size.enabled) size_spec = [true, vals.size.toString()]; - if (vals.size_options.custom_limit) + if (vals.set_custom_limit.enabled) limit_spec = [true, vals.limit.toString()]; const result = await pool.CreateFilesystems([[vals.name, size_spec, limit_spec]]).then(std_reply); if (result[0]) diff --git a/test/verify/check-storage-stratis b/test/verify/check-storage-stratis index 7bb5681bdfee..34ed72ce39f0 100755 --- a/test/verify/check-storage-stratis +++ b/test/verify/check-storage-stratis @@ -432,7 +432,7 @@ systemctl restart stratisd b.click(self.card_button("Stratis filesystems", "Create new filesystem")) self.dialog_wait_open() - self.dialog_wait_val('size_options.custom_size', val=True) + self.dialog_wait_val('set_custom_size.enabled', val=True) self.dialog_set_val('name', 'fsys1') self.dialog_apply_secondary() self.dialog_wait_close() @@ -463,7 +463,7 @@ systemctl restart stratisd b.click(self.card_button("Stratis filesystems", "Create new filesystem")) self.dialog_wait_open() - self.dialog_wait_val('size_options.custom_size', val=False) + self.dialog_wait_val('set_custom_size.enabled', val=False) self.dialog_cancel() self.dialog_wait_close() @@ -501,9 +501,9 @@ systemctl restart stratisd b.click(self.card_button("Stratis filesystems", "Create new filesystem")) self.dialog_wait_open() self.dialog_set_val('name', 'fsys1') - self.dialog_set_val('size_options.custom_size', val=True) + self.dialog_set_val('set_custom_size.enabled', val=True) self.dialog_set_val('size', 800) - self.dialog_set_val('size_options.custom_limit', val=True) + self.dialog_set_val('set_custom_limit.enabled', val=True) self.dialog_set_val('limit', 1600) self.dialog_apply_secondary() self.dialog_wait_close()