mirror of
https://git.openwrt.org/project/luci.git
synced 2025-11-03 15:19:47 +08:00
luci-app-olsr: fix const reassignment to let
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@ -203,21 +203,22 @@ return view.extend({
|
|||||||
for (const option of knownPlParams[plname]) {
|
for (const option of knownPlParams[plname]) {
|
||||||
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
|
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
|
||||||
let values;
|
let values;
|
||||||
|
let actualDefault = defaultVal; // new variable instead of reassigning defaultVal
|
||||||
|
|
||||||
if (Array.isArray(defaultVal)) {
|
if (Array.isArray(defaultVal)) {
|
||||||
values = defaultVal;
|
values = defaultVal;
|
||||||
defaultVal = defaultVal[0];
|
actualDefault = defaultVal[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otype === form.Flag) {
|
if (otype === form.Flag) {
|
||||||
const bool = p.option(form.Flag, name, name);
|
const bool = p.option(form.Flag, name, name);
|
||||||
if (defaultVal === 'yes' || defaultVal === 'no') {
|
if (actualDefault === 'yes' || actualDefault === 'no') {
|
||||||
bool.enabled = 'yes';
|
bool.enabled = 'yes';
|
||||||
bool.disabled = 'no';
|
bool.disabled = 'no';
|
||||||
} else if (defaultVal === 'on' || defaultVal === 'off') {
|
} else if (actualDefault === 'on' || actualDefault === 'off') {
|
||||||
bool.enabled = 'on';
|
bool.enabled = 'on';
|
||||||
bool.disabled = 'off';
|
bool.disabled = 'off';
|
||||||
} else if (defaultVal === '1' || defaultVal === '0') {
|
} else if (actualDefault === '1' || actualDefault === '0') {
|
||||||
bool.enabled = '1';
|
bool.enabled = '1';
|
||||||
bool.disabled = '0';
|
bool.disabled = '0';
|
||||||
} else {
|
} else {
|
||||||
@ -225,7 +226,7 @@ return view.extend({
|
|||||||
bool.disabled = 'false';
|
bool.disabled = 'false';
|
||||||
}
|
}
|
||||||
bool.optional = true;
|
bool.optional = true;
|
||||||
bool.placeholder = defaultVal;
|
bool.placeholder = actualDefault;
|
||||||
bool.cfgvalue = function (section_id) {
|
bool.cfgvalue = function (section_id) {
|
||||||
return uci.get('olsrd', section_id, name);
|
return uci.get('olsrd', section_id, name);
|
||||||
};
|
};
|
||||||
@ -251,7 +252,7 @@ return view.extend({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
field.optional = true;
|
field.optional = true;
|
||||||
field.placeholder = defaultVal;
|
field.placeholder = actualDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,21 +201,22 @@ return view.extend({
|
|||||||
for (const option of knownPlParams[plname]) {
|
for (const option of knownPlParams[plname]) {
|
||||||
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
|
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
|
||||||
let values;
|
let values;
|
||||||
|
let actualDefault = defaultVal; // new variable instead of reassigning defaultVal
|
||||||
|
|
||||||
if (Array.isArray(defaultVal)) {
|
if (Array.isArray(defaultVal)) {
|
||||||
values = defaultVal;
|
values = defaultVal;
|
||||||
defaultVal = defaultVal[0];
|
actualDefault = defaultVal[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otype === form.Flag) {
|
if (otype === form.Flag) {
|
||||||
const bool = p.option(form.Flag, name, name);
|
const bool = p.option(form.Flag, name, name);
|
||||||
if (defaultVal === 'yes' || defaultVal === 'no') {
|
if (actualDefault === 'yes' || actualDefault === 'no') {
|
||||||
bool.enabled = 'yes';
|
bool.enabled = 'yes';
|
||||||
bool.disabled = 'no';
|
bool.disabled = 'no';
|
||||||
} else if (defaultVal === 'on' || defaultVal === 'off') {
|
} else if (actualDefault === 'on' || actualDefault === 'off') {
|
||||||
bool.enabled = 'on';
|
bool.enabled = 'on';
|
||||||
bool.disabled = 'off';
|
bool.disabled = 'off';
|
||||||
} else if (defaultVal === '1' || defaultVal === '0') {
|
} else if (actualDefault === '1' || actualDefault === '0') {
|
||||||
bool.enabled = '1';
|
bool.enabled = '1';
|
||||||
bool.disabled = '0';
|
bool.disabled = '0';
|
||||||
} else {
|
} else {
|
||||||
@ -223,7 +224,7 @@ return view.extend({
|
|||||||
bool.disabled = 'false';
|
bool.disabled = 'false';
|
||||||
}
|
}
|
||||||
bool.optional = true;
|
bool.optional = true;
|
||||||
bool.placeholder = defaultVal;
|
bool.placeholder = actualDefault;
|
||||||
bool.cfgvalue = function (section_id) {
|
bool.cfgvalue = function (section_id) {
|
||||||
return uci.get('olsrd6', section_id, name);
|
return uci.get('olsrd6', section_id, name);
|
||||||
};
|
};
|
||||||
@ -249,7 +250,7 @@ return view.extend({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
field.optional = true;
|
field.optional = true;
|
||||||
field.placeholder = defaultVal;
|
field.placeholder = actualDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user