Main page: consolidate spin up/down action and device status into one

This commit is contained in:
bergware
2019-10-04 11:30:34 +02:00
parent 347c9962b8
commit 40f97f3ac2
2 changed files with 10 additions and 9 deletions

View File

@@ -3,8 +3,8 @@ Title="Array Devices"
Tag="database"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -23,9 +23,9 @@ function toggle_state(device,name,action) {
else if (name.match(/^cache/)!==null) event = 'cache_status';
else if (name.match(/^flash/)!==null) event = 'boot_status';
else event = 'open_status';
$('#dev-'+name).removeClass('fa-sort-up fa-sort-down').addClass('fa-refresh fa-spin');
$('#dev-'+name).removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
} else if (device!='Clear') {
$('[id^="dev-"]').removeClass('fa-sort-up fa-sort-down').addClass('fa-refresh fa-spin');
$('[id^="dev-"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
button = '[id^=button-]';
}
pauseEvents(event);

View File

@@ -47,10 +47,6 @@ function device_info(&$disk,$online) {
$fancyname = $disk['type']=='New' ? $name : my_disk($name);
$type = $disk['type']=='Flash' || $disk['type']=='New' ? $disk['type'] : 'Device';
$action = strpos($disk['color'],'blink')===false ? 'down' : 'up';
if ($var['fsState']=='Started' && $type!='Flash' && strpos($disk['status'],'_NP')===false) {
$ctrl = "<i id='dev-$name' class='fa fa-sort-$action fa-fw' style='cursor:pointer' title='Click to spin $action device' onclick=\"toggle_state('$type','$name','$action')\"></i>";
} else
$ctrl = "<i class='fa fa-sort-down fa-fw' style='visibility:hidden'></i>";
switch ($disk['color']) {
case 'green-on': $orb = 'circle'; $color = 'green'; $help = 'Normal operation, device is active'; break;
case 'green-blink': $orb = 'circle'; $color = 'grey'; $help = 'Device is in standby mode (spun-down)'; break;
@@ -62,7 +58,12 @@ function device_info(&$disk,$online) {
case 'red-off': $orb = 'times'; $color = 'red'; $help = $disk['type']=='Parity' ? 'Parity device is missing' : 'Device is missing (disabled), contents emulated'; break;
case 'grey-off': $orb = 'square'; $color = 'grey'; $help = 'Device not present'; break;
}
$status = "$ctrl<a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span>$help</span></a>";
$ctrl = '';
if ($var['fsState']=='Started' && $type!='Flash' && strpos($disk['status'],'_NP')===false) {
$ctrl = " style='cursor:pointer' onclick=\"toggle_state('$type','$name','$action')\"";
$help .= "<br>Click to spin $action device";
}
$status = "<a class='info nohand' onclick='return false'><i ".($type!='Flash'?"id='dev-$name' ":"")."class='fa fa-$orb orb $color-orb'$ctrl></i><span>$help</span></a>";
$link = ($disk['type']=='Parity' && strpos($disk['status'],'_NP')===false) ||
($disk['type']=='Data' && $disk['status']!='DISK_NP') ||
($disk['type']=='Cache' && $disk['status']!='DISK_NP') ||