File tree Expand file tree Collapse file tree 4 files changed +39
-35
lines changed Expand file tree Collapse file tree 4 files changed +39
-35
lines changed Original file line number Diff line number Diff line change 1+ // This file is used by Timelion and TSVB
2+ import _ from 'lodash' ;
3+ import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter' ;
4+ import 'ui/state_management/app_state' ;
5+
6+ export function dashboardContextProvider ( Private , getAppState ) {
7+ return ( ) => {
8+ const queryFilter = Private ( FilterBarQueryFilterProvider ) ;
9+ const bool = { must : [ ] , must_not : [ ] } ;
10+ const filterBarFilters = queryFilter . getFilters ( ) ;
11+ const queryBarFilter = getAppState ( ) . query ;
12+
13+ // Add the query bar filter, its handled differently.
14+ bool . must . push ( queryBarFilter ) ;
15+
16+ // Add each of the filter bar filters
17+ _ . each ( filterBarFilters , function ( filter ) {
18+ const esFilter = _ . omit ( filter , function ( val , key ) {
19+ if ( key === 'meta' || key [ 0 ] === '$' ) return true ;
20+ return false ;
21+ } ) ;
22+
23+ if ( filter . meta . disabled ) return ;
24+ if ( filter . meta . negate ) {
25+ bool . must_not = bool . must_not || [ ] ;
26+ bool . must_not . push ( esFilter . query || esFilter ) ;
27+ } else {
28+ bool . must = bool . must || [ ] ;
29+ bool . must . push ( esFilter . query || esFilter ) ;
30+ }
31+ } ) ;
32+
33+ return { bool : bool } ;
34+ } ;
35+ }
Original file line number Diff line number Diff line change 11import { validateInterval } from './validate_interval' ;
2+ import { dashboardContextProvider } from 'plugins/kibana/dashboard/dashboard_context' ;
23export default (
34 timefilter ,
45 Private ,
56 Notifier ,
67 $http ,
7- config
8+ config ,
89) => {
9- const dashboardContext = Private ( require ( '../../../timelion/public/services/dashboard_context' ) ) ;
10+ const dashboardContext = Private ( dashboardContextProvider ) ;
1011 const notify = new Notifier ( { location : 'Metrics' } ) ;
1112 return $scope => ( ) => {
1213 const panel = $scope . model ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import _ from 'lodash';
22import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter' ;
33import { uiModules } from 'ui/modules' ;
44import timezoneProvider from 'plugins/timelion/services/timezone' ;
5- import dashboardContextProvider from 'plugins/timelion/services /dashboard_context' ;
5+ import { dashboardContextProvider } from 'plugins/kibana/dashboard /dashboard_context' ;
66import 'plugins/timelion/directives/chart/chart' ;
77import 'plugins/timelion/directives/timelion_interval/timelion_interval' ;
88import 'ui/state_management/app_state' ;
You can’t perform that action at this time.
0 commit comments