File tree Expand file tree Collapse file tree 5 files changed +23
-13
lines changed
embeddable/public/lib/embeddables
visualizations/public/embeddable
x-pack/plugins/discover_enhanced/public/actions/explore_data Expand file tree Collapse file tree 5 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { Adapters } from '../types';
2222import { IContainer } from '../containers/i_container' ;
2323import { ViewMode } from '../types' ;
2424import { TriggerContextMapping } from '../../../../ui_actions/public' ;
25+ import type { TimeRange , Query , Filter } from '../../../../data/common' ;
2526
2627export interface EmbeddableError {
2728 name : string ;
@@ -55,6 +56,21 @@ export interface EmbeddableInput {
5556 */
5657 disableTriggers ?: boolean ;
5758
59+ /**
60+ * Time range of the chart.
61+ */
62+ timeRange ?: TimeRange ;
63+
64+ /**
65+ * Visualization query string used to narrow down results.
66+ */
67+ query ?: Query ;
68+
69+ /**
70+ * Visualization filters used to narrow down results.
71+ */
72+ filters ?: Filter [ ] ;
73+
5874 [ key : string ] : unknown ;
5975}
6076
Original file line number Diff line number Diff line change @@ -60,9 +60,6 @@ export interface VisualizeEmbeddableConfiguration {
6060}
6161
6262export interface VisualizeInput extends EmbeddableInput {
63- timeRange ?: TimeRange ;
64- query ?: Query ;
65- filters ?: Filter [ ] ;
6663 vis ?: {
6764 colors ?: { [ key : string ] : string } ;
6865 } ;
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export abstract class AbstractExploreDataAction<Context extends { embeddable?: I
5959
6060 if ( ! shared . hasExactlyOneIndexPattern ( embeddable ) ) return false ;
6161 if ( embeddable . getInput ( ) . viewMode !== ViewMode . VIEW ) return false ;
62+
6263 return true ;
6364 }
6465
Original file line number Diff line number Diff line change 77import { Action } from '../../../../../../src/plugins/ui_actions/public' ;
88import { DiscoverUrlGeneratorState } from '../../../../../../src/plugins/discover/public' ;
99import {
10- isTimeRange ,
11- isQuery ,
12- isFilters ,
1310 ApplyGlobalFilterActionContext ,
1411 esFilters ,
1512} from '../../../../../../src/plugins/data/public' ;
@@ -64,9 +61,9 @@ export class ExploreDataChartAction extends AbstractExploreDataAction<ExploreDat
6461
6562 const input = embeddable . getInput ( ) ;
6663
67- if ( isTimeRange ( input . timeRange ) && ! state . timeRange ) state . timeRange = input . timeRange ;
68- if ( isQuery ( input . query ) ) state . query = input . query ;
69- if ( isFilters ( input . filters ) ) state . filters = [ ...input . filters , ...( state . filters || [ ] ) ] ;
64+ if ( input . timeRange && ! state . timeRange ) state . timeRange = input . timeRange ;
65+ if ( input . query ) state . query = input . query ;
66+ if ( input . filters ) state . filters = [ ...input . filters , ...( state . filters || [ ] ) ] ;
7067 }
7168
7269 const path = await urlGenerator . createUrl ( state ) ;
Original file line number Diff line number Diff line change 77import { Action } from '../../../../../../src/plugins/ui_actions/public' ;
88import { EmbeddableContext } from '../../../../../../src/plugins/embeddable/public' ;
99import { DiscoverUrlGeneratorState } from '../../../../../../src/plugins/discover/public' ;
10- import { isTimeRange , isQuery , isFilters } from '../../../../../../src/plugins/data/public' ;
1110import { KibanaURL } from './kibana_url' ;
1211import * as shared from './shared' ;
1312import { AbstractExploreDataAction } from './abstract_explore_data_action' ;
@@ -42,9 +41,9 @@ export class ExploreDataContextMenuAction extends AbstractExploreDataAction<Embe
4241
4342 const input = embeddable . getInput ( ) ;
4443
45- if ( isTimeRange ( input . timeRange ) && ! state . timeRange ) state . timeRange = input . timeRange ;
46- if ( isQuery ( input . query ) ) state . query = input . query ;
47- if ( isFilters ( input . filters ) ) state . filters = [ ...input . filters , ...( state . filters || [ ] ) ] ;
44+ if ( input . timeRange && ! state . timeRange ) state . timeRange = input . timeRange ;
45+ if ( input . query ) state . query = input . query ;
46+ if ( input . filters ) state . filters = [ ...input . filters , ...( state . filters || [ ] ) ] ;
4847 }
4948
5049 const path = await urlGenerator . createUrl ( state ) ;
You can’t perform that action at this time.
0 commit comments