Commit c283f099 by Torkel Ödegaard

Fixed solo panel view (used for png rendering)

parent 232f980c
...@@ -7,15 +7,14 @@ function (angular, $) { ...@@ -7,15 +7,14 @@ function (angular, $) {
var module = angular.module('grafana.routes'); var module = angular.module('grafana.routes');
module.controller('SoloPanelCtrl', function($scope, $rootScope, datasourceSrv, $routeParams, dashboardSrv, timeSrv, $location) { module.controller('SoloPanelCtrl', function($scope, backendSrv, $routeParams, dashboardSrv, timeSrv, $location, templateValuesSrv) {
var panelId; var panelId;
$scope.init = function() { $scope.init = function() {
var db = datasourceSrv.getGrafanaDB();
var params = $location.search(); var params = $location.search();
panelId = parseInt(params.panelId); panelId = parseInt(params.panelId);
db.getDashboard($routeParams.id, false) backendSrv.getDashboard($routeParams.slug)
.then(function(dashboard) { .then(function(dashboard) {
$scope.initPanelScope(dashboard); $scope.initPanelScope(dashboard);
}).then(null, function(error) { }).then(null, function(error) {
...@@ -41,12 +40,10 @@ function (angular, $) { ...@@ -41,12 +40,10 @@ function (angular, $) {
} }
$scope.panel.span = 12; $scope.panel.span = 12;
$scope.dashboardViewState = { $scope.dashboardViewState = { registerPanel: function() { }, state: {}};
registerPanel: function() {
}
};
timeSrv.init($scope.dashboard); timeSrv.init($scope.dashboard);
templateValuesSrv.init($scope.dashboard, $scope.dashboardViewState);
}; };
$scope.getPanelById = function(id) { $scope.getPanelById = function(id) {
......
...@@ -15,12 +15,12 @@ define([ ...@@ -15,12 +15,12 @@ define([
controller : 'DashFromDBProvider', controller : 'DashFromDBProvider',
reloadOnSearch: false, reloadOnSearch: false,
}) })
.when('/dashboard/db/:id', { .when('/dashboard/db/:slug', {
templateUrl: 'app/partials/dashboard.html', templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromDBProvider', controller : 'DashFromDBProvider',
reloadOnSearch: false, reloadOnSearch: false,
}) })
.when('/dashboard/import/:id', { .when('/dashboard/import/:file', {
templateUrl: 'app/partials/dashboard.html', templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromImportCtrl', controller : 'DashFromImportCtrl',
reloadOnSearch: false, reloadOnSearch: false,
...@@ -93,7 +93,7 @@ define([ ...@@ -93,7 +93,7 @@ define([
templateUrl: 'app/partials/login.html', templateUrl: 'app/partials/login.html',
controller : 'LoginCtrl', controller : 'LoginCtrl',
}) })
.when('/dashboard/solo/:id/', { .when('/dashboard/solo/:slug/', {
templateUrl: 'app/features/panel/partials/soloPanel.html', templateUrl: 'app/features/panel/partials/soloPanel.html',
controller : 'SoloPanelCtrl', controller : 'SoloPanelCtrl',
}) })
......
...@@ -9,7 +9,7 @@ function (angular) { ...@@ -9,7 +9,7 @@ function (angular) {
module.controller('DashFromDBProvider', function($scope, $routeParams, backendSrv) { module.controller('DashFromDBProvider', function($scope, $routeParams, backendSrv) {
if (!$routeParams.id) { if (!$routeParams.slug) {
backendSrv.get('/api/dashboards/home').then(function(result) { backendSrv.get('/api/dashboards/home').then(function(result) {
$scope.initDashboard(result, $scope); $scope.initDashboard(result, $scope);
},function() { },function() {
...@@ -20,7 +20,7 @@ function (angular) { ...@@ -20,7 +20,7 @@ function (angular) {
return; return;
} }
return backendSrv.get('/api/dashboards/db/' + $routeParams.id).then(function(result) { return backendSrv.getDashboard($routeParams.slug).then(function(result) {
$scope.initDashboard(result, $scope); $scope.initDashboard(result, $scope);
}, function() { }, function() {
$scope.initDashboard({ $scope.initDashboard({
......
...@@ -81,6 +81,10 @@ function (angular, _, config) { ...@@ -81,6 +81,10 @@ function (angular, _, config) {
return this.get('/api/search', query); return this.get('/api/search', query);
}; };
this.getDashboard = function(slug) {
return this.get('/api/dashboards/db/' + slug);
};
this.saveDashboard = function(dash) { this.saveDashboard = function(dash) {
return this.post('/api/dashboards/db/', {dashboard: dash}); return this.post('/api/dashboards/db/', {dashboard: dash});
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment