Merge pull request #1539 from bergware/master

Updates
This commit is contained in:
tom mortensen
2023-12-08 12:33:27 -08:00
committed by GitHub
11 changed files with 30 additions and 20 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ Tag="database"
*/
?>
<?
$power = in_array('nvme',array_column(main_filter($disks),'transport')) ? ' / '._('Power') : '';
$power = _var($display,'power') && in_array('nvme',array_column(main_filter($disks),'transport')) ? ' / '._('Power') : '';
?>
<script>
String.prototype.no_tilde = function(){return this.replace('<?=$_tilde_?>','<?=$_proxy_?>');}
+3 -1
View File
@@ -138,10 +138,12 @@ $('#tab2').bind({click:function() {$('i.toggle').show('slow');}});
<table class="disk_status wide<?=$i?' divider':''?>">
<?if (!isSubpool($pool)):
$cache = array_filter(cache_filter($disks),function($disk) use ($pool){return prefix($disk['name'])==$pool;});
$power = in_array('nvme',array_column($cache,'transport')) ? ' / '._('Power') : '';
$power = _var($display,'power') && in_array('nvme',array_column($cache,'transport')) ? ' / '._('Power') : '';
?>
<?if ($i==0):?>
<thead><tr><td>_(Device)_</td><td>_(Identification)_</td><td>_(Temp)_<?=$power?></td><td>_(Reads)_</td><td>_(Writes)_</td><td>_(Errors)_</td><td>_(FS)_</td><td>_(Size)_</td><td>_(Used)_</td><td>_(Free)_</td></tr></thead>
<?endif;?>
<?endif;?>
<tbody id="pool_device<?=$i++?>">
<?foreach (cache_filter($disks) as $disk) if (prefix($disk['name'])==$pool) echo "<tr><td colspan='11'>&nbsp;</td></tr>"?>
</tbody>
+6 -6
View File
@@ -2,8 +2,7 @@ Menu="Dashboard"
Nchan="wg_poller,update_1,update_2,update_3,ups_status:stop"
---
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* 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,
@@ -70,6 +69,7 @@ $cache_type = $cache_rate = [];
$parity = _var($var,'mdResync');
$mover = file_exists('/var/run/mover.pid');
$btrfs = exec('pgrep -cf /sbin/btrfs');
$vdisk = exec("grep -Pom1 '^DOCKER_IMAGE_TYPE=\"\\K[^\"]+' /boot/config/docker.cfg 2>/dev/null")!='folder' ? _('Docker vdisk') : _('Docker folder');
$dot = _var($display,'number','.,')[0];
$zfs = count(array_filter(array_column($disks,'fsType'),function($fs){return str_replace('luks:','',$fs??'')=='zfs';}));
@@ -284,7 +284,7 @@ foreach ($cpus as $pair) {
<span class='w18 center'><span class='center'><a class='info hand none'>_(RAM usage)_<span>_(Percent of total used memory)_ (<?=$ramsize?>)</span></a></span><div class='pie' id='sys0'><span class='sys0'></span><span class='var0'></span></div></span>
<span class='w18 center'><span class='center'><a class='info hand none'>_(Flash device)_<span>_(Percent usage of flash usb device)_ (<?=$flashsize?>)</span></a></span><div class='pie' id='sys1'><span class='sys1'></span><span class='var1'></span></div></span>
<span class='w18 center'><span class='center'><a class='info hand none'>_(Log filesystem)_<span>_(Percent usage of LOG file system)_ (<?=$logsize?>)</span></a></span><div class='pie' id='sys2'><span class='sys2'></span><span class='var2'></span></div></span>
<span class='w18 center'><span class='center'><a class='info hand none'>_(Docker vDisk)_<span>_(Percent usage of Docker image)_ (<?=$dockersize?>)</span></a></span><div class='pie' id='sys3'><span class='sys3'></span><span class='var3'></span></div></span>
<span class='w18 center'><span class='center'><a class='info hand none'><?=$vdisk?><span>_(Percent usage of Docker image)_ (<?=$dockersize?>)</span></a></span><div class='pie' id='sys3'><span class='sys3'></span><span class='var3'></span></div></span>
</td></tr>
</tbody>
@@ -573,7 +573,7 @@ if (!$group) {
<tr><td id='program' class="wrap"></td></tr>
</tbody>
<?$power = in_array('nvme',array_column(main_filter($disks),'transport')) ? ' / '._('Power') : '';?>
<?$power = _var($display,'power') && in_array('nvme',array_column(main_filter($disks),'transport')) ? ' / '._('Power') : '';?>
<tbody id='array_list' title="_(Array Information)_">
<tr><td><i class='icon-disks f32'></i><div class='section'>_(Array)_<?if (!$started):?> (_(stopped)_)<?endif;?><br>
<span><?if ($started):?><?=sprintf(_("%s used of %s (%s %%)"),my_scale($array_used*1024,$unit)." $unit",my_scale($array_size*1024,$unit,-1,-1)." $unit",$array_percent)?><?endif;?></span><br></div>
@@ -586,7 +586,7 @@ if (!$group) {
<?$i=0?>
<?foreach ($pools as $pool):
$cache = array_filter(cache_filter($disks),function($disk) use ($pool){return prefix($disk['name'])==$pool;});
$power = in_array('nvme',array_column($cache,'transport')) ? ' / '._('Power') : '';
$power = _var($display,'power') && in_array('nvme',array_column($cache,'transport')) ? ' / '._('Power') : '';
?>
<tbody id='pool_list<?=$i?>' title="_(<?=ucfirst($pool)?> Information)_">
<tr><td><i class='icon-disk f32'></i><div class='section'><?=_(native($pool),3).($started ? '' : ' ('._('stopped').')')?><br>
@@ -599,7 +599,7 @@ if (!$group) {
<?endforeach;?>
<?if ($devs):?>
<?$power = in_array('nvme',array_column($devs,'transport')) ? ' / '._('Power') : '';?>
<?$power = _var($display,'power') && in_array('nvme',array_column($devs,'transport')) ? ' / '._('Power') : '';?>
<tbody id='devs_list' title="_(Unassigned Devices)_">
<tr><td><i class='icon-disc f32'></i><div class='section'>_(Unassigned)_<?if (!$started):?> (_(stopped)_)<?endif;?><br>
<span></span><br></div>
+7
View File
@@ -41,6 +41,7 @@ function doDispatch(form) {
fields['#cfg'] = "/boot/config/plugins/dynamix/dynamix.cfg";
fields['#cleanup'] = true;
$(form).find('input[name^="display_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$(form).find('select[name^="display_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$.post('/webGui/include/Dispatcher.php',fields);
}
function prepareDiskSettings(form) {
@@ -224,6 +225,12 @@ _(Tunable (md_write_method))_:
:disk_tunable_md_write_method_help:
_(Enable NVME power monitoring)_:
: <select name="display_power">
<?=mk_option($display['power'], "", _('No'))?>
<?=mk_option($display['power'], "1", _('Yes'))?>
</select>
_(Default warning disk utilization threshold)_ (%):
: <input type="number" min="0" max="100" name="display_warning" class="narrow" value="<?=$display['warning']?>" placeholder="<?=$default['display']['warning']?>">
+1 -1
View File
@@ -16,7 +16,7 @@ Cond="(count($devs)>0)"
*/
?>
<?
$power = in_array('nvme',array_column($devs,'transport')) ? ' / '._('Power') : '';
$power = _var($display,'power') && in_array('nvme',array_column($devs,'transport')) ? ' / '._('Power') : '';
$tabX = '#tab'.($var['fsState']=='Stopped'||$pool_devices ? '4' : '3');
?>
<script>
+3 -3
View File
@@ -41,7 +41,7 @@ function get_model($id) {
function my_power($power) {
global $display;
$number = _var($display,'number','.,');
return $power ? ' / '.number_format($power,$power<10?2:1,$number[0]).' '._('W') : '';
return _var($display,'power') && $power ? ' / '.number_format($power,$power<10?2:1,$number[0]).' '._('W') : '';
}
function device_info(&$disk,$online) {
global $pools, $var, $crypto;
@@ -179,8 +179,8 @@ function my_diskio($data) {
return my_scale($data,$unit,1)." $unit/s";
}
function array_offline(&$disk, $pool='') {
global $var, $disks;
$disk['power'] ??= (_var($disk,'transport')=='nvme' ? get_nvme_info(_var($disk,'device'),'power') : 0);
global $var, $disks, $display;
$disk['power'] ??= (_var($display,'power') && _var($disk,'transport')=='nvme' ? get_nvme_info(_var($disk,'device'),'power') : 0);
$echo = []; $warning = '';
$status = ['DISK_DSBL','DISK_INVALID','DISK_DSBL_NEW','DISK_NEW','DISK_WRONG'];
$text = "<span class='red-text'><em>"._('All existing data on this device will be OVERWRITTEN when array is Started')."</em></span>";
+1
View File
@@ -32,6 +32,7 @@ $locale_init = $locale;
function my_power($device) {
global $display;
if (!_var($display,'power')) return '';
$number = _var($display,'number','.,');
[$power,$state] = explode('W ',get_nvme_info($device,'state'));
$state = strtr($state, ['non-operational' => 'green', 'operational' => 'orange']);
@@ -122,8 +122,8 @@ table.disk_status tr td:nth-child(1){min-width:100px;max-width:100px;overflow:hi
table.disk_status tr td:nth-child(2){min-width:400px;max-width:400px;overflow:hidden;text-overflow:ellipsis}
table.disk_status tr td:nth-child(3){text-align:center}
table.disk_status tr td:nth-child(n+1):hover{overflow:visible}
table.disk_status tr>td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr>td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tr td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tbody tr{border-bottom:1px solid #f3f0f4}
table.disk_status tbody tr:not(.tr_last):hover td{background-color:rgba(0,0,0,0.05)}
table.array_status tr td:nth-child(1){width:30%;padding-left:8px}
@@ -119,8 +119,8 @@ table.disk_status tr td:nth-child(1){min-width:100px;max-width:100px;overflow:hi
table.disk_status tr td:nth-child(2){min-width:400px;max-width:400px;overflow:hidden;text-overflow:ellipsis}
table.disk_status tr td:nth-child(3){text-align:center}
table.disk_status tr td:nth-child(n+1):hover{overflow:visible}
table.disk_status tr>td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr>td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tr td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tbody tr:nth-child(even){background-color:#212121}
table.disk_status tbody tr:not(.tr_last):hover td{background-color:rgba(255,255,255,0.1)}
table.array_status tr td:nth-child(1){width:30%;padding-left:8px}
@@ -122,8 +122,8 @@ table.disk_status tr td:nth-child(1){min-width:100px;max-width:100px;overflow:hi
table.disk_status tr td:nth-child(2){min-width:400px;max-width:400px;overflow:hidden;text-overflow:ellipsis}
table.disk_status tr td:nth-child(3){text-align:center}
table.disk_status tr td:nth-child(n+1):hover{overflow:visible}
table.disk_status tr>td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr>td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tr td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tbody tr{border-bottom:1px solid #0c0f0b}
table.disk_status tbody tr:not(.tr_last):hover td{background-color:rgba(255,255,255,0.05)}
table.array_status tr td:nth-child(1){width:30%;padding-left:8px}
@@ -119,8 +119,8 @@ table.disk_status tr td:nth-child(1){min-width:100px;max-width:100px;overflow:hi
table.disk_status tr td:nth-child(2){min-width:400px;max-width:400px;overflow:hidden;text-overflow:ellipsis}
table.disk_status tr td:nth-child(3){text-align:center}
table.disk_status tr td:nth-child(n+1):hover{overflow:visible}
table.disk_status tr>td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr>td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tr td:nth-child(n+3){min-width:6.5%;max-width:6.5%;width:6.5%}
table.disk_status tr td:nth-child(n+4){text-align:right;padding-right:8px}
table.disk_status tbody tr:nth-child(even){background-color:#ededed}
table.disk_status tbody tr:not(.tr_last):hover td{background-color:rgba(0,0,0,0.1)}
table.array_status tr td:nth-child(1){width:30%;padding-left:8px}