Files
webgui/emhttp/plugins/dynamix/ArrayDevices.page
bergware 82da91c96c New device spin up/down logic
Based on implementation for beta 23
2023-11-14 13:40:11 +01:00

89 lines
3.1 KiB
Plaintext

Menu="Main:1"
Title="Array Devices"
Tag="database"
---
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<script>
String.prototype.no_tilde = function(){return this.replace('<?=$_tilde_?>','<?=$_proxy_?>');}
String.prototype.master = function(){return this.split('<?=$_tilde_?>')[0];}
function toggle_state(device,name,action) {
var button = null;
if (name) {
var group = name.replace(/(\d+|\*)$/,'');
if (name.slice(-1)!='*') {
// single device
$('#dev-'+name.no_tilde()).removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
} else {
if (group=='disk') {
// array devices
$('[id^="dev-parity"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
$('[id^="dev-disk"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
} else {
// pool devices
$('[id^="dev-'+group.master()+'"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
}
}
} else if (device!='Clear') {
// all devices
$('[id^="dev-"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
button = '[id^=button-]';
}
devices.stop();
$.post('/webGui/include/ToggleState.php',{device:device,name:name,action:action},function(){setTimeout(function(){devices.start();},1000);if (button) $(button).prop('disabled',false);});
}
function display_diskio() {
if ($.cookie('diskio')===undefined) {
$('span.number').show(); $('span.diskio').hide();
} else {
$('span.diskio').show(); $('span.number').hide();
}
}
function toggle_diskio(init) {
if (!init) {
if ($.cookie('diskio')===undefined) $.cookie('diskio','diskio',{expires:3650}); else $.removeCookie('diskio');
}
if ($.cookie('diskio')===undefined) {
$('i.toggle').removeClass('fa-tachometer').addClass('fa-list');
} else {
$('i.toggle').removeClass('fa-list').addClass('fa-tachometer');
}
display_diskio();
}
<?if (_var($var,'fsState')=="Started"):?>
$('#tab1').bind({click:function() {$('i.toggle').show('slow');}});
<?endif;?>
</script>
<table class="disk_status wide">
<thead><tr><td>_(Device)_</td><td>_(Identification)_</td><td>_(Temp)_.</td><td>_(Reads)_</td><td>_(Writes)_</td><td>_(Errors)_</td><td>_(FS)_</td><td>_(Size)_</td><td>_(Used)_</td><td>_(Free)_</td></tr></thead>
<tbody id="array_devices">
<?
foreach ($disks as $disk):
if (_var($disk,'type')=='Parity' or _var($disk,'type')=='Data')
echo "<tr><td colspan='11'>&nbsp;</td></tr>";
endforeach;
if (_var($display,'total')) echo "<tr class='tr_last'><td colspan='11'>&nbsp;</td></tr>";
?>
</tbody>
</table>
:main_array_devices_help:
<?if (_var($var,'fsState')=="Stopped"):?>
<div></div>
:main_slots_help:
<?endif;?>