From 052408982a802b1299437a9ab47da028c6b7e4ac Mon Sep 17 00:00:00 2001 From: Marc Hannappel Date: Wed, 25 Oct 2017 15:11:53 +0200 Subject: [PATCH] Revert "Some Changed to the temperature.js file" This reverts commit ce2463588d052002affa4d1e8eefb631f4cd1a6d. --- .../static/js/app/viewmodels/temperature.js | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) 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 = [];