diff --git a/emhttp/plugins/dynamix/ShareEdit.page b/emhttp/plugins/dynamix/ShareEdit.page index 093ad9ff6..52f9d5ce5 100644 --- a/emhttp/plugins/dynamix/ShareEdit.page +++ b/emhttp/plugins/dynamix/ShareEdit.page @@ -56,23 +56,26 @@ if ((! $share['cachePool']) && ($share['cachePool2'])) { $share['cachePool2'] = ""; } +/* Correct a situation in previous Unraid versions where an array only share has a useCache defined. */ +if ((!$poolsOnly) && ($share['useCache'] == "no")) { + $share['cachePool'] = ""; +} + /* Check for non existent pool device. */ -if ($share['cachePool'] && !in_array($share['cachePool'], $pools)) { - $poolDefined = false; +if (($share['cachePool'] && !in_array($share['cachePool'], $pools))) { $share['useCache'] = $share['cachePool2'] ? "yes" : ($poolsOnly ? "no" : "yes"); + $poolDefined = false; } else { $share['useCache'] = $share['useCache'] ?: ($poolsOnly ? "only" : "no"); $poolDefined = true; } /* Check for pool 2 (or array) being defined. */ +$poolDefined2 = true; if ((($share['useCache'] == "yes") || ($share['useCache'] == "prefer")) && ($poolsOnly) && (!$share['cachePool2'])) { - $poolDefined2 = true; $share['useCache'] = "only"; } else if ($share['cachePool2']) { $poolDefined2 = in_array($share['cachePool2'], $pools); -} else { - $poolDefined2 = true; } $cachePoolCapitalized = compress(my_disk($share['cachePool'],$display['raw'])); @@ -457,7 +460,7 @@ _(Excluded disk(s))_: -
+
_(Secondary storage)_: : @@ -541,14 +544,10 @@ _(Mover action)_:   : -
-_(Delete)_ +
+ :
-
-  -: -
@@ -633,7 +632,7 @@ function updateScreen(cache, slow) { const moverNoActionText = ""; const moverAction1Text = ""; const moverAction2Text = ""; - + switch (cache) { case 'no': $('#primary option:eq(' + z(0) + ')').prop('selected', true); @@ -762,9 +761,18 @@ function updateScreen(cache, slow) { break; } + /* If primary is "Array", remove secondary storage selection as it does not apply when primary is array. */ + if (primaryDropdown.selectedIndex === 0) { + $('#secondaryStorage').hide(slow); + $('#moverAction').hide(slow); + } else { + $('#secondaryStorage').show(slow); + $('#moverAction').show(slow); + } + /* Check secondary dropdown index and show/hide moreSettings2 */ if (secondaryDropdown.selectedIndex === 1) { - $('#moreSettings2').show('slow'); + $('#moreSettings2').show(slow); } else { $('#moreSettings2').hide(slow); } @@ -1078,7 +1086,7 @@ function writeShare(data, n, i) { } }); toggleButton('writeshare', true); - $('div.spinner.fixed').show('slow'); + $('div.spinner.fixed').show(slow); writeShare(newData, 0, i); } } @@ -1131,7 +1139,7 @@ document.addEventListener('DOMContentLoaded', function() { let cachePoolOption = document.getElementById('cachePoolOption'); let messageSpan = document.getElementById('cachePoolMessage'); - messageSpan.textContent = `${_('Warning: Configured Pool')} '${cachePoolCapitalized}' ${_('is missing')}.`; + messageSpan.textContent = `${_('Warning: Configured Pool')} '${cachePoolCapitalized || _('Array')}' ${_('is missing')}.`; messageSpan.style.display = 'inline'; cachePoolOption.selected = true; @@ -1297,13 +1305,24 @@ function handleDeleteClick(button) { $(function() { + + $.post('/webGui/include/ShareList.php', { scan: "" }, function(e) { if (e == 1) { $('.empty').show(); $('.full').hide(); + /* Enable delete checkbox and update tooltip. */ + $('input[name="confirmDelete"]').prop('disabled', false).attr('title', ''); + $('#deleteLabel').attr('title', ''); } else { $('.full1').hide(); $('.full2').show(); + /* Disable delete checkbox and update tooltip. */ + $('input[name="confirmDelete"]').prop('disabled', true).attr('title', ''); + $('#deleteLabel').attr('title', ''); } }); diff --git a/emhttp/plugins/dynamix/include/ShareList.php b/emhttp/plugins/dynamix/include/ShareList.php index 20b64fb85..c6c1e9f03 100644 --- a/emhttp/plugins/dynamix/include/ShareList.php +++ b/emhttp/plugins/dynamix/include/ShareList.php @@ -188,6 +188,11 @@ define('LUKS_STATUS_UNENCRYPTED', 2); // Build table $row = 0; foreach ($shares as $name => $share) { + /* Correct a situation in previous Unraid versions where an array only share has a useCache defined. */ + if ((!$poolsOnly) && ($share['useCache'] == "no")) { + $share['cachePool'] = ""; + } + /* Is cachePool2 defined? If it is we need to show the cache pool 2 device name instead of 'Array'. */ if ($share['cachePool2']) { $array = compress(my_disk($share['cachePool2'],$display['raw']));