Files
grafana/public/app/features/panel/solo_panel_ctrl.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-08-12 12:19:33 +02:00
define([
'angular',
2014-10-01 20:02:42 +02:00
'jquery',
2014-08-12 12:19:33 +02:00
],
2014-10-01 20:02:42 +02:00
function (angular, $) {
2014-08-12 12:19:33 +02:00
"use strict";
var module = angular.module('grafana.routes');
2015-05-12 19:24:11 +02:00
module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
2014-10-01 11:27:58 +02:00
var panelId;
2014-08-12 12:19:33 +02:00
2014-10-01 11:27:58 +02:00
$scope.init = function() {
contextSrv.sidemenu = false;
2014-10-01 20:02:42 +02:00
var params = $location.search();
panelId = parseInt(params.panelId);
2014-08-12 12:19:33 +02:00
$scope.onAppEvent("dashboard-initialized", $scope.initPanelScope);
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
result.meta.soloMode = true;
$scope.initDashboard(result, $scope);
});
};
$scope.initPanelScope = function() {
2016-11-06 15:40:02 +01:00
var panelInfo = $scope.dashboard.getPanelInfoById(panelId);
// fake row ctrl scope
$scope.ctrl = {
row: panelInfo.row,
dashboard: $scope.dashboard,
2014-08-12 12:19:33 +02:00
};
2016-11-06 15:40:02 +01:00
$scope.ctrl.row.height = $(window).height();
$scope.panel = panelInfo.panel;
2014-08-12 12:19:33 +02:00
$scope.$index = 0;
2014-08-17 12:26:00 +02:00
2014-10-01 11:27:58 +02:00
if (!$scope.panel) {
$scope.appEvent('alert-error', ['Panel not found', '']);
return;
}
2014-08-12 12:19:33 +02:00
$scope.panel.span = 12;
};
2016-01-28 18:05:49 -05:00
$scope.init();
2014-08-12 12:19:33 +02:00
});
});