Menu="Main:1"
Title="Array Devices"
Tag="database"
---
<?PHP
/* Copyright 2005-2022, Lime Technology
 * Copyright 2012-2022, 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 button = null;
  if (name) {
    var group = name.replace(/(\d+|\*)$/,'');
    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-]';
  }
  devices.stop();
  $.post('/webGui/include/ToggleState.php',{device:device,name:name,action:action,state:'<?=$var['mdState']?>',csrf:'<?=$var['csrf_token']?>'},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['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><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;?>
