Skip to content

Commit a3a5af4

Browse files
committed
Added page timeout notifier on control page
1 parent 75677c8 commit a3a5af4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

control/templates/control/controlPanelNew.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ <h3>Muon Veto</h3>
391391
var display_counter=0;
392392
document.superman = "nobody";
393393

394+
// Check if page timed out with this one
395+
var pageTimeoutTimer = 0;
396+
394397
// The progress bar update for page refresh
395398

396399
var pageupdatebar = new ProgressBar.Circle("#updatebar", {
@@ -403,6 +406,14 @@ <h3>Muon Veto</h3>
403406
svgStyle: null
404407
});
405408

409+
function PageTimeoutCounter(){
410+
if(pageTimeoutTimer > 60){
411+
alert("Page has not updated for 60 seconds. You probably have a stale tab. Please refresh your browser.");
412+
return;
413+
}
414+
pageTimeoutTimer += 5;
415+
setTimeout(function(){ PageTimeoutCounter();}, 5000);
416+
};
406417
// Update function for the run start messages
407418
function FeedbackLoop(){
408419
$.getJSON(feedbackURL, function(data){
@@ -487,6 +498,7 @@ <h3>Muon Veto</h3>
487498

488499
}
489500
function UpdatePage( thechart ){
501+
490502
$.getJSON(currentShifterUrl, function(data){
491503
document.superman = data['starting_user'];
492504
document.canstartruns = false;
@@ -504,7 +516,8 @@ <h3>Muon Veto</h3>
504516
ResizeDetailWindows();
505517
ResizeTriggerWindow();
506518

507-
var updatecounter=0;
519+
var updatecounter=0;
520+
pageTimeoutTimer = 0;
508521
FeedbackLoop();
509522

510523
timerLoop(updatecounter, thechart);
@@ -622,6 +635,7 @@ <h3>Muon Veto</h3>
622635
}
623636

624637
$(function(){ //DOM Ready
638+
PageTimeoutCounter();
625639
document.autoplay=false;
626640
// Save some info from template tags
627641
document.user = "{{ request.user.username }}";

0 commit comments

Comments
 (0)