[#54] jobqueue_refresh config for number of seconds betwen queue refresh

This commit is contained in:
Oliver Gorwits
2014-02-08 22:00:08 +00:00
parent 4c39387477
commit 71aa069af1
4 changed files with 27 additions and 8 deletions

View File

@@ -14,6 +14,7 @@
* [#77] Log user access * [#77] Log user access
* Try to help users more easily get a default login * Try to help users more easily get a default login
* Support upgrade from Netdisco version 0.x * Support upgrade from Netdisco version 0.x
* [#54] jobqueue_refresh config for number of seconds betwen queue refresh
[BUG FIXES] [BUG FIXES]

View File

@@ -223,6 +223,12 @@ Value: List of Modules. Default: Empty List.
List of additional L<App::Netdisco::Web::Plugin> names to load. See also the List of additional L<App::Netdisco::Web::Plugin> names to load. See also the
C<web_plugins> setting. C<web_plugins> setting.
=head3 C<jobqueue_refresh>
Value: Integer Number. Default: 5.
Number of seconds between reloads of the Job Queue panel in the web interface.
=head3 C<safe_password_store> =head3 C<safe_password_store>
Value: Boolean. Default: true. Value: Boolean. Default: true.

View File

@@ -72,6 +72,7 @@ web_plugins:
- Device::Neighbors - Device::Neighbors
- Device::Addresses - Device::Addresses
extra_web_plugins: [] extra_web_plugins: []
jobqueue_refresh: 5
safe_password_store: true safe_password_store: true
# ------------- # -------------

View File

@@ -3,7 +3,9 @@
var path = 'admin'; var path = 'admin';
// keep track of timers so we can kill them // keep track of timers so we can kill them
var nd_timers = new Array(); var nd_timers = new Array();
var timermax = [% settings.jobqueue_refresh || 5 | html %];
var timercache = timermax - 1;
// this is called by do_search to support local code // this is called by do_search to support local code
// which might need to act on the newly inserted content // which might need to act on the newly inserted content
@@ -14,19 +16,28 @@
if (tab == 'jobqueue' if (tab == 'jobqueue'
&& $('#nd_countdown-control-icon').hasClass('icon-play')) { && $('#nd_countdown-control-icon').hasClass('icon-play')) {
$('#nd_countdown').text('5'); $('#nd_countdown').text(timermax);
nd_timers.push(setTimeout(function() { $('#nd_countdown').text('4') }, 1000 ));
nd_timers.push(setTimeout(function() { $('#nd_countdown').text('3') }, 2000 )); // add new timers
nd_timers.push(setTimeout(function() { $('#nd_countdown').text('2') }, 3000 )); for (var i = timercache; i > 0; i--) {
nd_timers.push(setTimeout(function() { $('#nd_countdown').text('1') }, 4000 )); nd_timers.push(setTimeout(function() {
$('#nd_countdown').text(timercache);
timercache = timercache - 1;
}, ((timermax * 1000) - (i * 1000)) ));
}
nd_timers.push(setTimeout(function() { nd_timers.push(setTimeout(function() {
// clear any running timers // clear any running timers
for (var i = 0; i < nd_timers.length; i++) { for (var i = 0; i < nd_timers.length; i++) {
clearTimeout(nd_timers[i]); clearTimeout(nd_timers[i]);
} }
// reload the tab content
// reset the timer cache
timercache = timermax - 1;
// reload the tab content in...
$('#' + tab + '_form').trigger('submit'); $('#' + tab + '_form').trigger('submit');
}, 5000)); }, (timermax * 1000)));
} }
// activate typeahead on the topo boxes // activate typeahead on the topo boxes