On reconnect to server, check if the version changed and if so hard-reload the UI
This commit is contained in:
parent
9c2b42caa2
commit
f3f640c24f
1 changed files with 11 additions and 1 deletions
|
|
@ -105,6 +105,7 @@ function DataUpdater(allViewModels) {
|
|||
headers: {"X-Api-Key": UI_API_KEY}
|
||||
});
|
||||
|
||||
var oldVersion = VERSION;
|
||||
VERSION = data["version"];
|
||||
DISPLAY_VERSION = data["display_version"];
|
||||
$("span.version").text(DISPLAY_VERSION);
|
||||
|
|
@ -122,6 +123,15 @@ function DataUpdater(allViewModels) {
|
|||
}
|
||||
}
|
||||
|
||||
if (oldVersion != VERSION) {
|
||||
// version change detected, force reloading UI - use randomized delay to reduce server load in
|
||||
// the case of multiple clients
|
||||
var delay = Math.floor(Math.random() * 5) + 1;
|
||||
setTimeout(function() {location.reload(true);}, delay * 1000);
|
||||
|
||||
// TODO notify about that, or show confirmation
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case "history": {
|
||||
|
|
@ -175,7 +185,7 @@ function DataUpdater(allViewModels) {
|
|||
new PNotify({title: gettext("Timelapse ready"), text: _.sprintf(gettext("New timelapse %(movie_basename)s is done rendering."), payload)});
|
||||
timelapseViewModel.requestData();
|
||||
} else if (type == "MovieFailed") {
|
||||
html = "<p>" + _.sprintf(gettext("Rendering of timelapse %(movie_basename)s failedwith return code %(returncode)s"), payload) + "</p>";
|
||||
html = "<p>" + _.sprintf(gettext("Rendering of timelapse %(movie_basename)s failed with return code %(returncode)s"), payload) + "</p>";
|
||||
html += pnotifyAdditionalInfo('<pre style="overflow: auto">' + payload.error + '</pre>');
|
||||
new PNotify({title: gettext("Rendering failed"), text: html, type: "error", hide: false});
|
||||
} else if (type == "SlicingStarted") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue