Disable array STOP button when BTRFS operation is running

With automatic re-enabling
This commit is contained in:
bergware
2018-01-28 10:18:20 +01:00
parent cc6f8ebe20
commit 536a3723ef
2 changed files with 34 additions and 12 deletions

View File

@@ -235,7 +235,7 @@ $(function(){
case "Started":?>
<tr><td><?status_indicator()?><span class="strong big">Started<?=(($var['startMode']=='Maintenance')?' - Maintenance Mode':'')?></span></td>
<td><input type="button" value="Stop" onclick="stopArray(this.form)"<?if ($parity||$mover||$btrfs):?> disabled<?endif;?>></td>
<td><strong>Stop</strong> will take the array off-line.<?=$parity?:$mover?:$btrfs?:''?></td></tr>
<td id="stop"><strong>Stop</strong> will take the array off-line.<?=$parity?:$mover?:$btrfs?:''?></td></tr>
<? if ($var['fsNumUnmountable']>0):?>
<tr><td><strong>Unmountable disk<?=$var['fsNumUnmountable']==1?'':'s'?> present:</strong><br>
<? foreach ($disks as $disk) if (strpos($disk['fsStatus'],'Unmountable')!==false)
@@ -475,6 +475,24 @@ $(function(){
<?
if (isset($display['sleep'])) @include $display['sleep'];
?>
<?if ($btrfs):?>
<script>
function enable_stop() {
$.get('/webGui/include/ReloadPage.php',{btrfs:'btrfs'},function(data) {
switch (data) {
case 'disable':
setTimeout(enable_stop,5000);
break;
case 'enable':
var stop = $('td#stop');
stop.html(stop.html().replace("<?=$btrfs?>",""));
$('input[value="Stop"]').prop('disabled',false);
break;}
});
}
enable_stop();
</script>
<?endif;?>
> **Colored Status Indicator** the significance of the color indicator of the *Array* is as follows:
>

View File

@@ -11,16 +11,20 @@
*/
?>
<?
$var = parse_ini_file("state/var.ini");
switch ($var['fsState']) {
case 'Copying':
echo "<strong>Copying, {$var['fsCopyPrcnt']}% complete...</strong>";
break;
case 'Clearing':
echo "<strong>Clearing, {$var['fsClearPrcnt']}% complete...</strong>";
break;
default:
echo substr($var['fsState'],-3)=='ing' ? 'wait' : 'stop';
break;
if (empty($_GET['btrfs'])) {
$var = parse_ini_file("state/var.ini");
switch ($var['fsState']) {
case 'Copying':
echo "<strong>Copying, {$var['fsCopyPrcnt']}% complete...</strong>";
break;
case 'Clearing':
echo "<strong>Clearing, {$var['fsClearPrcnt']}% complete...</strong>";
break;
default:
echo substr($var['fsState'],-3)=='ing' ? 'wait' : 'stop';
break;
}
} else {
echo exec('pgrep -cf /sbin/btrfs')>0 ? 'disable' : 'enable';
}
?>