Added Pause/Continue and Refresh-on-demand.
This commit is contained in:
parent
1ea1d7d75f
commit
563edb4f5d
@ -30,6 +30,12 @@
|
|||||||
<section id=priorities>
|
<section id=priorities>
|
||||||
<h3>Next Actions (unsorted)</h3>
|
<h3>Next Actions (unsorted)</h3>
|
||||||
</section>
|
</section>
|
||||||
|
<section id=main-buttons>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#" class=pause-continue>Pause Monitoring</a></li>
|
||||||
|
<li><a href="#" class=refresh>Refresh Now</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
<section id=config-dialog>
|
<section id=config-dialog>
|
||||||
<form>
|
<form>
|
||||||
<h3>Configuration</h3>
|
<h3>Configuration</h3>
|
||||||
@ -63,7 +69,7 @@
|
|||||||
<div class=button-panel>
|
<div class=button-panel>
|
||||||
<div class=global-config>
|
<div class=global-config>
|
||||||
<label>Refresh (sec): </label>
|
<label>Refresh (sec): </label>
|
||||||
<input type=text class=refresh></div>
|
<input type=text class=refresh-period></div>
|
||||||
<div class=save-button><a href="#">Save and Close</a></div>
|
<div class=save-button><a href="#">Save and Close</a></div>
|
||||||
</div>
|
</div>
|
||||||
<div class=wait-overlay><img src="img/loading-spinner.gif"><br><span></span></div>
|
<div class=wait-overlay><img src="img/loading-spinner.gif"><br><span></span></div>
|
||||||
|
@ -146,7 +146,7 @@
|
|||||||
$(".category-name").parent().remove();
|
$(".category-name").parent().remove();
|
||||||
_.forEach(PD.gtdCfg.categories, this.makeCategoryItem); }
|
_.forEach(PD.gtdCfg.categories, this.makeCategoryItem); }
|
||||||
|
|
||||||
this.$el.find('.refresh').val(
|
this.$el.find('.refresh-period').val(
|
||||||
PD.refreshPeriod ? PD.refreshPeriod / 1000 : 15);
|
PD.refreshPeriod ? PD.refreshPeriod / 1000 : 15);
|
||||||
|
|
||||||
this.$el.fadeIn(); },
|
this.$el.fadeIn(); },
|
||||||
@ -322,7 +322,7 @@
|
|||||||
function(span) { return $(span).text(); });
|
function(span) { return $(span).text(); });
|
||||||
|
|
||||||
// Save global data
|
// Save global data
|
||||||
PD.refreshPeriod = parseInt(this.$el.find(".refresh").val()) * 1000;
|
PD.refreshPeriod = parseInt(this.$el.find(".refresh-period").val()) * 1000;
|
||||||
|
|
||||||
if (PD.hasHTML5LocalStorage()) {
|
if (PD.hasHTML5LocalStorage()) {
|
||||||
localStorage.setItem("tsCfg", JSON.stringify(PD.tsCfg));
|
localStorage.setItem("tsCfg", JSON.stringify(PD.tsCfg));
|
||||||
@ -337,9 +337,13 @@
|
|||||||
PD.Main = Backbone.View.extend({
|
PD.Main = Backbone.View.extend({
|
||||||
el: $("body"),
|
el: $("body"),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
"click a.refresh" : "refresh"
|
||||||
|
"click a.pause-continue" : "toggleSync" },
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
||||||
_.bindAll(this, "refresh");
|
_.bindAll(this, "refresh", "toggleSync");
|
||||||
|
|
||||||
// Create our config dialog view.
|
// Create our config dialog view.
|
||||||
PD.configDialog = new PD.ConfigDialog();
|
PD.configDialog = new PD.ConfigDialog();
|
||||||
@ -366,7 +370,7 @@
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
||||||
// Schedule future refreshes.
|
// Schedule future refreshes.
|
||||||
setInterval(this.refresh, PD.refreshPeriod ? PD.refreshPeriod : 15000);
|
PD.refreshIntervalId = setInterval(this.refresh, PD.refreshPeriod ? PD.refreshPeriod : 15000);
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
@ -492,7 +496,17 @@
|
|||||||
collection.remove(model); }});
|
collection.remove(model); }});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
toggleSync: function() {
|
||||||
|
if (PD.refreshIntervalId == null) {
|
||||||
|
PD.refreshIntervalId = setInterval(this.refresh,
|
||||||
|
PD.refreshPeriod ? PD.refreshPeriod : 15000);
|
||||||
|
$('.pause-continue').text('Pause Monitoring'); }
|
||||||
|
else {
|
||||||
|
clearInterval(PD.refreshIntervalId);
|
||||||
|
PD.refreshIntervalId = null;
|
||||||
|
$('.pause-continue').text('Resume Monitoring'); } }
|
||||||
});
|
});
|
||||||
|
|
||||||
PD.main = new PD.Main();
|
PD.main = new PD.Main();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user