Skip to content

Commit a52db00

Browse files
committed
luci-app-olsr: fix const reassignment to let
Signed-off-by: Paul Donald <[email protected]>
1 parent d3cbf6e commit a52db00

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,29 +203,30 @@ return view.extend({
203203
for (const option of knownPlParams[plname]) {
204204
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
205205
let values;
206+
let actualDefault = defaultVal; // new variable instead of reassigning defaultVal
206207

207208
if (Array.isArray(defaultVal)) {
208209
values = defaultVal;
209-
defaultVal = defaultVal[0];
210+
actualDefault = defaultVal[0];
210211
}
211212

212213
if (otype === form.Flag) {
213214
const bool = p.option(form.Flag, name, name);
214-
if (defaultVal === 'yes' || defaultVal === 'no') {
215+
if (actualDefault === 'yes' || actualDefault === 'no') {
215216
bool.enabled = 'yes';
216217
bool.disabled = 'no';
217-
} else if (defaultVal === 'on' || defaultVal === 'off') {
218+
} else if (actualDefault === 'on' || actualDefault === 'off') {
218219
bool.enabled = 'on';
219220
bool.disabled = 'off';
220-
} else if (defaultVal === '1' || defaultVal === '0') {
221+
} else if (actualDefault === '1' || actualDefault === '0') {
221222
bool.enabled = '1';
222223
bool.disabled = '0';
223224
} else {
224225
bool.enabled = 'true';
225226
bool.disabled = 'false';
226227
}
227228
bool.optional = true;
228-
bool.placeholder = defaultVal;
229+
bool.placeholder = actualDefault;
229230
bool.cfgvalue = function (section_id) {
230231
return uci.get('olsrd', section_id, name);
231232
};
@@ -251,7 +252,7 @@ return view.extend({
251252
};
252253
}
253254
field.optional = true;
254-
field.placeholder = defaultVal;
255+
field.placeholder = actualDefault;
255256
}
256257
}
257258
}

applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,29 +201,30 @@ return view.extend({
201201
for (const option of knownPlParams[plname]) {
202202
const [otype, name, defaultVal, uci2cbi, cbi2uci] = option;
203203
let values;
204+
let actualDefault = defaultVal; // new variable instead of reassigning defaultVal
204205

205206
if (Array.isArray(defaultVal)) {
206207
values = defaultVal;
207-
defaultVal = defaultVal[0];
208+
actualDefault = defaultVal[0];
208209
}
209210

210211
if (otype === form.Flag) {
211212
const bool = p.option(form.Flag, name, name);
212-
if (defaultVal === 'yes' || defaultVal === 'no') {
213+
if (actualDefault === 'yes' || actualDefault === 'no') {
213214
bool.enabled = 'yes';
214215
bool.disabled = 'no';
215-
} else if (defaultVal === 'on' || defaultVal === 'off') {
216+
} else if (actualDefault === 'on' || actualDefault === 'off') {
216217
bool.enabled = 'on';
217218
bool.disabled = 'off';
218-
} else if (defaultVal === '1' || defaultVal === '0') {
219+
} else if (actualDefault === '1' || actualDefault === '0') {
219220
bool.enabled = '1';
220221
bool.disabled = '0';
221222
} else {
222223
bool.enabled = 'true';
223224
bool.disabled = 'false';
224225
}
225226
bool.optional = true;
226-
bool.placeholder = defaultVal;
227+
bool.placeholder = actualDefault;
227228
bool.cfgvalue = function (section_id) {
228229
return uci.get('olsrd6', section_id, name);
229230
};
@@ -249,7 +250,7 @@ return view.extend({
249250
};
250251
}
251252
field.optional = true;
252-
field.placeholder = defaultVal;
253+
field.placeholder = actualDefault;
253254
}
254255
}
255256
}

0 commit comments

Comments
 (0)