mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 23:34:34 +04:00
luci-app-snmpd: group options in tabs
This commit groups the existing options in a general tabs and advanced tab. It also prepares to add additional tabs for SNMPv1/v2c and SNMPv3 in the future. Signed-off-by: Christian Korber <ck@dev.tdt.de>
This commit is contained in:
committed by
Paul Donald
parent
a2d0f5e2b3
commit
4ea7888909
@@ -5,59 +5,172 @@
|
|||||||
'require ui';
|
'require ui';
|
||||||
'require view';
|
'require view';
|
||||||
|
|
||||||
var desc = _(""
|
return L.view.extend({
|
||||||
+ "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() {
|
render: function() {
|
||||||
let m, s, o;
|
let m, s, o, g, go;
|
||||||
|
|
||||||
m = new form.Map("snmpd", _("net-snmp's SNMPD"), desc);
|
m = new form.Map('snmpd',
|
||||||
|
_('SNMP Settings'),
|
||||||
|
_('On this page you may configure SNMP settings'));
|
||||||
|
|
||||||
s = m.section(form.TypedSection, "agent", _("Agent settings"));
|
s = m.section(form.TypedSection, 'snmpd');
|
||||||
s.anonymous = true;
|
s.anonymous = true;
|
||||||
o = s.option(form.Value, "agentaddress", _("The address the agent should listen on"),
|
s.addremove = false;
|
||||||
_("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"),
|
s.tab('general', _('SNMP - General'));
|
||||||
_("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.taboption('general', form.SectionValue, '__general__',
|
||||||
o = s.option(form.Value, "secname", "secname");
|
form.TypedSection, 'system', _('System settings'),
|
||||||
o = s.option(form.Value, "source", "source");
|
_('Here you can configure system settings'));
|
||||||
o = s.option(form.Value, "community", "community");
|
|
||||||
|
|
||||||
s = m.section(form.TypedSection, "group", "group", _("Groups help define access methods"));
|
g = o.subsection;
|
||||||
s.addremove = true;
|
g.anonymous = true;
|
||||||
s.option(form.Value, "group", "group");
|
g.addremove = false;
|
||||||
s.option(form.Value, "version", "version");
|
|
||||||
s.option(form.Value, "secname", "secname");
|
|
||||||
|
|
||||||
s = m.section(form.TypedSection, "access", "access");
|
go = g.option(form.Value, 'sysLocation', 'sysLocation');
|
||||||
s.option(form.Value, "group", "group");
|
go = g.option(form.Value, 'sysContact', 'sysContact');
|
||||||
s.option(form.Value, "context", "context");
|
go = g.option(form.Value, 'sysName', 'sysName');
|
||||||
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"));
|
o = s.taboption('general', form.SectionValue, '__general__',
|
||||||
s.anonymous = true;
|
form.TypedSection, 'snmpd', _('Common Settings'),
|
||||||
s.option(form.Value, "sysLocation", "sysLocation");
|
_('Here you can configure common settings'));
|
||||||
s.option(form.Value, "sysContact", "sysContact");
|
|
||||||
s.option(form.Value, "sysName", "sysName");
|
g = o.subsection;
|
||||||
|
g.anonymous = true;
|
||||||
|
g.addremove = false;
|
||||||
|
|
||||||
|
go = g.option(form.Flag, 'enabled', _('Enable SNMP'),
|
||||||
|
_('Enable to use SNMP'));
|
||||||
|
go.default = '0';
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.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'));
|
||||||
|
|
||||||
|
go = g.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.tab('advanced', _('Advanced Settings'));
|
||||||
|
|
||||||
|
o = s.taboption('advanced', form.SectionValue, '__advanced__',
|
||||||
|
form.GridSection, 'com2sec', null,
|
||||||
|
_('Here you can configure com2sec options'));
|
||||||
|
|
||||||
|
g = o.subsection;
|
||||||
|
g.anonymous = true;
|
||||||
|
g.addremove = true;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'secname', _('Secname'),
|
||||||
|
_('Arbitrary label for use in group settings'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'source', _('Source'),
|
||||||
|
_('Source describes a host or network'));
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'community', _('Community'),
|
||||||
|
_('The community name that is used'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
o = s.taboption('advanced', form.SectionValue, '__advanced__',
|
||||||
|
form.GridSection, 'group', null,
|
||||||
|
_('Here you can configure group options'));
|
||||||
|
|
||||||
|
g = o.subsection;
|
||||||
|
g.anonymous = true;
|
||||||
|
g.addremove = true;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'group', _('Group'),
|
||||||
|
_('A group maps com2sec names to access names'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'version', _('Version'),
|
||||||
|
_('The used version for the group'));
|
||||||
|
go.value('v1', _('SNMPv1'));
|
||||||
|
go.value('v2c' _('SNMPv2c'));
|
||||||
|
go.value('usm', _('SNMPv3'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'secname', _('Secname'),
|
||||||
|
_('Here you define which secname is mapped to the group'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
o = s.taboption('advanced', form.SectionValue, '__advanced__',
|
||||||
|
form.GridSection, 'access', null,
|
||||||
|
_('Here you can configure access options'));
|
||||||
|
|
||||||
|
g = o.subsection;
|
||||||
|
g.anonymous = true;
|
||||||
|
g.addremove = true;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'group', _('Group'),
|
||||||
|
_('The group that is mapped to the views (Read, Write, Notify)'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'context', _('Context'),
|
||||||
|
_('The context of the request'));
|
||||||
|
go.default = 'none';
|
||||||
|
go.modalonly = true;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'version', _('Version'),
|
||||||
|
_('The used version for access configuration'));
|
||||||
|
go.value('any', _('Any version'));
|
||||||
|
go.value('v1', _('SNMPv1'));
|
||||||
|
go.value('v2c' _('SNMPv2c'));
|
||||||
|
go.value('usm', _('SNMPv3'));
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'level', _('Level'),
|
||||||
|
_('Level of security'));
|
||||||
|
go.value('noauth', _('No authentication (standard for SNMPv1/v2c)'));
|
||||||
|
go.value('auth', _('Authentication'));
|
||||||
|
go.value('priv', _('Authentication and encryption'));
|
||||||
|
go.default = 'noauth';
|
||||||
|
go.optional = false;
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'prefix', _('Prefix'),
|
||||||
|
_('Specification how context of requests is matched to context'));
|
||||||
|
go.value('exact', _('Exact'));
|
||||||
|
go.value('prefix', _('Prefix'));
|
||||||
|
go.optional = false;
|
||||||
|
go.default = 'excact';
|
||||||
|
go.rmempty = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'read', _('Read'),
|
||||||
|
_('Read access modification for groups'));
|
||||||
|
go.value('all', _('All'));
|
||||||
|
go.value('none', _('None'));
|
||||||
|
go.default = 'none';
|
||||||
|
go.rmempty = false;
|
||||||
|
go.modalonly = true;
|
||||||
|
go.optional = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'write', _('Write'),
|
||||||
|
_('Write access modification for groups'));
|
||||||
|
go.value('all', _('All'));
|
||||||
|
go.value('none', _('None'));
|
||||||
|
go.default = 'none';
|
||||||
|
go.rmempty = false;
|
||||||
|
go.modalonly = true;
|
||||||
|
go.optional = false;
|
||||||
|
|
||||||
|
go = g.option(form.Value, 'notify', _('Notify'),
|
||||||
|
_('Notify access modification for groups'));
|
||||||
|
go.value('all', _('All'));
|
||||||
|
go.value('none', _('None'));
|
||||||
|
go.default = 'none';
|
||||||
|
go.rmempty = false;
|
||||||
|
go.modalonly = true;
|
||||||
|
go.optional = false;
|
||||||
|
|
||||||
return m.render();
|
return m.render();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user