luci-app-olsr: fix const reassignment to let
authorPaul Donald <[email protected]>
Fri, 24 Oct 2025 15:40:03 +0000 (17:40 +0200)
committerPaul Donald <[email protected]>
Fri, 24 Oct 2025 15:41:25 +0000 (17:41 +0200)
Signed-off-by: Paul Donald <[email protected]>
applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins.js
applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/frontend/olsrdplugins6.js

index 9bed11883a55c7076ce592e78d59778409c04f69..7e3287f9642a8a4253f9cf6cd34261c4efe4cd21 100644 (file)
@@ -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;
                                        }
                                }
                        }
index 2d41bddf629886baf2740e107cf4de621b085620..2fd665c5d9439c983b478c0d7a1495319ec65fb9 100644 (file)
@@ -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;
                                        }
                                }
                        }