From a52db00cab7f77f0302be2643783c42b96e15418 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Fri, 24 Oct 2025 17:40:03 +0200 Subject: [PATCH] luci-app-olsr: fix const reassignment to let Signed-off-by: Paul Donald --- .../resources/view/olsr/frontend/olsrdplugins.js | 13 +++++++------ .../resources/view/olsr/frontend/olsrdplugins6.js | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js b/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js index 9bed11883a..7e3287f964 100644 --- a/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js +++ b/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js @@ -203,21 +203,22 @@ return view.extend({ for (const option of knownPlParams[plname]) { const [otype, name, defaultVal, uci2cbi, cbi2uci] = option; let values; + let actualDefault = defaultVal; // new variable instead of reassigning defaultVal if (Array.isArray(defaultVal)) { values = defaultVal; - defaultVal = defaultVal[0]; + actualDefault = defaultVal[0]; } if (otype === form.Flag) { const bool = p.option(form.Flag, name, name); - if (defaultVal === 'yes' || defaultVal === 'no') { + if (actualDefault === 'yes' || actualDefault === 'no') { bool.enabled = 'yes'; bool.disabled = 'no'; - } else if (defaultVal === 'on' || defaultVal === 'off') { + } else if (actualDefault === 'on' || actualDefault === 'off') { bool.enabled = 'on'; bool.disabled = 'off'; - } else if (defaultVal === '1' || defaultVal === '0') { + } else if (actualDefault === '1' || actualDefault === '0') { bool.enabled = '1'; bool.disabled = '0'; } else { @@ -225,7 +226,7 @@ return view.extend({ bool.disabled = 'false'; } bool.optional = true; - bool.placeholder = defaultVal; + bool.placeholder = actualDefault; bool.cfgvalue = function (section_id) { return uci.get('olsrd', section_id, name); }; @@ -251,7 +252,7 @@ return view.extend({ }; } field.optional = true; - field.placeholder = defaultVal; + field.placeholder = actualDefault; } } } diff --git a/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js b/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js index 2d41bddf62..2fd665c5d9 100644 --- a/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js +++ b/applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js @@ -201,21 +201,22 @@ return view.extend({ for (const option of knownPlParams[plname]) { const [otype, name, defaultVal, uci2cbi, cbi2uci] = option; let values; + let actualDefault = defaultVal; // new variable instead of reassigning defaultVal if (Array.isArray(defaultVal)) { values = defaultVal; - defaultVal = defaultVal[0]; + actualDefault = defaultVal[0]; } if (otype === form.Flag) { const bool = p.option(form.Flag, name, name); - if (defaultVal === 'yes' || defaultVal === 'no') { + if (actualDefault === 'yes' || actualDefault === 'no') { bool.enabled = 'yes'; bool.disabled = 'no'; - } else if (defaultVal === 'on' || defaultVal === 'off') { + } else if (actualDefault === 'on' || actualDefault === 'off') { bool.enabled = 'on'; bool.disabled = 'off'; - } else if (defaultVal === '1' || defaultVal === '0') { + } else if (actualDefault === '1' || actualDefault === '0') { bool.enabled = '1'; bool.disabled = '0'; } else { @@ -223,7 +224,7 @@ return view.extend({ bool.disabled = 'false'; } bool.optional = true; - bool.placeholder = defaultVal; + bool.placeholder = actualDefault; bool.cfgvalue = function (section_id) { return uci.get('olsrd6', section_id, name); }; @@ -249,7 +250,7 @@ return view.extend({ }; } field.optional = true; - field.placeholder = defaultVal; + field.placeholder = actualDefault; } } }