Skip to content

Commit

Permalink
[Vega] Add Filter custom label for opensearchDashboardsAddFilter (#3640)
Browse files Browse the repository at this point in the history
* [Vega] Add Filter custom label for opensearchDashboardsAddFilter

Signed-off-by: Aswath <[email protected]>

Co-authored-by: Josh Romero <[email protected]>

---------

Signed-off-by: Aswath <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
  • Loading branch information
aswath86 and joshuarrrr authored Mar 24, 2023
1 parent 2de11ff commit 276fae9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions src/plugins/vis_type_vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
}

Expand Down

0 comments on commit 276fae9

Please sign in to comment.