Commit c283f099 by Torkel Ödegaard

Fixed solo panel view (used for png rendering)

parent 232f980c
......@@ -7,15 +7,14 @@ function (angular, $) {
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;
$scope.init = function() {
var db = datasourceSrv.getGrafanaDB();
var params = $location.search();
panelId = parseInt(params.panelId);
db.getDashboard($routeParams.id, false)
backendSrv.getDashboard($routeParams.slug)
.then(function(dashboard) {
$scope.initPanelScope(dashboard);
}).then(null, function(error) {
......@@ -41,12 +40,10 @@ function (angular, $) {
}
$scope.panel.span = 12;
$scope.dashboardViewState = {
registerPanel: function() {
}
};
$scope.dashboardViewState = { registerPanel: function() { }, state: {}};
timeSrv.init($scope.dashboard);
templateValuesSrv.init($scope.dashboard, $scope.dashboardViewState);
};
$scope.getPanelById = function(id) {
......
......@@ -15,12 +15,12 @@ define([
controller : 'DashFromDBProvider',
reloadOnSearch: false,
})
.when('/dashboard/db/:id', {
.when('/dashboard/db/:slug', {
templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromDBProvider',
reloadOnSearch: false,
})
.when('/dashboard/import/:id', {
.when('/dashboard/import/:file', {
templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromImportCtrl',
reloadOnSearch: false,
......@@ -93,7 +93,7 @@ define([
templateUrl: 'app/partials/login.html',
controller : 'LoginCtrl',
})
.when('/dashboard/solo/:id/', {
.when('/dashboard/solo/:slug/', {
templateUrl: 'app/features/panel/partials/soloPanel.html',
controller : 'SoloPanelCtrl',
})
......
......@@ -9,7 +9,7 @@ function (angular) {
module.controller('DashFromDBProvider', function($scope, $routeParams, backendSrv) {
if (!$routeParams.id) {
if (!$routeParams.slug) {
backendSrv.get('/api/dashboards/home').then(function(result) {
$scope.initDashboard(result, $scope);
},function() {
......@@ -20,7 +20,7 @@ function (angular) {
return;
}
return backendSrv.get('/api/dashboards/db/' + $routeParams.id).then(function(result) {
return backendSrv.getDashboard($routeParams.slug).then(function(result) {
$scope.initDashboard(result, $scope);
}, function() {
$scope.initDashboard({
......
......@@ -81,6 +81,10 @@ function (angular, _, config) {
return this.get('/api/search', query);
};
this.getDashboard = function(slug) {
return this.get('/api/dashboards/db/' + slug);
};
this.saveDashboard = function(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