| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /*jshint globalstrict:true */
- /*global angular:true */
- /*
- ## filtering
- */
- 'use strict';
- angular.module('kibana.filtering', [])
- .controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
- $scope.panelMeta = {
- status : "Beta",
- description : "A controllable list of all filters currently applied to the dashboard. You "+
- "almost certainly want one of these on your dashboard somewhere."
- };
- // Set and populate defaults
- var _d = {
- };
- _.defaults($scope.panel,_d);
- $scope.init = function() {
- $scope.filterSrv = filterSrv;
- };
- $scope.remove = function(id) {
- filterSrv.remove(id);
- dashboard.refresh();
- };
- $scope.toggle = function(id) {
- filterSrv.list[id].active = !filterSrv.list[id].active;
- dashboard.refresh();
- };
- $scope.refresh = function(query) {
- $rootScope.$broadcast('refresh');
- };
- $scope.render = function(query) {
- $rootScope.$broadcast('render');
- };
- $scope.show_key = function(key) {
- return !_.contains(['type','id','alias','mandate','active','editing'],key);
- };
- $scope.isEditable = function(filter) {
- var uneditable = ['time'];
- if(_.contains(uneditable,filter.type)) {
- return false;
- } else {
- return true;
- }
- };
- });
|