module.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*jshint globalstrict:true */
  2. /*global angular:true */
  3. /*
  4. ## filtering
  5. */
  6. 'use strict';
  7. angular.module('kibana.filtering', [])
  8. .controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
  9. $scope.panelMeta = {
  10. status : "Beta",
  11. description : "A controllable list of all filters currently applied to the dashboard. You "+
  12. "almost certainly want one of these on your dashboard somewhere."
  13. };
  14. // Set and populate defaults
  15. var _d = {
  16. };
  17. _.defaults($scope.panel,_d);
  18. $scope.init = function() {
  19. $scope.filterSrv = filterSrv;
  20. };
  21. $scope.remove = function(id) {
  22. filterSrv.remove(id);
  23. dashboard.refresh();
  24. };
  25. $scope.toggle = function(id) {
  26. filterSrv.list[id].active = !filterSrv.list[id].active;
  27. dashboard.refresh();
  28. };
  29. $scope.refresh = function(query) {
  30. $rootScope.$broadcast('refresh');
  31. };
  32. $scope.render = function(query) {
  33. $rootScope.$broadcast('render');
  34. };
  35. $scope.show_key = function(key) {
  36. return !_.contains(['type','id','alias','mandate','active','editing'],key);
  37. };
  38. $scope.isEditable = function(filter) {
  39. var uneditable = ['time'];
  40. if(_.contains(uneditable,filter.type)) {
  41. return false;
  42. } else {
  43. return true;
  44. }
  45. };
  46. });