Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions mrq/dashboard/static/js/views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,35 @@ define(["jquery", "underscore", "views/generic/page", "models", "moment", "circl
refreshStats: function (poolSize, currentJobs, utilization, doneJobs) {
var self = this;
var values = self.addToCounter("overall-done-jobs", doneJobs, 50).join(",");
var refreshInterval = parseInt($(".js-autorefresh").val(), 10) * 1000;

self.$(".inlinesparkline").attr("values", values);
self.$(".inlinesparkline").sparkline("html", {"width": "250px", "height": "200px", "defaultPixelsPerValue": 1});
self.refreshCircleStats(poolSize, currentJobs, utilization);

setTimeout(function () {
self.fetchStats(self.refreshStats);
}, refreshInterval);
self.autoUpdateStats();
},

render: function() {
var self = this;
var refreshInterval = parseInt($(".js-autorefresh").val(), 10) * 1000;

self.renderTemplate();
self.fetchStats(self.renderStats);
self.autoUpdateStats();
},

setTimeout(function () {
self.fetchStats(self.refreshStats);
}, refreshInterval);
autoUpdateStats: function() {
var self = this;
var refreshInterval = parseInt($(".js-autorefresh").val(), 10) * 1000;

if(refreshInterval > 0) {
setTimeout(function () {
self.fetchStats(self.refreshStats);
}, refreshInterval);
} else {
// Check if the option has changed again in 2 seconds
setTimeout(function () {
self.autoUpdateStats();
}, 2000);
}
}

});
Expand Down
2 changes: 1 addition & 1 deletion mrq/dashboard/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<option value="60">1m</option>
<option value="300">5m</option>
<option value="600">10m</option>
<option value="0">Disabled</option>
<option value="-1">Disabled</option>
</select></a>
</li>

Expand Down