pulldown.js 913 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. define([
  2. 'angular',
  3. 'app',
  4. 'lodash'
  5. ],
  6. function (angular, app, _) {
  7. 'use strict';
  8. var module = angular.module('grafana.controllers');
  9. module.controller('PulldownCtrl', function($scope, $rootScope, $timeout) {
  10. var _d = {
  11. collapse: false,
  12. notice: false,
  13. enable: true
  14. };
  15. _.defaults($scope.pulldown,_d);
  16. $scope.init = function() {
  17. // Provide a combined skeleton for panels that must interact with panel and row.
  18. // This might create name spacing issues.
  19. $scope.panel = $scope.pulldown;
  20. $scope.row = $scope.pulldown;
  21. };
  22. $scope.toggle_pulldown = function(pulldown) {
  23. pulldown.collapse = pulldown.collapse ? false : true;
  24. if (!pulldown.collapse) {
  25. $timeout(function() {
  26. $scope.$broadcast('render');
  27. });
  28. } else {
  29. $scope.row.notice = false;
  30. }
  31. };
  32. $scope.init();
  33. });
  34. });