DeviceInfo: fix regression error in enabling/disabling zfs/btrfs options

This commit is contained in:
bergware
2023-02-07 19:57:09 +01:00
parent 72bb601334
commit 6dcdafaff4

View File

@@ -145,7 +145,8 @@ function selectDiskFsProfile(num_devices, width, init) {
$('#compression').hide(t);
$('#autotrim').hide(t);
} else if (($('#diskFsType').val()||'').indexOf('btrfs') != -1) {
$('#diskFsProfileBTRFS').prop('disabled',false).show();
if (!init) $('#diskFsProfileBTRFS').prop('disabled',false);
$('#diskFsProfileBTRFS').show();
$('#diskFsProfileZFS').prop('disabled',true).hide();
$('#diskFsWidthZFS').prop('disabled',true).hide();
$('#compression').show(t);
@@ -154,8 +155,12 @@ function selectDiskFsProfile(num_devices, width, init) {
<?endif;?>
} else if (($('#diskFsType').val()||'').indexOf('zfs') != -1) {
$('#diskFsProfileBTRFS').prop('disabled',true).hide();
$('#diskFsProfileZFS').prop('disabled',false).show();
$('#diskFsWidthZFS').prop('disabled',false).show();
if (!init) {
$('#diskFsProfileZFS').prop('disabled',false);
$('#diskFsWidthZFS').prop('disabled',false);
}
$('#diskFsProfileZFS').show();
$('#diskFsWidthZFS').show();
selectDiskFsWidth(num_devices, width);
$('#compression').show(t);
<?if (isset($disk['type']) && $disk['type']=="Cache"):?>
@@ -515,7 +520,7 @@ _(Spin down delay)_:
_(File system status)_:
: <?=_($disk['fsStatus'])?>&nbsp;
<?$disabled = (($var['fsState']=="Stopped" && $var['mdState']=="SWAP_DSBL") || $disk['fsStatus']=='Mounted') || !empty($disk['uuid']) ? "disabled" : ""?>
<?$disabled = (($var['fsState']=="Stopped" && $var['mdState']=="SWAP_DSBL") || $var['fsState']=="Started" || $disk['fsStatus']=='Mounted') || !empty($disk['uuid']) ? "disabled" : ""?>
<?if ((isset($disk['type']) && $disk['type']=="Data") || (isset($disk['slots']) && $disk['slots']==1)):?>
_(File system type)_:
: <select id="diskFsType" name="diskFsType.<?=$disk['idx']?>" onchange="changeFsType()" <?=$disabled?>>
@@ -541,7 +546,7 @@ _(File system type)_:
<?=mk_option($disk['fsType'], "luks:zfs", _('zfs')." - "._('encrypted'))?>
<?=mk_option($disk['fsType'], "luks:btrfs", _('btrfs')." - "._('encrypted'))?>
</select>
<select id="diskFsProfileBTRFS" name="diskFsProfile.<?=$disk['idx']?>" style="display:none" disabled>
<select id="diskFsProfileBTRFS" name="diskFsProfile.<?=$disk['idx']?>" style="display:none" <?=$disabled?>>
<?=mk_option($disk['fsProfile'],"single", _('single'))?>
<?=mk_option($disk['fsProfile'],"raid0", _('raid0'))?>
<?if ($disk['devices']>=2) echo mk_option($disk['fsProfile'],"raid1", _('raid1'))?>
@@ -551,7 +556,7 @@ _(File system type)_:
<?if ($disk['devices']>=3) echo mk_option($disk['fsProfile'],"raid5", _('raid5'))?>
<?if ($disk['devices']>=4) echo mk_option($disk['fsProfile'],"raid6", _('raid6'))?>
</select>
<select id="diskFsProfileZFS" name="diskFsProfile.<?=$disk['idx']?>" style="display:none" onchange="selectDiskFsWidth(<?=$disk['devices']??0?>,0)" disabled>
<select id="diskFsProfileZFS" name="diskFsProfile.<?=$disk['idx']?>" style="display:none" onchange="selectDiskFsWidth(<?=$disk['devices']??0?>,0)" <?=$disabled?>>
<?if ($disk['devices']==1) echo mk_option($disk['fsProfile'],"", _('single'))?>
<?if ($disk['devices']>=2) echo mk_option($disk['fsProfile'],"", _('raid0'))?>
<?if (($disk['devices']%2)==0 || ($disk['devices']%3)==0 || ($disk['devices']%4)==0) echo mk_option($disk['fsProfile'],"mirror", _('mirror'))?>
@@ -559,7 +564,7 @@ _(File system type)_:
<?if ($disk['devices']>=4) echo mk_option($disk['fsProfile'],"raidz2", _('raidz2'))?>
<?if ($disk['devices']>=5) echo mk_option($disk['fsProfile'],"raidz3", _('raidz3'))?>
</select>
<select id="diskFsWidthZFS" name="diskFsWidth.<?=$disk['idx']?>" style="display:none" disabled>
<select id="diskFsWidthZFS" name="diskFsWidth.<?=$disk['idx']?>" style="display:none" <?=$disabled?>>
</select>
<?endif;?>