Commit 631c7adf by Torkel Ödegaard

updated

parent 34ab1e52
define([
'angular',
'lodash',
],
function (angular) {
function (angular, _) {
"use strict";
var module = angular.module('grafana.routes');
module.config(function($routeProvider) {
$routeProvider
.when('/solo-panel/db/:id', {
templateUrl: 'app/partials/solo-panel.html',
.when('/dashboard/:id/panel/:panelId', {
templateUrl: 'app/partials/pro/solo-panel.html',
controller : 'SoloPanelCtrl',
});
});
......@@ -17,6 +18,7 @@ function (angular) {
module.controller('SoloPanelCtrl', function($scope, $rootScope, datasourceSrv, $routeParams, alertSrv, dashboardSrv, filterSrv) {
var db = datasourceSrv.getGrafanaDB();
var panelId = parseInt($routeParams.panelId);
db.getDashboard($routeParams.id, false)
.then(function(dashboardData) {
......@@ -33,13 +35,32 @@ function (angular) {
};
$scope.test = "Hej";
$scope.$index = 0;
$scope.panel = $scope.dashboard.rows[0].panels[0];
$scope.panel = $scope.getPanelById(panelId);
$scope.panel.span = 12;
$scope.dashboardViewState = {
registerPanel: function() {
}
};
$scope.filter = filterSrv;
$scope.filter.init($scope.dashboard);
};
$scope.getPanelById = function(id) {
var rows = $scope.dashboard.rows;
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
for (var j = 0; j < row.panels.length; j++) {
var panel = row.panels[j];
if (panel.id === id) {
return panel;
}
}
}
return null;
};
});
});
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