Commit c690d4aa by Torkel Ödegaard

added pro routes

parent 4966b10a
define([
'./p_dashboard',
'./p_solo-panel',
],
function () {});
define([
'angular',
],
function (angular) {
"use strict";
var module = angular.module('grafana.routes');
module.config(function($routeProvider) {
$routeProvider
.when('/dashboard/db/:id', {
templateUrl: '/app/partials/dashboard.html',
controller : 'DashFromDBProvider',
})
.when('/dashboard/temp/:id', {
templateUrl: '/app/partials/dashboard.html',
controller : 'DashFromDBProvider',
});
});
module.controller('DashFromDBProvider', function($scope, $rootScope, datasourceSrv, $routeParams, alertSrv) {
var db = datasourceSrv.getGrafanaDB();
var isTemp = window.location.href.indexOf('dashboard/temp') !== -1;
db.getDashboard($routeParams.id, isTemp)
.then(function(dashboard) {
$scope.emitAppEvent('setup-dashboard', dashboard);
}).then(null, function(error) {
alertSrv.set('Error', error, 'error');
});
});
});
define([
'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',
controller : 'SoloPanelCtrl',
});
});
module.controller('SoloPanelCtrl', function($scope, $rootScope, datasourceSrv, $routeParams, alertSrv, dashboardSrv, filterSrv) {
var db = datasourceSrv.getGrafanaDB();
db.getDashboard($routeParams.id, false)
.then(function(dashboardData) {
$scope.initPanelScope(dashboardData);
}).then(null, function(error) {
alertSrv.set('Error', error, 'error');
});
$scope.initPanelScope = function(dashboardData) {
$scope.dashboard = dashboardSrv.create(dashboardData);
$scope.grafana.style = $scope.dashboard.style;
$scope.row = {
height: '300px',
};
$scope.test = "Hej";
$scope.$index = 0;
$scope.panel = $scope.dashboard.rows[0].panels[0];
$scope.panel.span = 12;
$scope.filter = filterSrv;
$scope.filter.init($scope.dashboard);
};
});
});
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