From ec99096d523d5c42856ecf681ea6c9317d8d8c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 13 Aug 2014 07:47:36 +0200 Subject: [PATCH] experimenting with url and dashboard state --- src/app/controllers/dash.js | 9 +-------- src/app/routes/dashboard-from-db.js | 3 ++- src/app/services/panelSrv.js | 3 ++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/app/controllers/dash.js b/src/app/controllers/dash.js index 83a2a0b3b2d..2ea23e46889 100644 --- a/src/app/controllers/dash.js +++ b/src/app/controllers/dash.js @@ -8,10 +8,7 @@ define([ function (angular, $, config, _) { "use strict"; - var module = angular.module('grafana.controllers'); - - module.controller('DashCtrl', function( - $scope, $rootScope, dashboardKeybindings, filterSrv, dashboardSrv, panelMoveSrv, timer) { + module.controller('DashCtrl', function($scope, $rootScope, dashboardKeybindings, filterSrv, dashboardSrv, panelMoveSrv, timer) { $scope.editor = { index: 0 }; $scope.panelNames = config.panels; @@ -49,10 +46,6 @@ function (angular, $, config, _) { dashboardKeybindings.shortcuts($scope); - if ($scope.dashboard.$state.panelId) { - $rootScope.fullscreen = true; - } - $scope.emitAppEvent("dashboard-loaded", $scope.dashboard); }; diff --git a/src/app/routes/dashboard-from-db.js b/src/app/routes/dashboard-from-db.js index 3882c7ca65c..d10de12939d 100644 --- a/src/app/routes/dashboard-from-db.js +++ b/src/app/routes/dashboard-from-db.js @@ -8,9 +8,10 @@ function (angular) { module.config(function($routeProvider) { $routeProvider - .when('/dashboard/db/:id/:panelId?', { + .when('/dashboard/db/:id', { templateUrl: 'app/partials/dashboard.html', controller : 'DashFromDBProvider', + reloadOnSearch: false, }) .when('/dashboard/elasticsearch/:id', { templateUrl: 'app/partials/dashboard.html', diff --git a/src/app/services/panelSrv.js b/src/app/services/panelSrv.js index c43cf1a89f4..c4d18fdd2e8 100644 --- a/src/app/services/panelSrv.js +++ b/src/app/services/panelSrv.js @@ -7,7 +7,7 @@ function (angular, _, $) { 'use strict'; var module = angular.module('grafana.services'); - module.service('panelSrv', function($rootScope, $timeout, datasourceSrv) { + module.service('panelSrv', function($rootScope, $timeout, datasourceSrv, $location) { this.init = function($scope) { if (!$scope.panel.span) { @@ -106,6 +106,7 @@ function (angular, _, $) { $rootScope.$emit('panel-fullscreen-enter'); $timeout(function() { + $location.search({panelId: $scope.panel.id, mode: $scope.editMode ? 'edit' : 'full' }); $scope.$emit('render'); });