Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vega] Filter bar in Vega is not usable with non default index pattern. #84090

Merged
merged 27 commits into from
Dec 1, 2020

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Nov 23, 2020

Closes: #81738, Closes: #62122, Closes: #56833, Closes: #19408

Summary

Describe the bug: Filter bar in Vega is not usable with non default index pattern.

Steps to reproduce:

  • Create a dashboard with only vega viz ( non default index pattern should be used)
  • Click on add filter

Expected behavior:
The fields should be filled with values from the index pattern used in Vega visualization.

image

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@alexwizp alexwizp self-assigned this Nov 25, 2020
@alexwizp alexwizp added v7.11.0 v8.0.0 Feature:Vega Vega visualizations Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:fix labels Nov 25, 2020
@alexwizp alexwizp marked this pull request as ready for review November 25, 2020 14:21
@alexwizp alexwizp requested a review from a team November 25, 2020 14:21
@alexwizp alexwizp requested a review from a team as a code owner November 25, 2020 14:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

const asyncSetIndexPattern = async () => {
let index: IndexPattern | null = null;

if (vis.type.getUsedIndexPattern) {
Copy link
Contributor Author

@alexwizp alexwizp Nov 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppisljar maybe we should rethink that comment #82964 (comment) and move getUsedIndexPattern into vis.ts? Now we know that we need that code at least from 2 different places.

It also seems to me not entirely correct to use such hooks and set the default index pattern in this place.I think that instead of undefined vis.ts should return the default index for vis.data.indexPattern

@ppisljar
Copy link
Member

@mattkime can you please take a look at this one ?

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

* @returns {Promise<SavedObject|undefined>}
*/
findByTitle = async (title: string, refresh: boolean = false) => {
if (!this.savedObjectsCache || refresh) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could rely on getIdsWithTitle, filter based on the result, and then get

Lets call this getByTitle

# Conflicts:
#	docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
#	src/plugins/data/public/public.api.md
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
visTypeVega 92 93 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
visTypeVega 1.5MB 1.5MB +1.4KB
visualize 126.3KB 127.6KB +1.3KB
total +2.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 974.3KB 974.2KB -99.0B
visTypeTimeseries 137.9KB 137.5KB -370.0B
visTypeVega 57.7KB 60.5KB +2.8KB
total +2.4KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alexwizp alexwizp merged commit d4c02bb into elastic:master Dec 1, 2020
alexwizp added a commit to alexwizp/kibana that referenced this pull request Dec 1, 2020
…n. (elastic#84090)

* [Vega] Filtering is not working

Closes: elastic#81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
alexwizp added a commit that referenced this pull request Dec 1, 2020
…n. (#84090) (#84607)

* [Vega] Filtering is not working

Closes: #81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
alexwizp added a commit to alexwizp/kibana that referenced this pull request Dec 18, 2020
…n. (elastic#84090)

* [Vega] Filtering is not working

Closes: elastic#81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/plugins/vis_type_vega/public/vega_type.ts
#	src/plugins/vis_type_vega/public/vega_visualization.test.js
#	src/plugins/vis_type_vega/public/vega_visualization.ts
alexwizp added a commit to alexwizp/kibana that referenced this pull request Dec 18, 2020
…n. (elastic#84090)

* [Vega] Filtering is not working

Closes: elastic#81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/plugins/vis_type_vega/public/vega_type.ts
#	src/plugins/vis_type_vega/public/vega_visualization.test.js
#	src/plugins/vis_type_vega/public/vega_visualization.ts
alexwizp added a commit to alexwizp/kibana that referenced this pull request Dec 20, 2020
…n. (elastic#84090)

* [Vega] Filtering is not working

Closes: elastic#81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/plugins/vis_type_vega/public/vega_type.ts
#	src/plugins/vis_type_vega/public/vega_visualization.test.js
#	src/plugins/vis_type_vega/public/vega_visualization.ts
alexwizp added a commit that referenced this pull request Dec 21, 2020
…n. (#84090) (#86476)

* [Vega] Filtering is not working

Closes: #81738

* fix CI

* some work

* some work

* add tests for extract_index_pattern

* simplify extract_index_pattern

* fix type error

* cleanup

* Update vega_base_view.js

* Update extract_index_pattern.test.ts

* fix PR comments

* fix some comments

* findByTitle -> getByTitle

* remove getByTitle

* fix vega_base_view

* fix jest

* allow to set multiple indexes from top_nav

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/plugins/vis_type_vega/public/vega_type.ts
#	src/plugins/vis_type_vega/public/vega_visualization.test.js
#	src/plugins/vis_type_vega/public/vega_visualization.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Vega Vega visualizations release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
7 participants