Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bergware
2024-07-25 18:39:11 +02:00
7 changed files with 28 additions and 18 deletions
+1 -1
View File
@@ -460,7 +460,7 @@ window.onunload = function(){
<? if (_var($var,'fsNumUnmountable',0)>0):?>
<tr><td>**<?=_('Unmountable disk'.(_var($var,'fsNumUnmountable',0)==1?'':'s').' present')?>:**<br>
<? $cache = [];
foreach ($disks as $disk) if (substr(_var($disk,'fsStatus'),0,11)=='Unmountable' || in_array(prefix(_var($disk,'name')),$cache)) {
foreach ($disks as $disk) if (substr(_var($disk,'fsStatus'),0,11)=='Unmountable' || in_array(pool_name(_var($disk,'name')),$cache)) {
if (strlen(_var($disk,'id'))) echo "<span class='blue-text'>".my_disk(_var($disk,'name'))."</span> &bullet; ".my_id(_var($disk,'id'))." ("._var($disk,'device').")<br>";
if (in_array(_var($disk,'name'),$pools)) $cache[] = $disk['name'];
}
+14 -8
View File
@@ -207,6 +207,12 @@ function selectDiskFsWidth() {
value: 0,
text: "<?=_('no devices')?>"
}));
} else if (($('#diskFsType').val()||'').indexOf('zfs') == -1) {
var label = (num_slots == 1) ? "device" : "devices";
$('#diskFsWidthZFS').append($('<option>', {
value: num_slots,
text: _(sprintf('%s '+label,num_slots))
}));
} else if ($('#diskFsProfileZFS').val() == '') {
var label = (num_slots == 1) ? "device" : "devices";
$('#diskFsWidthZFS').append($('<option>', {
@@ -250,14 +256,14 @@ function selectDiskFsProfile(init) {
if (($('#diskFsType').val()||'').indexOf('auto') != -1) {
$('#diskFsProfileBTRFS').prop('disabled',true).hide();
$('#diskFsProfileZFS').prop('disabled',true).hide();
$('#diskFsWidthZFS').prop('disabled',true).hide();;
$('#diskFsWidthZFS').hide();;
$('#compression').hide(t);
$('#autotrim').hide(t);
} else if (($('#diskFsType').val()||'').indexOf('btrfs') != -1) {
if (!init) $('#diskFsProfileBTRFS').prop('disabled',false);
$('#diskFsProfileBTRFS').show();
$('#diskFsProfileZFS').prop('disabled',true).hide();
$('#diskFsWidthZFS').prop('disabled',true).hide();
$('#diskFsWidthZFS').hide();;
$('#compression').show(t);
<?if (diskType('Cache')):?>
$('#autotrim').show(t);
@@ -274,7 +280,6 @@ function selectDiskFsProfile(init) {
}
if (!init) {
$('#diskFsProfileZFS').prop('disabled',false);
$('#diskFsWidthZFS').prop('disabled',false);
}
$('#diskFsProfileZFS').show();
$('#diskFsWidthZFS').show();
@@ -283,7 +288,6 @@ function selectDiskFsProfile(init) {
if (num_slots == 2) $('#diskFsProfileZFS').val('mirror');
if (num_slots > 2) $('#diskFsProfileZFS').val('raidz1');
}
selectDiskFsWidth();
$('#compression').show(t);
<?if (diskType('Cache')):?>
$('#autotrim').show(t);
@@ -291,6 +295,8 @@ function selectDiskFsProfile(init) {
$('#autotrim').show(t);
<?endif;?>
}
selectDiskFsWidth();
$('#diskFsGroups').val(0);
}
function changeFsType() {
var fstype = ($('#diskFsType').val()||'').replace('luks:','');
@@ -626,7 +632,7 @@ _(Spin down delay)_:
<?endif;?>
<?if (diskType('Data') || isPool($tag)):?>
<?$fsTypeImmutable = (_var($var,'fsState')=="Stopped" && !empty(_var($disk,'uuid'))) || (_var($var,'fsState')=="Started" && _var($disk,'fsType')!='auto')?>
<?$fsTypeImmutable = _var($var,'fsState')=="Started" || (isPool($tag) && _var($disk,'state')!="NEW_ARRAY")?>
<?if (diskType('Data') || (!isSubpool($name) && _var($disk,'slots',0)==1)):?>
_(File system status)_:
: <?=_(_var($disk,'fsStatus'))?>&nbsp;
@@ -679,6 +685,7 @@ _(Allocation profile)_:
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raidz3", _('raidz3'))?>
</select>
<select id="diskFsWidthZFS" name="diskFsWidth.<?=_var($disk,'idx',0)?>" style="display:none" <?=disabled_if($fsTypeImmutable)?>>
<input id="diskFsGroups" name="diskFsGroups.<?=_var($disk,'idx',0)?>" style="display:none" <?=disabled_if($fsTypeImmutable)?>>
</select>
<?elseif (isSubpool($name)=="special" || isSubpool($name)=="logs" || isSubpool($name)=="dedup"):?>
_(Allocation profile)_:
@@ -764,11 +771,10 @@ _(Critical disk utilization threshold)_ (%):
<?endif;?>
<?if (isPool($name) && strpos($name,$_tilde_)===false):?>
<?if (_var($var,'fsState')=="Stopped" || (_var($var,'fsState')=="Started" && _var($var,'startMode')!="Normal")): $erasable=true; endif;?>
<input type="button" id="eraseButton" value="_(Erase)_" onclick="eraseDisk('<?=$name?>')"<?=$erasable?'':' disabled'?>>
<input type="button" id="eraseButton" value="_(Erase Pool)_" onclick="eraseDisk('<?=$name?>')"<?=$erasable?'':' disabled'?>>
<?endif;?>
<?if (_var($var,'fsState')=="Stopped" && isPool($name)):?>
<?$empty = _var($disk,'devices',0)==0?>
<input type="button" value="_(Delete Pool)_" onclick="deletePool()"<?=$empty?'':' disabled'?>><?if (!$empty):?>_(Unassign **ALL** devices to delete this pool)_<?endif;?>
<input type="button" value="_(Delete Pool)_" onclick="deletePool()"<?=isSubpool($name)?' disabled':''?>>
<?endif;?>
</form>
@@ -128,6 +128,9 @@ function no_tilde($name) {
function prefix($key) {
return preg_replace('/\d+$/','',$key);
}
function pool_name($key) {
return preg_replace('/(\d+$|~.*$)/', '', $key);
}
function native($name, $full=0) {
global $_tilde_, $_arrow_;
switch ($full) {
+9 -6
View File
@@ -151,8 +151,8 @@ function vfs_type(&$disk) {
function fs_info(&$disk) {
global $display;
$echo = [];
if (empty(_var($disk, 'fsStatus')) || _var($disk, 'fsStatus') == '-')
return "<td>"._var($disk, 'fsStatus')."</td><td colspan='3'></td>";
if (empty(_var($disk,'fsStatus','')))
return "<td colspan='4'></td>";
if (_var($disk,'fsStatus')=='Mounted') {
$echo[] = "<td>".vfs_type($disk)."</td>";
$echo[] = "<td>".my_scale(_var($disk,'fsSize',0)*1024,$unit,-1)." $unit</td>";
@@ -361,8 +361,9 @@ function array_slots() {
return implode($echo);
}
function cache_slots($off,$pool,$min,$slots) {
global $var;
global $var, $disks;
$off = $off && $min ? ' disabled' : '';
$off = '';
$max = _var($var,'MAX_CACHESZ');
$echo = [];
$echo[] = "<form method='POST' action='/update.htm' target='progressFrame'>";
@@ -370,10 +371,13 @@ function cache_slots($off,$pool,$min,$slots) {
$echo[] = "<input type='hidden' name='changeSlots' value='apply'>";
$echo[] = "<input type='hidden' name='poolName' value='$pool'>";
$echo[] = "<select class='narrow' name='poolSlots' onChange='devices.start();this.form.submit()'{$off}>";
if (_var($disks[$pool],'state')=='NEW_ARRAY' || str_contains(_var($diks[$pool],'state'),'NO_DEVICES')) {
$option = _('none');
$echo[] = "<option value='0'>$option</option>";
}
for ($n=$min; $n<=$max; $n++) {
$option = $n ?: _('none');
$selected = ($n==$slots) ? ' selected' : '';
$echo[] = "<option value='$n'{$selected}>$option</option>";
$echo[] = "<option value='$n'{$selected}>$n</option>";
}
$echo[] = "</select></form>";
return implode($echo);
@@ -509,7 +513,6 @@ while (true) {
} else {
foreach ($Cache as $disk) if (prefix($disk['name'])==$pool) {
$fstype = str_replace('luks:','',_var($disk,'fsType'));
if (substr(_var($Cache[$pool],'fsStatus'),0,11)=='Unmountable' && empty($disk['fsStatus'])) $disk['fsStatus'] = _var($Cache[$pool],'fsStatus');
$echo[$a][] = array_online($disk,$fstype);
}
if (strcmp($root,$pool)!=0) $Cache[$root]['devices'] += $Cache[$pool]['devices'];