From 532dc57d0cb699cddd83e2e3894246f5680ef0ee Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Thu, 2 Jul 2026 23:45:10 -0400 Subject: [PATCH 1/2] fix(shares): allow setting Emptying disk(s) while array is Started The Global Share Settings form locks every control whenever the array is not Stopped. The 'Emptying disk(s)' setting (shareUserEmptying), however, is accepted by emhttpd at runtime, so gating it on array state is an unnecessary UI restriction. Decouple shareUserEmptying from the array-state lock in presetShare(), gating it only on user shares being enabled, and add the previously missing help text for the field. Other settings remain locked while the array is Started. --- emhttp/languages/en_US/helptext.txt | 7 +++++++ emhttp/plugins/dynamix/ShareSettings.page | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/emhttp/languages/en_US/helptext.txt b/emhttp/languages/en_US/helptext.txt index 92ee679a46..fbe7d7bf23 100644 --- a/emhttp/languages/en_US/helptext.txt +++ b/emhttp/languages/en_US/helptext.txt @@ -1553,6 +1553,13 @@ Uncheck all disks in order to not exclude any disks disks which represent a subset of the Included/Excluded disks defined here. :end +:shares_emptying_disks_help: +This setting designates array disk(s) that are being *emptied* of User Share data, +typically as a prelude to removing the disk(s) from the array. + +Unlike the other Global Share Settings, this setting may be changed while the array is **Started**. +:end + :shares_exclusive_shares_help: If set to Yes, share directories under /mnt/user are actually symlinks to the share directory on a storage volume provided the following conditions are met: diff --git a/emhttp/plugins/dynamix/ShareSettings.page b/emhttp/plugins/dynamix/ShareSettings.page index a61a05f00c..44311f111f 100644 --- a/emhttp/plugins/dynamix/ShareSettings.page +++ b/emhttp/plugins/dynamix/ShareSettings.page @@ -18,6 +18,9 @@ Tag="share-alt" ?> : shares=='-'; + form.shareUserEmptying.disabled = emptyingDisabled; + $('#s3').dropdownchecklist(emptyingDisabled ? 'disable':'enable'); }
@@ -189,5 +195,5 @@ _(Number of fuse File Descriptors)_: -*_(Array must be **Stopped** to change)_* +*_(Array must be **Stopped** to change these settings, except **Emptying disk(s)**)_*
From 24f3c191580dda42517656460ad6becbac3686d5 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Thu, 2 Jul 2026 23:51:53 -0400 Subject: [PATCH 2/2] refactor(shares): split Emptying disk(s) into its own form Rather than keeping 'Emptying disk(s)' inside the array-state-locked Global Share Settings form and relying on disabled fields not being POSTed, move it into a dedicated form at the bottom of the page with its own Apply button (mirrors the two-form pattern in NFS.page). The emptying form posts only shareUserEmptying to /update.htm, is always editable while user shares are enabled regardless of array state, and makes the submit semantics explicit. The main form reverts to locking all of its settings while the array is not Stopped. --- emhttp/plugins/dynamix/ShareSettings.page | 63 ++++++++++++++--------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/emhttp/plugins/dynamix/ShareSettings.page b/emhttp/plugins/dynamix/ShareSettings.page index 44311f111f..171e6c9dff 100644 --- a/emhttp/plugins/dynamix/ShareSettings.page +++ b/emhttp/plugins/dynamix/ShareSettings.page @@ -64,18 +64,6 @@ async function prepareShare(form) { item.value = exclude; item.selected = true; - var emptying = ''; - for (var i=0,item; item=form.shareUserEmptying.options[i]; i++) { - if (item.selected) { - if (emptying.length) emptying += ','; - emptying += item.value; - item.selected = false; - } - } - item = form.shareUserEmptying.options[0]; - item.value = emptying; - item.selected = true; - /* Validate file count input against fileMax */ try { const fileCountInput = form.querySelector('#file_count'); @@ -99,6 +87,22 @@ async function prepareShare(form) { return true; } +/* Collapse the Emptying disk(s) multi-select into a single value before submit. */ +function prepareEmptying(form) { + var emptying = ''; + for (var i=0,item; item=form.shareUserEmptying.options[i]; i++) { + if (item.selected) { + if (emptying.length) emptying += ','; + emptying += item.value; + item.selected = false; + } + } + item = form.shareUserEmptying.options[0]; + item.value = emptying; + item.selected = true; + return true; +} + function presetShare(form,shares) { var disabled = shares==null ? : shares=='-'; var onOff = disabled ? 'disable':'enable'; @@ -106,10 +110,10 @@ function presetShare(form,shares) { form.shareUserExclude.disabled = disabled; $('#s1').dropdownchecklist(onOff); $('#s2').dropdownchecklist(onOff); - /* Emptying disk(s) can be changed while the array is Started - emhttpd accepts it. - Only disable it when user shares are turned off. */ + /* Emptying disk(s) lives in its own form so it can be changed while the array is + Started - emhttpd accepts it. Only disable it when user shares are turned off. */ var emptyingDisabled = shares==null ? : shares=='-'; - form.shareUserEmptying.disabled = emptyingDisabled; + document.share_emptying.shareUserEmptying.disabled = emptyingDisabled; $('#s3').dropdownchecklist(emptyingDisabled ? 'disable':'enable'); } @@ -150,15 +154,6 @@ _(Excluded disk(s))_: :shares_excluded_disks_help: -_(Emptying disk(s))_: -: - -:shares_emptying_disks_help: - _(Permit exclusive shares)_: : -*_(Array must be **Stopped** to change these settings, except **Emptying disk(s)**)_* +*_(Array must be **Stopped** to change)_* + + +
+ +_(Emptying disk(s))_: +: + +:shares_emptying_disks_help: + +  +: + + +