diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index 61e19d6a6..f239cf315 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -68,6 +68,9 @@ $(function() { }; self.changeOffsetDialog = undefined; + // TODO: find some nicer way to update plot AFTER graph becomes visible + self.loginStateSubscription = undefined; + self.tools = ko.observableArray([]); self.hasBed = ko.observable(true); @@ -152,17 +155,25 @@ $(function() { self.settingsViewModel.printerProfiles.currentProfileData().heatedBed.subscribe(self._printerProfileUpdated); }); - self.loginState.hasPermissionKo(self.access.permissions.STATUS).subscribe(function(value) { - var graph = $("#temp, #temp_link"); - if (graph.length) { - if (value) { - graph.removeAttr("style"); - } - else { - graph.hide(); - } + // TODO: find some nicer way to update plot AFTER graph becomes visible + self.access.permissions.permissionsList.subscribe(function(values) { + if (self.loginStateSubscription !== undefined) { + self.loginStateSubscription.dispose(); + self.loginStateSubscription = undefined; } - self.updatePlot(); + + self.loginStateSubscription = self.loginState.hasPermissionKo(self.access.permissions.STATUS).subscribe(function(value) { + var graph = $("#temp, #temp_link"); + if (graph.length) { + if (value) { + graph.removeAttr("style"); + } + else { + graph.hide(); + } + } + self.updatePlot(); + }); }); self.temperatures = [];