diff --git a/Netdisco/Changes b/Netdisco/Changes index 8215aa1e..fba08411 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -14,6 +14,7 @@ * [#77] Log user access * Try to help users more easily get a default login * Support upgrade from Netdisco version 0.x + * [#54] jobqueue_refresh config for number of seconds betwen queue refresh [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index b12a2354..62fbed20 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -223,6 +223,12 @@ Value: List of Modules. Default: Empty List. List of additional L names to load. See also the C setting. +=head3 C + +Value: Integer Number. Default: 5. + +Number of seconds between reloads of the Job Queue panel in the web interface. + =head3 C Value: Boolean. Default: true. diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index cb0a2b92..ad0f1288 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -72,6 +72,7 @@ web_plugins: - Device::Neighbors - Device::Addresses extra_web_plugins: [] +jobqueue_refresh: 5 safe_password_store: true # ------------- diff --git a/Netdisco/share/views/js/admintask.js b/Netdisco/share/views/js/admintask.js index 5ee762ce..9d397ecd 100644 --- a/Netdisco/share/views/js/admintask.js +++ b/Netdisco/share/views/js/admintask.js @@ -3,7 +3,9 @@ var path = 'admin'; // 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 // which might need to act on the newly inserted content @@ -14,19 +16,28 @@ if (tab == 'jobqueue' && $('#nd_countdown-control-icon').hasClass('icon-play')) { - $('#nd_countdown').text('5'); - nd_timers.push(setTimeout(function() { $('#nd_countdown').text('4') }, 1000 )); - nd_timers.push(setTimeout(function() { $('#nd_countdown').text('3') }, 2000 )); - nd_timers.push(setTimeout(function() { $('#nd_countdown').text('2') }, 3000 )); - nd_timers.push(setTimeout(function() { $('#nd_countdown').text('1') }, 4000 )); + $('#nd_countdown').text(timermax); + + // add new timers + for (var i = timercache; i > 0; i--) { + nd_timers.push(setTimeout(function() { + $('#nd_countdown').text(timercache); + timercache = timercache - 1; + }, ((timermax * 1000) - (i * 1000)) )); + } + nd_timers.push(setTimeout(function() { // clear any running timers for (var i = 0; i < nd_timers.length; 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'); - }, 5000)); + }, (timermax * 1000))); } // activate typeahead on the topo boxes