solo_panel_ctrl.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. define([
  2. 'angular',
  3. 'jquery',
  4. ],
  5. function (angular, $) {
  6. "use strict";
  7. var module = angular.module('grafana.routes');
  8. module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
  9. var panelId;
  10. $scope.init = function() {
  11. contextSrv.sidemenu = false;
  12. var params = $location.search();
  13. panelId = parseInt(params.panelId);
  14. dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
  15. $scope.initDashboard(result, $scope);
  16. });
  17. $scope.onAppEvent("dashboard-loaded", $scope.initPanelScope);
  18. };
  19. $scope.initPanelScope = function() {
  20. $scope.row = {
  21. height: $(window).height() + 'px',
  22. };
  23. $scope.test = "Hej";
  24. $scope.$index = 0;
  25. $scope.panel = $scope.dashboard.getPanelById(panelId);
  26. if (!$scope.panel) {
  27. $scope.appEvent('alert-error', ['Panel not found', '']);
  28. return;
  29. }
  30. $scope.panel.span = 12;
  31. $scope.dashboardViewState = {registerPanel: function() { }, state: {}};
  32. };
  33. if (!$scope.skipAutoInit) {
  34. $scope.init();
  35. }
  36. });
  37. });