From: Paul Donald Date: Mon, 25 May 2026 20:43:40 +0000 (+0300) Subject: luci-app-snmpd: code fixes X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=395a7a8b96dbbe6c46fb72b49a91a098d4fbd3c6;p=openwrt-luci.git luci-app-snmpd: code fixes Signed-off-by: Paul Donald --- diff --git a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/download.js b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/download.js index 479301a3e8..d7b60778be 100644 --- a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/download.js +++ b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/download.js @@ -21,9 +21,9 @@ return L.view.extend({ const a = document.createElement('a'); document.body.appendChild(a); - a.display = 'none'; + a.style.display = 'none'; - return mibDownload(base + fileName, false).then(function(res) { + return mibDownload(base + fileName).then(function(res) { const data = res; const file = new Blob( [data] , { type: 'text/plain'}); const fileUrl = window.URL.createObjectURL(file); @@ -31,6 +31,7 @@ return L.view.extend({ a.href = fileUrl; a.download = fileName; a.click(); + window.URL.revokeObjectURL(fileUrl); document.body.removeChild(a); }); }, diff --git a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js index e681414a33..61adfd6fe8 100644 --- a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js +++ b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js @@ -103,6 +103,7 @@ return L.view.extend({ return port; const s = uci.get_first('snmpd', 'agent'); + if (!s) return null; const rawAddr = uci.get('snmpd', s['.name'], 'agentaddress'); if (!rawAddr) return null; @@ -162,13 +163,13 @@ return L.view.extend({ go.remove = function(section_id) { const s = uci.get_first('snmpd', 'agentx'); if (s) - s.remove('snmpd', s['.name']); + uci.remove('snmpd', s['.name']); }; go.write = function(section_id, value) { const s = uci.get_first('snmpd', 'agentx'); var sid = s ? s['.name'] : uci.add('snmpd', 'agentx'); - uci.set('snmpd', sid, 'agentxsocket', value); + return uci.set('snmpd', sid, 'agentxsocket', value); }; }, @@ -363,10 +364,10 @@ return L.view.extend({ g.nodescriptions = true; g.modaltitle = desc; - go = g.option(form.ListValue, 'Mode', _('Access Control'), + mode = g.option(form.ListValue, 'Mode', _('Access Control'), _('Access restriction to readonly or Read/Write')); - go.value('rwcommunity', _('Read/Write')); - go.value('rocommunity', _('Readonly')); + mode.value('rwcommunity', _('Read/Write')); + mode.value('rocommunity', _('Readonly')); community = g.option(form.Value, 'CommunityName', _('Community Name'), @@ -420,7 +421,7 @@ return L.view.extend({ this.oid.datatype = 'string'; this.oid.depends('RestrictOID', 'yes'); - if (go === 'rocommunity') { + if (uci.get('snmpd', subsection, 'Mode') === 'rocommunity') { this.ro_community = community; this.ro_community_src = community_src; } else {