瀏覽代碼

Remember last dashboard

Torkel Ödegaard 11 年之前
父節點
當前提交
72974719ac

+ 1 - 1
src/app/features/grafanaDatasource/partials/query.editor.html

@@ -6,7 +6,7 @@
 
 		<p>
 		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 <strong>Add query</strong> button.
 		</p>
 	</div>

+ 0 - 4
src/app/partials/sidemenu.html

@@ -24,10 +24,6 @@
 		<i class="icon-sitemap"></i>
 		Data sources
 	</a>
-	<a class="pro-sidemenu-link" href="admin">
-		<i class="icon-tasks"></i>
-		Global options
-	</a>
 	<a class="pro-sidemenu-link" href="account">
 		<i class="icon-user"></i>
 		Account settings

+ 9 - 1
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]);