[TSVB] Support triggers only for timeseries chart (#100323)

* [TSVB] Support triggers only for timeseries chart

* fix the type

* Fix type falure

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Stratoula Kalafateli 2021-05-27 16:18:15 +03:00 committed by GitHub
parent 11b3ab167d
commit 7cfa0d2b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

@ -74,8 +74,11 @@ export const metricsVisDefinition = {
showIndexSelection: false,
},
toExpressionAst,
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
getSupportedTriggers: (params?: VisParams) => {
if (params?.type === PANEL_TYPES.TIMESERIES) {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
}
return [];
},
inspectorAdapters: {},
getUsedIndexPattern: async (params: VisParams) => {

View file

@ -420,7 +420,7 @@ export class VisualizeEmbeddable
};
public supportedTriggers(): string[] {
return this.vis.type.getSupportedTriggers?.() ?? [];
return this.vis.type.getSupportedTriggers?.(this.vis.params) ?? [];
}
inputIsRefType = (input: VisualizeInput): input is VisualizeByReferenceInput => {

View file

@ -91,7 +91,7 @@ export interface VisTypeDefinition<TVisParams> {
/**
* If given, it will return the supported triggers for this vis.
*/
readonly getSupportedTriggers?: () => string[];
readonly getSupportedTriggers?: (params?: VisParams) => string[];
/**
* Some visualizations are created without SearchSource and may change the used indexes during the visualization configuration.