solo_panel_ctrl.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. $scope.onAppEvent("dashboard-initialized", $scope.initPanelScope);
  15. dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
  16. result.meta.soloMode = true;
  17. $scope.initDashboard(result, $scope);
  18. });
  19. };
  20. $scope.initPanelScope = function() {
  21. $scope.row = {
  22. height: $(window).height() + 'px',
  23. };
  24. $scope.test = "Hej";
  25. $scope.$index = 0;
  26. $scope.panel = $scope.dashboard.getPanelById(panelId);
  27. if (!$scope.panel) {
  28. $scope.appEvent('alert-error', ['Panel not found', '']);
  29. return;
  30. }
  31. $scope.panel.span = 12;
  32. };
  33. $scope.init();
  34. });
  35. });