diff --git a/src/js/logs.js b/src/js/logs.js index 0043bd466..cd4410bbb 100644 --- a/src/js/logs.js +++ b/src/js/logs.js @@ -94,40 +94,47 @@ app.controller('LogsController', ['$scope', '$timeout', '$location', 'Client', f return; } - Client.refreshConfig(function (error) { + // check version and force reload if needed + if (!localStorage.version) { + localStorage.version = status.version; + } else if (localStorage.version !== status.version) { + localStorage.version = status.version; + window.location.reload(true); + } + + console.log('Running log version ', localStorage.version); + + // get user profile as the first thing. this populates the "scope" and affects subsequent API calls + Client.refreshUserInfo(function (error) { if (error) return $scope.error(error); - // check version and force reload if needed - if (!localStorage.version) { - localStorage.version = Client.getConfig().version; - } else if (localStorage.version !== Client.getConfig().version) { - localStorage.version = Client.getConfig().version; - window.location.reload(true); - } - - Client.refreshInstalledApps(function (error) { + Client.refreshConfig(function (error) { if (error) return $scope.error(error); - Client.getInstalledApps().forEach(function (app) { - $scope.logs.push({ - type: 'app', - value: app.id, - name: app.fqdn + ' (' + app.manifest.title + ')', - url: Client.makeURL('/api/v1/apps/' + app.id + '/logs'), - addons: app.manifest.addons + Client.refreshInstalledApps(function (error) { + if (error) return $scope.error(error); + + Client.getInstalledApps().forEach(function (app) { + $scope.logs.push({ + type: 'app', + value: app.id, + name: app.fqdn + ' (' + app.manifest.title + ')', + url: Client.makeURL('/api/v1/apps/' + app.id + '/logs'), + addons: app.manifest.addons + }); }); + + // activate pre-selected log from query otherwise choose the first one + $scope.selected = $scope.logs.find(function (e) { return e.value === search.id; }); + if (!$scope.selected) $scope.selected = $scope.logs[0]; + + // now mark the Client to be ready + Client.setReady(); + + $scope.initialized = true; + + showLogs(); }); - - // activate pre-selected log from query otherwise choose the first one - $scope.selected = $scope.logs.find(function (e) { return e.value === search.id; }); - if (!$scope.selected) $scope.selected = $scope.logs[0]; - - // now mark the Client to be ready - Client.setReady(); - - $scope.initialized = true; - - showLogs(); }); }); }); diff --git a/src/js/terminal.js b/src/js/terminal.js index 8dc813297..aea36932c 100644 --- a/src/js/terminal.js +++ b/src/js/terminal.js @@ -360,39 +360,46 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client return; } - Client.refreshConfig(function (error) { + // check version and force reload if needed + if (!localStorage.version) { + localStorage.version = status.version; + } else if (localStorage.version !== status.version) { + localStorage.version = status.version; + window.location.reload(true); + } + + console.log('Running terminal version ', localStorage.version); + + // get user profile as the first thing. this populates the "scope" and affects subsequent API calls + Client.refreshUserInfo(function (error) { if (error) return $scope.error(error); - // check version and force reload if needed - if (!localStorage.version) { - localStorage.version = Client.getConfig().version; - } else if (localStorage.version !== Client.getConfig().version) { - localStorage.version = Client.getConfig().version; - window.location.reload(true); - } - - Client.refreshInstalledApps(function (error) { + Client.refreshConfig(function (error) { if (error) return $scope.error(error); - Client.getInstalledApps().forEach(function (app) { - $scope.apps.push({ - type: 'app', - value: app.id, - name: app.fqdn + ' (' + app.manifest.title + ')', - addons: app.manifest.addons + Client.refreshInstalledApps(function (error) { + if (error) return $scope.error(error); + + Client.getInstalledApps().forEach(function (app) { + $scope.apps.push({ + type: 'app', + value: app.id, + name: app.fqdn + ' (' + app.manifest.title + ')', + addons: app.manifest.addons + }); }); + + // activate pre-selected log from query otherwise choose the first one + $scope.selected = $scope.apps.find(function (e) { return e.value === search.id; }); + if (!$scope.selected) $scope.selected = $scope.apps[0]; + + // now mark the Client to be ready + Client.setReady(); + + $scope.initialized = true; + + showTerminal(); }); - - // activate pre-selected log from query otherwise choose the first one - $scope.selected = $scope.apps.find(function (e) { return e.value === search.id; }); - if (!$scope.selected) $scope.selected = $scope.apps[0]; - - // now mark the Client to be ready - Client.setReady(); - - $scope.initialized = true; - - showTerminal(); }); }); });