From 72974719ac043509f22b3a1a121ec1a8e0ade62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 6 Jan 2015 14:15:48 +0100 Subject: [PATCH] Remember last dashboard --- .../grafanaDatasource/partials/query.editor.html | 2 +- src/app/partials/sidemenu.html | 4 ---- src/app/routes/backend/dashboard.js | 10 +++++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/features/grafanaDatasource/partials/query.editor.html b/src/app/features/grafanaDatasource/partials/query.editor.html index 032fa49e602..0d6d21d0ad2 100644 --- a/src/app/features/grafanaDatasource/partials/query.editor.html +++ b/src/app/features/grafanaDatasource/partials/query.editor.html @@ -6,7 +6,7 @@

This is just a test data source that generates random walk series. If this is your only data source - open the left side menu and goto data sources admin screen and add your data sources. You can change + open the left side menu and navigate to the data sources admin screen and add your data sources. You can change data source using the button to the left of the Add query button.

diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html index e7a2b6972f4..7b286fb4f60 100644 --- a/src/app/partials/sidemenu.html +++ b/src/app/partials/sidemenu.html @@ -24,10 +24,6 @@ Data sources - - - Global options - Account settings diff --git a/src/app/routes/backend/dashboard.js b/src/app/routes/backend/dashboard.js index 6672296072d..23903a84721 100644 --- a/src/app/routes/backend/dashboard.js +++ b/src/app/routes/backend/dashboard.js @@ -33,6 +33,9 @@ function (angular, store) { }); }); + // remember previous dashboard + var prevDashPath = null; + module.controller('DashFromDBProvider', function( $scope, $rootScope, datasourceSrv, $routeParams, alertSrv, $http, $location) { @@ -41,8 +44,12 @@ function (angular, store) { var isTemp = window.location.href.indexOf('dashboard/temp') !== -1; if (!$routeParams.id) { - var savedRoute = store.get('grafanaDashboardDefault'); + // do we have a previous dash + if (prevDashPath) { + $location.path(prevDashPath); + } + var savedRoute = store.get('grafanaDashboardDefault'); if (!savedRoute) { $http.get("app/dashboards/default.json?" + new Date().getTime()).then(function(result) { var dashboard = angular.fromJson(result.data); @@ -61,6 +68,7 @@ function (angular, store) { db.getDashboard($routeParams.id, isTemp) .then(function(dashboard) { + prevDashPath = $location.path(); $scope.initDashboard(dashboard, $scope); }).then(null, function(err) { $scope.appEvent('alert-error', ['Load dashboard failed', err]);