[#108] Port Bounce port control feature (down and up in succession)
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
2.028014
|
2.028014
|
||||||
|
|
||||||
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
* [#108] Port Bounce port control feature (down and up in succession)
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
* Missing action to netdisco-do should not throw Perl error
|
* Missing action to netdisco-do should not throw Perl error
|
||||||
|
|||||||
@@ -27,7 +27,16 @@ sub set_portcontrol {
|
|||||||
(my $sa = $job->subaction) =~ s/-\w+//;
|
(my $sa = $job->subaction) =~ s/-\w+//;
|
||||||
$job->subaction($sa);
|
$job->subaction($sa);
|
||||||
|
|
||||||
return _set_port_generic($job, 'up_admin');
|
if ($sa eq 'bounce') {
|
||||||
|
$job->subaction('down');
|
||||||
|
my @stat = _set_port_generic($job, 'up_admin');
|
||||||
|
return @stat if $stat[0] ne 'done';
|
||||||
|
$job->subaction('up');
|
||||||
|
return _set_port_generic($job, 'up_admin');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return _set_port_generic($job, 'up_admin');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub set_vlan {
|
sub set_vlan {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function port_control (e) {
|
|||||||
device: td.data('for-device')
|
device: td.data('for-device')
|
||||||
,port: td.data('for-port')
|
,port: td.data('for-port')
|
||||||
,field: td.data('field')
|
,field: td.data('field')
|
||||||
,action: td.data('action')
|
,action: ($(e).data('action') || td.data('action'))
|
||||||
,value: td.text().trim()
|
,value: td.text().trim()
|
||||||
,reason: reason
|
,reason: reason
|
||||||
,log: logmessage
|
,log: logmessage
|
||||||
@@ -30,31 +30,35 @@ function port_control (e) {
|
|||||||
,success: function() {
|
,success: function() {
|
||||||
toastr.info('Submitted change request');
|
toastr.info('Submitted change request');
|
||||||
|
|
||||||
// update all the screen furniture for port up/down control
|
// update all the screen furniture unless bouncing
|
||||||
if ($.trim(td.data('action')) == 'down') {
|
if (! $(e).hasClass('icon-bullseye')) {
|
||||||
td.prev('td').html('<i class="icon-remove"></i>');
|
if ($.trim(td.data('action')) == 'down') {
|
||||||
$(e).toggleClass('icon-hand-down');
|
td.prev('td').html('<i class="icon-remove"></i>');
|
||||||
$(e).toggleClass('icon-hand-up');
|
$(e).toggleClass('icon-hand-down');
|
||||||
$(e).data('tooltip').options.title = 'Click to Enable';
|
$(e).toggleClass('icon-hand-up');
|
||||||
td.data('action', 'up');
|
$(e).siblings('.icon-bullseye').hide();
|
||||||
}
|
$(e).data('tooltip').options.title = 'Enable Port';
|
||||||
else if ($.trim(td.data('action')) == 'up') {
|
td.data('action', 'up');
|
||||||
td.prev('td').html('<i class="icon-refresh icon-spin"></i>');
|
}
|
||||||
$(e).toggleClass('icon-hand-up');
|
else if ($.trim(td.data('action')) == 'up') {
|
||||||
$(e).toggleClass('icon-hand-down');
|
td.prev('td').html('<i class="icon-refresh icon-spin"></i>');
|
||||||
$(e).data('tooltip').options.title = 'Click to Disable';
|
$(e).toggleClass('icon-hand-up');
|
||||||
td.data('action', 'down');
|
$(e).toggleClass('icon-hand-down');
|
||||||
}
|
$(e).siblings('.icon-bullseye').show();
|
||||||
else if ($.trim(td.data('action')) == 'false') {
|
$(e).data('tooltip').options.title = 'Disable Port';
|
||||||
$(e).next('span').text('');
|
td.data('action', 'down');
|
||||||
$(e).toggleClass('nd_power-on');
|
}
|
||||||
$(e).data('tooltip').options.title = 'Click to Enable';
|
else if ($.trim(td.data('action')) == 'false') {
|
||||||
td.data('action', 'true');
|
$(e).next('span').text('');
|
||||||
}
|
$(e).toggleClass('nd_power-on');
|
||||||
else if ($.trim(td.data('action')) == 'true') {
|
$(e).data('tooltip').options.title = 'Enable Power';
|
||||||
$(e).toggleClass('nd_power-on');
|
td.data('action', 'true');
|
||||||
$(e).data('tooltip').options.title = 'Click to Disable';
|
}
|
||||||
td.data('action', 'false');
|
else if ($.trim(td.data('action')) == 'true') {
|
||||||
|
$(e).toggleClass('nd_power-on');
|
||||||
|
$(e).data('tooltip').options.title = 'Disable Power';
|
||||||
|
td.data('action', 'false');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,error: function() {
|
,error: function() {
|
||||||
@@ -118,7 +122,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// activity for port up/down control, power enable/disable control
|
// activity for port up/down control, power enable/disable control
|
||||||
$('#ports_pane').on('click', '.icon-hand-up,.icon-hand-down,.nd_power-icon', function() {
|
$('#ports_pane').on('click', '.icon-hand-up,.icon-hand-down,.nd_power-icon,.icon-bullseye', function() {
|
||||||
var clicked = this; // create a closure
|
var clicked = this; // create a closure
|
||||||
$('#nd_portlog').one('hidden', function() {
|
$('#nd_portlog').one('hidden', function() {
|
||||||
port_control(clicked); // save
|
port_control(clicked); // save
|
||||||
|
|||||||
@@ -62,16 +62,26 @@
|
|||||||
<td nowrap class="nd_editable-cell" data-action="down"
|
<td nowrap class="nd_editable-cell" data-action="down"
|
||||||
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
|
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
|
||||||
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
|
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
|
||||||
<i class="icon-hand-down nd_hand-icon"
|
<span class="nd_hand-icon">
|
||||||
rel="tooltip" data-placement="top" data-offset="3"
|
<i class="icon-bullseye" data-action="bounce"
|
||||||
data-animation="" data-title="Click to Disable"></i>
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
|
data-animation="" data-title="Bounce Port"></i>
|
||||||
|
<i class="icon-hand-down"
|
||||||
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
|
data-animation="" data-title="Disable Port"></i>
|
||||||
|
</span>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<td nowrap class="nd_editable-cell" data-action="up"
|
<td nowrap class="nd_editable-cell" data-action="up"
|
||||||
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
|
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
|
||||||
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
|
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
|
||||||
<i class="icon-hand-up nd_hand-icon"
|
<span class="nd_hand-icon">
|
||||||
rel="tooltip" data-placement="top" data-offset="3"
|
<i class="icon-bullseye" data-action="bounce" style="display: none"
|
||||||
data-animation="" data-title="Click to Enable"></i>
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
|
data-animation="" data-title="Bounce Port"></i>
|
||||||
|
<i class="icon-hand-up"
|
||||||
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
|
data-animation="" data-title="Enable Port"></i>
|
||||||
|
</span>
|
||||||
[% END %]
|
[% END %]
|
||||||
<a class="nd_log-icon"
|
<a class="nd_log-icon"
|
||||||
href="[% uri_for('/report/portlog') %]?q=[% device.ip | uri %]&f=[% row.port | uri %]">
|
href="[% uri_for('/report/portlog') %]?q=[% device.ip | uri %]&f=[% row.port | uri %]">
|
||||||
@@ -208,7 +218,7 @@
|
|||||||
|
|
||||||
<i class="icon-off nd_power-icon nd_power-on"
|
<i class="icon-off nd_power-icon nd_power-on"
|
||||||
rel="tooltip" data-placement="top" data-offset="3"
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
data-animation="" data-title="Click to Disable"></i>
|
data-animation="" data-title="Disable Power"></i>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<i class="icon-off nd_power-on"></i>
|
<i class="icon-off nd_power-on"></i>
|
||||||
@@ -228,7 +238,7 @@
|
|||||||
|
|
||||||
<i class="icon-off nd_power-icon"
|
<i class="icon-off nd_power-icon"
|
||||||
rel="tooltip" data-placement="top" data-offset="3"
|
rel="tooltip" data-placement="top" data-offset="3"
|
||||||
data-animation="" data-title="Click to Enable"></i>
|
data-animation="" data-title="Enable Power"></i>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<td>
|
<td>
|
||||||
<i class="icon-off"></i>
|
<i class="icon-off"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user