mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
added pro routes
This commit is contained in:
parent
4966b10a0f
commit
c690d4aae8
5
src/app/routes/p_all.js
Normal file
5
src/app/routes/p_all.js
Normal file
@ -0,0 +1,5 @@
|
||||
define([
|
||||
'./p_dashboard',
|
||||
'./p_solo-panel',
|
||||
],
|
||||
function () {});
|
35
src/app/routes/p_dashboard.js
Normal file
35
src/app/routes/p_dashboard.js
Normal file
@ -0,0 +1,35 @@
|
||||
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');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
45
src/app/routes/p_solo-panel.js
Normal file
45
src/app/routes/p_solo-panel.js
Normal file
@ -0,0 +1,45 @@
|
||||
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);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user