Files
webgui/plugins/dynamix/ArrayDevices.page
2020-05-21 12:44:55 +02:00

100 lines
3.6 KiB
Plaintext

Menu="Main:1"
Title="Array Devices"
Tag="database"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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>
function toggle_state(device,name,action) {
var event = null;
var button = null;
if (name) {
var array = ["parity","disk","array"];
var pools = [<?=implode(',',array_map('escapestring',$pools))?>];
var flash = ["flash"];
var group = name.replace(/(\d+|\*)$/,'');
if (array.includes(group)) event = 'array_status';
else if (pools.includes(group)) event = 'pool_status';
else if (flash.includes(group)) event = 'boot_status';
else event = 'open_status';
if (name.slice(-1)!='*') {
$('#dev-'+name).removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
} else {
if (group=='array') {
$('[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 {
$('[id^="dev-'+group+'"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
}
}
} else if (device!='Clear') {
$('[id^="dev-"]').removeClass('fa-circle fa-square fa-warning fa-times').addClass('fa-refresh fa-spin');
button = '[id^=button-]';
}
pauseEvents(event);
$.post('/webGui/include/ToggleState.php',{device:device,name:name,action:action,state:'<?=$var['mdState']?>',csrf:'<?=$var['csrf_token']?>'},function(){resumeEvents(event,500);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',{path:'/',expires:3650}); else $.removeCookie('diskio',{path:'/'});
}
if ($.cookie('diskio')===undefined) {
$('i.toggle').removeClass('fa-tachometer').addClass('fa-list');
} else {
$('i.toggle').removeClass('fa-list').addClass('fa-tachometer');
}
display_diskio();
}
function array_status() {
var diskio = $.cookie('diskio')===undefined ? 0 : 1;
$.post('/webGui/include/DeviceList.php',{path:'<?=$path?>',device:'array'},function(data) {
if (data) {$('#array_devices').html(data); display_diskio();}
<?if ($var['fsState']=='Started'):?>
timers.array_status = setTimeout(array_status,3000);
<?endif;?>
});
}
<?if ($var['fsState']=='Started'):?>
$('#tab1').bind({click:function() {$('i.toggle').show('slow');}});
<?endif;?>
array_status();
</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><td>_(View)_</td></tr></thead>
<tbody id="array_devices">
<?
foreach ($disks as $disk):
if ($disk['type']=='Parity' or $disk['type']=='Data')
echo "<tr><td colspan='11'>&nbsp;</td></tr>";
endforeach;
if ($display['total']) echo "<tr class='tr_last'><td colspan='11'>&nbsp;</td></tr>";
?>
</tbody>
</table>
:main_array_devices_help:
<?if ($var['fsState'] == "Stopped"):?>
<div></div>
:main_slots_help:
<?endif;?>