mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 16:29:45 -05:00
corrections displaying zfs profiles
This commit is contained in:
@@ -190,24 +190,26 @@ function prepareZFS(form) {
|
||||
}
|
||||
<?endif;?>
|
||||
|
||||
function selectDiskFsWidth(num_devices,selected_width) {
|
||||
function selectDiskFsWidth() {
|
||||
var num_slots = <?=_var($disk,'slots',0)?>;
|
||||
var selected_width = <?=_var($disk,'fsWidth',0)?>;
|
||||
$('#diskFsWidthZFS').empty();
|
||||
if (num_devices == 0) {
|
||||
if (num_slots == 0) {
|
||||
$('#diskFsWidthZFS').prop('disabled',true).append($('<option>', {
|
||||
value: 0,
|
||||
text: "<?=_('no devices')?>"
|
||||
}));
|
||||
} else if ($('#diskFsProfileZFS').val() == '') {
|
||||
var label = (num_devices == 1) ? "device" : "devices";
|
||||
var label = (num_slots == 1) ? "device" : "devices";
|
||||
$('#diskFsWidthZFS').append($('<option>', {
|
||||
value: 1,
|
||||
text: _(sprintf('%s '+label,num_devices))
|
||||
text: _(sprintf('%s '+label,num_slots))
|
||||
}));
|
||||
} else if ($('#diskFsProfileZFS').val() == 'mirror') {
|
||||
var width;
|
||||
for (width=2; width<=Math.min(num_devices,4); width++) {
|
||||
if ((num_devices % width) == 0) {
|
||||
var groups = num_devices / width;
|
||||
for (width=2; width<=Math.min(num_slots,4); width++) {
|
||||
if ((num_slots % width) == 0) {
|
||||
var groups = num_slots / width;
|
||||
var label = (groups == 1) ? "group" : "groups";
|
||||
$('#diskFsWidthZFS').append($('<option>', {
|
||||
value: width,
|
||||
@@ -221,9 +223,9 @@ function selectDiskFsWidth(num_devices,selected_width) {
|
||||
if ($('#diskFsProfileZFS').val() == 'raidz1') min_width = 3;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz2') min_width = 3;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz3') min_width = 4;
|
||||
for (width=min_width; width<=num_devices; width++) {
|
||||
if ((num_devices % width) == 0) {
|
||||
var groups = num_devices / width;
|
||||
for (width=min_width; width<=num_slots; width++) {
|
||||
if ((num_slots % width) == 0) {
|
||||
var groups = num_slots / width;
|
||||
var label = (groups == 1) ? "group" : "groups";
|
||||
$('#diskFsWidthZFS').append($('<option>', {
|
||||
value: width,
|
||||
@@ -234,7 +236,7 @@ function selectDiskFsWidth(num_devices,selected_width) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function selectDiskFsProfile(num_slots, width, init) {
|
||||
function selectDiskFsProfile(init) {
|
||||
var t = init ? null : 'slow';
|
||||
if (($('#diskFsType').val()||'').indexOf('auto') != -1) {
|
||||
$('#diskFsProfileBTRFS').prop('disabled',true).hide();
|
||||
@@ -259,7 +261,7 @@ function selectDiskFsProfile(num_slots, width, init) {
|
||||
}
|
||||
$('#diskFsProfileZFS').show();
|
||||
$('#diskFsWidthZFS').show();
|
||||
selectDiskFsWidth(num_slots, width);
|
||||
selectDiskFsWidth();
|
||||
$('#compression').show(t);
|
||||
<?if (diskType('Cache')):?>
|
||||
$('#autotrim').show(t);
|
||||
@@ -615,7 +617,7 @@ _(File system type)_:
|
||||
|
||||
<?elseif (!isSubpool($name) && _var($disk,'slots',0)>1):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(false)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "auto", _('auto'))?>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
<?=mk_option(_var($disk,'fsType'), "btrfs", _('btrfs'))?>
|
||||
@@ -632,7 +634,7 @@ _(File system type)_:
|
||||
<?if (_var($disk,'slots',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raid5", _('raid5'))?>
|
||||
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid6", _('raid6'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" style="display:none" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" style="display:none" onchange="selectDiskFsWidth()" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
<?if ((_var($disk,'slots',0)%2)==0 || (_var($disk,'slots',0)%3)==0 || (_var($disk,'slots',0)%4)==0) echo mk_option(_var($disk,'fsProfile'),"mirror", _('mirror'))?>
|
||||
@@ -644,10 +646,10 @@ _(File system type)_:
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="special" || isSubpool($name)=="logs" || isSubpool($name)=="dedup"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(false)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth()" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
<?if ((_var($disk,'slots',0)%2)==0 || (_var($disk,'slots',0)%3)==0 || (_var($disk,'slots',0)%4)==0) echo mk_option(_var($disk,'fsProfile'),"mirror", _('mirror'))?>
|
||||
@@ -656,10 +658,10 @@ _(File system type)_:
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="cache"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(false)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth()" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
</select>
|
||||
@@ -667,7 +669,7 @@ _(File system type)_:
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="spares"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(false)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<?endif;?>
|
||||
@@ -1332,7 +1334,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
selectDiskFsProfile(<?=_var($disk,'slots',0)?>,true);
|
||||
selectDiskFsProfile(true);
|
||||
<?if (fsType('btrfs')):?>
|
||||
presetBTRFS(document.balance_schedule,'#balance-hour');
|
||||
presetBTRFS(document.scrub_schedule,'#scrub-hour');
|
||||
|
||||
Reference in New Issue
Block a user