Skip to content

Commit 9294349

Browse files
authored
Merge pull request #2615 from unraid/codex/7.2-mover-empty-no-pool
fix: allow mover empty action without pools on 7.2
2 parents 254ed23 + cfc4734 commit 9294349

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

emhttp/plugins/dynamix/ArrayOperation.page

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ mymonitor.on('message', function(state) {
394394
<?if (_var($var,'shareUser') == 'e' && $pool_devices):?>
395395
$('#mover-button').prop('disabled',false);
396396
$('#mover-text').html("<b>_(Move)_</b> _(will immediately invoke the Mover)_.&nbsp;<a href=\"/Main/Settings/Scheduler\"<?if($tabbed):?> onclick=\"$.cookie('one','tab2')\"<?endif;?>>(_(Schedule)_)</a>");
397+
<?endif;?>
398+
<?if (_var($var,'shareUser') == 'e' && !$pool_devices):?>
399+
$('#mover-button').prop('disabled',false);
400+
$('#mover-text').html("<b>_(Empty)_</b> _(will immediately invoke the Mover to Empty a disk)_.&nbsp;<a href=\"/Main/Settings/Scheduler\"<?if($tabbed):?> onclick=\"$.cookie('one','tab2')\"<?endif;?>>(_(Schedule)_)</a>");
397401
<?endif;?>
398402
break;
399403
case '1': // parity running
@@ -406,6 +410,10 @@ mymonitor.on('message', function(state) {
406410
<?if (_var($var,'shareUser') == 'e' && $pool_devices):?>
407411
$('#mover-button').prop('disabled',true);
408412
$('#mover-text').html("_(Disabled)_ -- _(Parity operation is running)_");
413+
<?endif;?>
414+
<?if (_var($var,'shareUser') == 'e' && !$pool_devices):?>
415+
$('#mover-button').prop('disabled',true);
416+
$('#mover-text').html("<b>_(Empty)_</b> _(will immediately invoke the Mover to Empty a disk)_.&nbsp;<a href=\"/Main/Settings/Scheduler\"<?if($tabbed):?> onclick=\"$.cookie('one','tab2')\"<?endif;?>>(_(Schedule)_)</a>");
409417
<?endif;?>
410418
break;
411419
case '2': // mover running
@@ -414,6 +422,10 @@ mymonitor.on('message', function(state) {
414422
<?if (_var($var,'shareUser') == 'e' && $pool_devices):?>
415423
$('#mover-button').prop('disabled',true);
416424
$('#mover-text').html("_(Disabled)_ - _(Mover is running)_.");
425+
<?endif;?>
426+
<?if (_var($var,'shareUser') == 'e' && !$pool_devices):?>
427+
$('#mover-button').prop('disabled',true);
428+
$('#mover-text').html("<b>_(Empty)_</b> _(will immediately invoke the Mover to Empty a disk)_.&nbsp;<a href=\"/Main/Settings/Scheduler\"<?if($tabbed):?> onclick=\"$.cookie('one','tab2')\"<?endif;?>>(_(Schedule)_)</a>");
417429
<?endif;?>
418430
break;
419431
case '3': // btrfs running
@@ -422,6 +434,10 @@ mymonitor.on('message', function(state) {
422434
<?if (_var($var,'shareUser') == 'e' && $pool_devices):?>
423435
$('#mover-button').prop('disabled',true);
424436
$('#mover-text').html("_(Disabled)_ -- _(BTRFS operation is running)_");
437+
<?endif;?>
438+
<?if (_var($var,'shareUser') == 'e' && !$pool_devices):?>
439+
$('#mover-button').prop('disabled',true);
440+
$('#mover-text').html("<b>_(Empty)_</b> _(will immediately invoke the Mover to Empty a disk)_.&nbsp;<a href=\"/Main/Settings/Scheduler\"<?if($tabbed):?> onclick=\"$.cookie('one','tab2')\"<?endif;?>>(_(Schedule)_)</a>");
425441
<?endif;?>
426442
break;
427443
}
@@ -832,6 +848,13 @@ endswitch;
832848
</table>
833849
</form>
834850
<?endif;?>
851+
<?if (_var($var,'shareUser') == 'e' && !$pool_devices):?>
852+
<form name="mover_schedule" method="POST" action="/update.htm" target="progressFrame">
853+
<table markdown="1" class="ArrayOperation-Table array_status noshift">
854+
<tr><td></td><td><input type="submit" id="mover-button" name="cmdStartMover" value="_(Empty)_"></td><td id="mover-text"></td></tr>
855+
</table>
856+
</form>
857+
<?endif;?>
835858
<?elseif ($wrong && $keyfile):?>
836859
<form name="delete_keyfile" method="POST" action="/update.php" target="progressFrame">
837860
<input type="hidden" name="#file" value="unused">

emhttp/plugins/dynamix/MoverSettings.page

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ Tag="calendar-check-o"
1818
$mode = ['Disabled','Hourly','Daily','Weekly','Monthly'];
1919
$days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
2020
$setup = true;
21+
$buttontext = _('Move now');
2122
if (!$pool_devices) {
22-
echo "<p class='notice'>"._('No Cache device present')."!</p>";
23-
$setup = false;
23+
echo "<p class='notice'>"._('No Cache device present only empty function will run')."!</p>";
24+
$setup = true;
25+
$buttontext = _('Empty now');
2426
} elseif ($var['shareUser']=='-') {
2527
echo "<p class='notice'>"._('User shares not enabled')."!</p>";
2628
$setup = false;
27-
}
29+
}
2830
if (empty($var['shareMoverSchedule'])) {
2931
$cron = explode(' ', "* * * * *");
3032
$move = 0;
3133
} else {
3234
$cron = explode(' ', $var['shareMoverSchedule']);
3335
$move = $cron[2]!='*' ? 4 : ($cron[4]!='*' ? 3 : (substr($cron[1],0,1)!='*' ? 2 : 1));
3436
}
35-
$showMoverButton = $setup && $pool_devices;
37+
$showMoverButton = $setup;
3638
$moverRunning = file_exists('/var/run/mover.pid');
3739
?>
3840
<script>
@@ -138,7 +140,7 @@ _(Mover logging)_:
138140
<input type="submit" name="changeMover" value="_(Apply)_" disabled>
139141
<input type="button" value="_(Done)_" onclick="done()">
140142
<?if ($showMoverButton):?>
141-
<input type="submit" name="cmdStartMover" value="_(Move now)_"<?if ($moverRunning):?> disabled<?endif;?>>
143+
<input type="submit" name="cmdStartMover" value="<?=$buttontext?>"<?if ($moverRunning):?> disabled<?endif;?>>
142144
<?if ($moverRunning):?><span>_(Mover is running)_</span><?endif;?>
143145
<?endif;?>
144146
</span>

0 commit comments

Comments
 (0)