From 76b5ceae5c20a1c7801f452dbcee091e168abdd9 Mon Sep 17 00:00:00 2001 From: Ivan K Date: Mon, 24 Feb 2025 17:39:56 +0300 Subject: [PATCH] feat: add section_id parameter to getNetworkInterfaces function --- .../htdocs/luci-static/resources/view/podkop/podkop.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 4b2a0e9..4643180 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -41,10 +41,14 @@ function formatDiagnosticOutput(output) { .replace(/\r/g, '\n'); } -function getNetworkInterfaces(o) { +function getNetworkInterfaces(o, section_id) { const excludeInterfaces = ['br-lan', 'eth0', 'eth1', 'wan', 'phy0-ap0', 'phy1-ap0', 'pppoe-wan']; return network.getDevices().then(devices => { + // Reset the options by creating a new keylist + o.keylist = []; + o.vallist = []; + devices.forEach(device => { if (device.dev && device.dev.name) { const deviceName = device.dev.name; @@ -226,7 +230,7 @@ function createConfigSection(section, map, network) { o.depends('mode', 'vpn'); o.ucisection = s.section; o.load = function (section_id) { - return getNetworkInterfaces(this).then(() => { + return getNetworkInterfaces(this, section_id).then(() => { return this.super('load', section_id); }); }; @@ -1047,4 +1051,4 @@ return view.extend({ return map_promise; } -}); +}); \ No newline at end of file