grafana/public/app/features/panel/soloPanelCtrl.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-08-12 05:19:33 -05:00
define([
'angular',
2014-10-01 13:02:42 -05:00
'jquery',
2014-08-12 05:19:33 -05:00
],
2014-10-01 13:02:42 -05:00
function (angular, $) {
2014-08-12 05:19:33 -05:00
"use strict";
var module = angular.module('grafana.routes');
2015-05-12 12:24:11 -05:00
module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
2014-10-01 04:27:58 -05:00
var panelId;
2014-08-12 05:19:33 -05:00
2014-10-01 04:27:58 -05:00
$scope.init = function() {
contextSrv.sidemenu = false;
2014-10-01 13:02:42 -05:00
var params = $location.search();
panelId = parseInt(params.panelId);
2014-08-12 05:19:33 -05:00
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
$scope.initDashboard(result, $scope);
});
2014-08-12 05:19:33 -05:00
$scope.onAppEvent("dashboard-loaded", $scope.initPanelScope);
};
$scope.initPanelScope = function() {
2014-08-12 05:19:33 -05:00
$scope.row = {
height: ($(window).height() - 10) + 'px',
2014-08-12 05:19:33 -05:00
};
2014-08-12 05:19:33 -05:00
$scope.test = "Hej";
$scope.$index = 0;
$scope.panel = $scope.dashboard.getPanelById(panelId);
2014-08-17 05:26:00 -05:00
2014-10-01 04:27:58 -05:00
if (!$scope.panel) {
$scope.appEvent('alert-error', ['Panel not found', '']);
return;
}
2014-08-12 05:19:33 -05:00
$scope.panel.span = 12;
2015-05-12 12:24:11 -05:00
$scope.dashboardViewState = {registerPanel: function() { }, state: {}};
2014-08-12 05:19:33 -05:00
};
2014-10-01 04:27:58 -05:00
if (!$scope.skipAutoInit) {
$scope.init();
}
2014-08-12 05:19:33 -05:00
});
});