Skip to content

Commit

Permalink
storaged: Adjust stratis fs limits layout in creation dialog
Browse files Browse the repository at this point in the history
Clean up the dialog changes from commit 236ffd3 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] #21039 (comment)
  • Loading branch information
martinpitt committed Sep 27, 2024
1 parent f540cfa commit 3c05663
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
29 changes: 18 additions & 11 deletions pkg/storaged/stratis/pool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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])
Expand Down
8 changes: 4 additions & 4 deletions test/verify/check-storage-stratis
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 3c05663

Please sign in to comment.