From 3a02a1bce4190ce0d94883709e0a6c362bcb0af3 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 9 Dec 2015 23:39:52 -0600 Subject: RT#39115: View SNMP info on svc_broadband service --- .../edit/elements/part_export/broadband_snmp.html | 8 ++- .../elements/part_export/broadband_snmp_get.html | 77 ++++++++++++++++++++++ 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 httemplate/edit/elements/part_export/broadband_snmp_get.html (limited to 'httemplate/edit/elements') diff --git a/httemplate/edit/elements/part_export/broadband_snmp.html b/httemplate/edit/elements/part_export/broadband_snmp.html index ebb765dee..b4d57edd5 100644 --- a/httemplate/edit/elements/part_export/broadband_snmp.html +++ b/httemplate/edit/elements/part_export/broadband_snmp.html @@ -11,7 +11,7 @@ <& /elements/tr-input-text.html, label => 'Community', field => 'community', - curr_value => $part_export->option('community'), + curr_value => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'community'}->{'default'}, &> <& /elements/tr-checkbox.html, label => 'Send IP address changes to new address', @@ -30,7 +30,7 @@ function open_select_mib(obj) { nd(1); // if there's already one open, close it var rownum = obj.rownum; var curr_oid = obj.form.elements['oid' + rownum].value || ''; - var url = '<%$fsurl%>/elements/select-mib-popup.html?' + + var url = '<%$fsurl%>misc/select-mib-popup.html?' + 'callback=receive_mib;' + 'arg=' + rownum + ';curr_value=' + curr_oid; @@ -45,8 +45,10 @@ function open_select_mib(obj) { function receive_mib(obj, rownum) { //console.log(JSON.stringify(obj)); // we don't really need the numeric OID or any of the other properties - document.getElementById('oid'+rownum).value = obj.fullname; + var oidfield = document.getElementById('oid'+rownum); + oidfield.value = obj.fullname; document.getElementById('datatype'+rownum).value = obj.type; + oidfield.onchange(); //should be same as datatype, only need to run one } diff --git a/httemplate/edit/elements/part_export/broadband_snmp_get.html b/httemplate/edit/elements/part_export/broadband_snmp_get.html new file mode 100644 index 000000000..8b8717c29 --- /dev/null +++ b/httemplate/edit/elements/part_export/broadband_snmp_get.html @@ -0,0 +1,77 @@ +<%doc> +Quite a bit of false laziness with edit/elements/part_export/broadband_snmp.html + +<& head.html, %opt &> + +<& /elements/tr-select.html, + label => 'SNMP version', + field => 'snmp_version', + options => [ '1', '2c' ], + curr_value => $part_export->option('version') +&> +<& /elements/tr-input-text.html, + label => 'Community', + field => 'snmp_community', + curr_value => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'snmp_community'}->{'default'}, +&> +<& /elements/tr-input-text.html, + label => 'Timeout (seconds)', + field => 'snmp_timeout', + curr_value => $part_export->option('timeout') || $opt{'export_info'}->{'options'}->{'snmp_timeout'}->{'default'}, +&> + + + + + + + + +<& /elements/auto-table.html, + template_row => 'broadband_snmp_get_template', + fieldorder => ['oid'], + data => \@data, + table => 'snmp', +&> + +<& foot.html, %opt &> +<%init> +my %opt = @_; + +my $part_export = $opt{part_export} || FS::part_export->new; + +my @oids = split("\n", $part_export->option('snmp_oid')); + +my @data; +while (@oids) { + my @thisrow = (shift(@oids)); + push @data, \@thisrow if grep length($_), @thisrow; +} + +my $popup_name = 'popup-'.time."-$$-".rand() * 2**32; + -- cgit v1.2.1
Object ID
+ + +