diff --git a/plugins/dynamix/ArrayDevices.page b/plugins/dynamix/ArrayDevices.page index 6f554c1c7..57a6f500a 100644 --- a/plugins/dynamix/ArrayDevices.page +++ b/plugins/dynamix/ArrayDevices.page @@ -29,7 +29,11 @@ function toggle_state(device,name,action) { var button = '[id^=button-]'; } pauseEvents(event); - $.post('/webGui/include/ToggleState.php',{device:device,name:name,action:action,csrf:''},function(){resumeEvents(event);if (button) $(button).prop('disabled',false);}); + $.post('/webGui/include/ToggleState.php',{device:device,name:name,action:action,state:'',csrf:''},function(){resumeEvents(event);if (button) $(button).prop('disabled',false);}); +} +function clear_stats() { + pauseEvents(); + $.post('/webGui/include/ToggleState.php',{device:'Clear',name:'',action:'',state:'',csrf:''},function(){resumeEvents();}); } function display_diskio() { if ($.cookie('diskio')===undefined) { diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index 35ca925e3..6d25a58e7 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -432,15 +432,12 @@ $(function(){ -
- - +
>> Spin Down will immediately spin down all disks.
Spin Up will immediately spin up all disks.
Clear Statistics will immediately clear all disk statistics.
Clear Statistics will immediately clear all disk statistics.
-
diff --git a/plugins/dynamix/include/ToggleState.php b/plugins/dynamix/include/ToggleState.php index f75be9208..55b51310f 100644 --- a/plugins/dynamix/include/ToggleState.php +++ b/plugins/dynamix/include/ToggleState.php @@ -14,20 +14,27 @@ $device = $_POST['device']; $name = $_POST['name']; $action = $_POST['action']; +$state = $_POST['state']; $csrf = $_POST['csrf']; function emhttpd($cmd) { - global $csrf; - $ch = curl_init("http://127.0.0.1/update.htm?$cmd&csrf_token=$csrf"); + global $state, $csrf; + $ch = curl_init("http://127.0.0.1/update.htm?$cmd&startState=$state&csrf_token=$csrf"); curl_setopt_array($ch, [CURLOPT_UNIX_SOCKET_PATH => '/var/run/emhttpd.socket', CURLOPT_RETURNTRANSFER => true]); curl_exec($ch); curl_close($ch); } -if ($device=='New') { +switch ($device) { +case 'New': $cmd = $action=='up' ? 'S0' : ($action=='down' ? 'y' : false); if ($cmd && $name) exec("/usr/sbin/hdparm -$cmd /dev/$name >/dev/null 2>&1"); -} else { + break; +case 'Clear': + emhttpd("clearStatistics=true"); + break; +default: if ($name) emhttpd("cmdSpin$action=$name"); else emhttpd("cmdSpin{$device}All=true"); + break; } ?>