Dashboard: hide Cache devices if not present

This commit is contained in:
bergware
2019-01-19 11:47:03 +01:00
parent 5b1309505c
commit 42de67f84b
+7 -4
View File
@@ -45,6 +45,7 @@ $dockerd = pgrep('dockerd');
$libvirtd = pgrep('libvirtd');
$apcupsd = file_exists('/var/run/apcupsd.pid');
$started = $var['fsState']=='Started';
$cache_pool = $var['cacheSbNumDisks'];
$array_size = $array_used = 0;
$cache_size = $cache_used = 0;
$extra_size = $extra_used = 0;
@@ -255,7 +256,7 @@ foreach ($ports as $port) {
</td><td></td></tr>
</tbody>
<?endif;?>
<?if ($fans>0):?>
<?if ($fans):?>
<tbody>
<tr><td></td><td colspan='3' class='next'><i class='icon-fan'></i><div class='section'>Airflow<br><span>Fan count: <?=$fans?></span><br><br></div>
<i class='fa blue-text chevron' id='fan_view' onclick='toggleChevron("fan_view",0)'></i></td><td></td></tr>
@@ -429,7 +430,7 @@ foreach ($users as $user) {
<tr id='array_view_on' style='display:none'><td></td><td>Device</td><td>Status</td><td>Temp</td><td>SMART</td><td>Utilization</td><td></td></tr>
</thead>
<tbody class='array_view' id='array_list' style='display:none'></tbody>
<?if (isset($disks['cache'])):?>
<?if ($cache_pool):?>
<thead><tr><td></td><td colspan='5' class='next'>Cache<?if (!$started):?> (not started)<?endif;?><i class='fa blue-text chevron mt0' id='cache_view' onclick='toggleChevron("cache_view",0)'></i>
<?if ($started):?><span class='info'><?=my_scale($cache_used*1024,$unit)." $unit"?> used of <?=my_scale($cache_size*1024,$unit,-1,-1)." $unit"?> (<?=$cache_percent?> %)</span><?endif;?>
</td><td></td></tr>
@@ -560,7 +561,7 @@ function moreInfo(data,table) {
return info.length ? "<div style='padding-bottom:12px'><i class='icon-u-triangle failed'></i><span class='failed'>"+table+" has "+info.join('. ')+".</span></div>" : "";
}
function update5() {
<?if ($fans>0):?>
<?if ($fans):?>
$.post('<?=$url?>',{cmd:'fan'},function(data) {
$.each(data.split('\0'),function(k,v) {$('#fan'+k).html(v);});
});
@@ -774,7 +775,7 @@ $(function() {
toggleView('cpu_view',true);
toggleView('mem_view',true);
toggleView('port_view',true);
<?if ($fans>0):?>
<?if ($fans):?>
toggleView('fan_view',true);
<?endif;?>
<?if ($apcupsd):?>
@@ -788,7 +789,9 @@ $(function() {
<?endif;?>
toggleView('parity_view',true);
toggleView('array_view',true);
<?if ($cache_pool):?>
toggleView('cache_view',true);
<?endif;?>
<?if ($devs):?>
toggleView('extra_view',true);
<?endif;?>