luci-app-snmpd: convert CBI to JS
Eliminates luci-compat, but no other changes. Signed-off-by: Karl Palsson <karlp@etactica.com> [add final newline, explicitly require `view` class, remove unused require, fix commit subject, initialize translation template] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
23babd7cd4
commit
d4767c2de6
5 changed files with 138 additions and 68 deletions
|
@ -1,7 +1,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:= Net-SNMP LuCI interface
|
LUCI_TITLE:= Net-SNMP LuCI interface
|
||||||
LUCI_DEPENDS:=+luci-compat +luci-base +snmpd
|
LUCI_DEPENDS:=+luci-base +snmpd
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
LUCI_DESCRIPTION:=Some common net-snmp config items. In no way is this comprehensive.
|
LUCI_DESCRIPTION:=Some common net-snmp config items. In no way is this comprehensive.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
// SPDX: Apache-2.0
|
||||||
|
// Karl Palsson <karlp@etactica.com> 2021
|
||||||
|
'use strict';
|
||||||
|
'require form';
|
||||||
|
'require ui';
|
||||||
|
'require view';
|
||||||
|
|
||||||
|
var desc = _(""
|
||||||
|
+ "SNMPD is a master daemon/agent for SNMP, from the <a href='http://www.net-snmp.org'>"
|
||||||
|
+ "net-snmp project</a>. "
|
||||||
|
+ "Note, OpenWrt has mostly complete UCI support for snmpd, but this LuCI applet "
|
||||||
|
+ "only covers a few of those options. In particular, there is very little/no validation "
|
||||||
|
+ "or help. See /etc/config/snmpd for manual configuration."
|
||||||
|
);
|
||||||
|
|
||||||
|
return view.extend({
|
||||||
|
render: function() {
|
||||||
|
var m, s, o;
|
||||||
|
|
||||||
|
m = new form.Map("snmpd", _("net-snmp's SNMPD"), desc);
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "agent", _("Agent settings"));
|
||||||
|
s.anonymous = true;
|
||||||
|
o = s.option(form.Value, "agentaddress", _("The address the agent should listen on"),
|
||||||
|
_("Eg: UDP:161, or UDP:10.5.4.3:161 to only listen on a given interface"));
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "agentx", _("AgentX settings"),
|
||||||
|
_("Delete this section to disable AgentX"));
|
||||||
|
s.anonymous = true;
|
||||||
|
o = s.option(form.Value, "agentxsocket", _("The address the agent should allow AgentX connections to"),
|
||||||
|
_("This is only necessary if you have subagents using the agentX "
|
||||||
|
+ "socket protocol. Eg: /var/run/agentx.sock"));
|
||||||
|
s.addremove = true;
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "com2sec", _("com2sec security"));
|
||||||
|
o = s.option(form.Value, "secname", "secname");
|
||||||
|
o = s.option(form.Value, "source", "source");
|
||||||
|
o = s.option(form.Value, "community", "community");
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "group", "group", _("Groups help define access methods"));
|
||||||
|
s.addremove = true;
|
||||||
|
s.option(form.Value, "group", "group");
|
||||||
|
s.option(form.Value, "version", "version");
|
||||||
|
s.option(form.Value, "secname", "secname");
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "access", "access");
|
||||||
|
s.option(form.Value, "group", "group");
|
||||||
|
s.option(form.Value, "context", "context");
|
||||||
|
s.option(form.Value, "version", "version");
|
||||||
|
s.option(form.Value, "level", "level");
|
||||||
|
s.option(form.Value, "prefix", "prefix");
|
||||||
|
s.option(form.Value, "read", "read");
|
||||||
|
s.option(form.Value, "write", "write");
|
||||||
|
s.option(form.Value, "notify", "notify");
|
||||||
|
|
||||||
|
s = m.section(form.TypedSection, "system", _("System"), _("Values used in the MIB2 System tree"));
|
||||||
|
s.anonymous = true;
|
||||||
|
s.option(form.Value, "sysLocation", "sysLocation");
|
||||||
|
s.option(form.Value, "sysContact", "sysContact");
|
||||||
|
s.option(form.Value, "sysName", "sysName");
|
||||||
|
|
||||||
|
return m.render();
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,63 +0,0 @@
|
||||||
--[[
|
|
||||||
LuCI model for net-snmp configuration management
|
|
||||||
Copyright Karl Palsson <karlp@etactica.com>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
]]--
|
|
||||||
|
|
||||||
local datatypes = require("luci.cbi.datatypes")
|
|
||||||
|
|
||||||
m = Map("snmpd", "net-snmp's SNMPD",
|
|
||||||
[[SNMPD is a master daemon/agent for SNMP, from the <a href='http://www.net-snmp.org'>
|
|
||||||
net-snmp project</a>.
|
|
||||||
Note, OpenWrt has mostly complete UCI support for snmpd, but this LuCI applet
|
|
||||||
only covers a few of those options. In particular, there is very little/no validation
|
|
||||||
or help.
|
|
||||||
See /etc/config/snmpd for manual configuration.
|
|
||||||
]])
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "agent", "Agent settings")
|
|
||||||
s.anonymous = true
|
|
||||||
p = s:option(Value, "agentaddress", "The address the agent should listen on",
|
|
||||||
[[Eg: UDP:161, or UDP:10.5.4.3:161 to only listen on a given interface]])
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "agentx", "AgentX settings", "Delete this section to disable agentx")
|
|
||||||
s.anonymous = true
|
|
||||||
p = s:option(Value, "agentxsocket", "The address the agent should allow agentX connections to",
|
|
||||||
[[This is only necessary if you have subagents using the agentX socket protocol.
|
|
||||||
Eg: /var/run/agentx.sock]])
|
|
||||||
s.addremove=true
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "com2sec", "com2sec security")
|
|
||||||
p = s:option(Value, "secname", "secname")
|
|
||||||
p = s:option(Value, "source", "source")
|
|
||||||
p = s:option(Value, "community", "community")
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "group", "group", "Groups help define access methods")
|
|
||||||
s.addremove=true
|
|
||||||
s:option(Value, "group", "group")
|
|
||||||
s:option(Value, "version", "version")
|
|
||||||
s:option(Value, "secname", "secname")
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "access", "access")
|
|
||||||
s:option(Value, "group", "group")
|
|
||||||
s:option(Value, "context", "context")
|
|
||||||
s:option(Value, "version", "version")
|
|
||||||
s:option(Value, "level", "level")
|
|
||||||
s:option(Value, "prefix", "prefix")
|
|
||||||
s:option(Value, "read", "read")
|
|
||||||
s:option(Value, "write", "write")
|
|
||||||
s:option(Value, "notify", "notify")
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "system", "System", "Values used in the MIB2 System tree")
|
|
||||||
s.anonymous = true
|
|
||||||
s:option(Value, "sysLocation", "sysLocation")
|
|
||||||
s:option(Value, "sysContact", "sysContact")
|
|
||||||
s:option(Value, "sysName", "sysName")
|
|
||||||
|
|
||||||
return m
|
|
69
applications/luci-app-snmpd/po/templates/snmpd.pot
Normal file
69
applications/luci-app-snmpd/po/templates/snmpd.pot
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:22
|
||||||
|
msgid "Agent settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:27
|
||||||
|
msgid "AgentX settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:28
|
||||||
|
msgid "Delete this section to disable AgentX"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:25
|
||||||
|
msgid "Eg: UDP:161, or UDP:10.5.4.3:161 to only listen on a given interface"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3
|
||||||
|
msgid "Grant UCI access for luci-app-snmpd"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:40
|
||||||
|
msgid "Groups help define access methods"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3
|
||||||
|
msgid "SNMPD"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:8
|
||||||
|
msgid ""
|
||||||
|
"SNMPD is a master daemon/agent for SNMP, from the <a href='http://www.net-"
|
||||||
|
"snmp.org'>net-snmp project</a>. Note, OpenWrt has mostly complete UCI "
|
||||||
|
"support for snmpd, but this LuCI applet only covers a few of those options. "
|
||||||
|
"In particular, there is very little/no validation or help. See /etc/config/"
|
||||||
|
"snmpd for manual configuration."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:56
|
||||||
|
msgid "System"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:30
|
||||||
|
msgid "The address the agent should allow AgentX connections to"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:24
|
||||||
|
msgid "The address the agent should listen on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:31
|
||||||
|
msgid ""
|
||||||
|
"This is only necessary if you have subagents using the agentX socket "
|
||||||
|
"protocol. Eg: /var/run/agentx.sock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:56
|
||||||
|
msgid "Values used in the MIB2 System tree"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:35
|
||||||
|
msgid "com2sec security"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js:20
|
||||||
|
msgid "net-snmp's SNMPD"
|
||||||
|
msgstr ""
|
|
@ -2,12 +2,12 @@
|
||||||
"admin/services/snmpd": {
|
"admin/services/snmpd": {
|
||||||
"title": "SNMPD",
|
"title": "SNMPD",
|
||||||
"action": {
|
"action": {
|
||||||
"type": "cbi",
|
"type": "view",
|
||||||
"path": "snmpd",
|
"path": "snmpd/snmpd"
|
||||||
"post": { "cbi.submit": true }
|
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"acl": [ "luci-app-snmpd" ]
|
"acl": [ "luci-app-snmpd" ],
|
||||||
|
"uci": { "snmpd": true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue