From 276fae91582b7c1f18ff13bf3ce6ecaa157bda54 Mon Sep 17 00:00:00 2001 From: Aswath Date: Sat, 25 Mar 2023 00:55:02 +0100 Subject: [PATCH] [Vega] Add Filter custom label for opensearchDashboardsAddFilter (#3640) * [Vega] Add Filter custom label for opensearchDashboardsAddFilter Signed-off-by: Aswath Co-authored-by: Josh Romero --------- Signed-off-by: Aswath Co-authored-by: Josh Romero --- CHANGELOG.md | 1 + .../vis_type_vega/public/vega_view/vega_base_view.js | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4b13c94b8b..8599b46b811f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Region Maps] Add ui setting to configure custom vector map's size parameter([#3399](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3399)) - [Search Telemetry] Fixes search telemetry's observable object that won't be GC-ed([#3390](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3390)) - Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570)) +- [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640)) ### 🚞 Infrastructure diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js index 1286495af901..0f46e7bf9d8e 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js +++ b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js @@ -315,10 +315,15 @@ export class VegaBaseView { /** * @param {object} query Query DSL snippet, as used in the query DSL editor * @param {string} [index] as defined in OpenSearch Dashboards, or default if missing + * @param {string} alias OpenSearch Query DSL's custom label for `opensearchDashboardsAddFilter`, as used in '+ Add Filter' */ - async addFilterHandler(query, index) { + async addFilterHandler(query, index, alias) { const indexId = await this.findIndex(Utils.handleNonStringIndex(index)); - const filter = opensearchFilters.buildQueryFilter(Utils.handleInvalidQuery(query), indexId); + const filter = opensearchFilters.buildQueryFilter( + Utils.handleInvalidQuery(query), + indexId, + alias + ); this._applyFilter({ filters: [filter] }); }