-
Notifications
You must be signed in to change notification settings - Fork 885
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
[VisBuilder ] Fix filter and query bugs in the saved objects #6460
Conversation
❌ Invalid Changelog HeadingThe '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax. |
❌ Invalid Changelog HeadingThe '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax. |
❌ Invalid Prefix For Manual Changeset CreationInvalid description prefix. Found "fix". Only "skip" entry option is permitted for manual commit of changeset files. If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description. |
76a9443
to
2a46488
Compare
❌ Invalid Prefix For Manual Changeset CreationInvalid description prefix. Found "fix". Only "skip" entry option is permitted for manual commit of changeset files. If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6460 +/- ##
=======================================
Coverage 67.73% 67.73%
=======================================
Files 3414 3414
Lines 66838 66860 +22
Branches 10872 10879 +7
=======================================
+ Hits 45270 45285 +15
- Misses 18923 18930 +7
Partials 2645 2645
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@ashwin-pc I moved the save button logic from this PR to #6636 For tests, I think these behavior should better be tested in ftr. Create a meta issue to add cypress tests for VisBuilder #6635 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested one change, but approving since i dont think its a release blocker. However it would be nice if you can make it.
@@ -79,6 +81,7 @@ export class VisBuilderEmbeddable extends Embeddable<VisBuilderInput, VisBuilder | |||
private subscriptions: Subscription[] = []; | |||
private node?: HTMLElement; | |||
private savedVis?: VisBuilderSavedVis; | |||
private savedObject?: VisBuilderSavedObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of passing the saved object down, cant you modify the getStateFromSavedObject
function to return the searchSourceFields
as a part of savedVis
too.
export interface VisBuilderSavedVis
extends Pick<
VisBuilderSavedObjectAttributes,
'id' | 'title' | 'description' | 'searchSourceFields'
> {
state: RenderState;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we could. let me polish the code.
if (this.handler) { | ||
this.updateHandler(); | ||
} | ||
if (this.handler && dirty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why do we need this change? Feels like the original logic was intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
947df9f
to
63175d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts
Outdated
Show resolved
Hide resolved
@@ -125,6 +125,10 @@ export class VisBuilderPlugin | |||
|
|||
// make sure the index pattern list is up to date | |||
pluginsStart.data.indexPatterns.clearCache(); | |||
// make sure the filterManager is refreshed | |||
const filters = pluginsStart.data.query.filterManager.getFilters(); | |||
const pinFilters = filters.filter(opensearchFilters.isFilterPinned); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pinnedFilters
In this PR: add filter and query in vb clean filterManager when start vb add opensearch_dashboards_context to embeddable. This can add filter and query in the expression. Issue Resolve opensearch-project#5643 opensearch-project#5644 opensearch-project#5646 opensearch-project#6512 Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Miki <amoo_miki@yahoo.com> Signed-off-by: Anan Zhuang <ananzh@amazon.com>
…_vis_builder_vis.ts Co-authored-by: Miki <amoo_miki@yahoo.com> Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
* [VisBuilder] Fix filter and query bugs In this PR: add filter and query in vb clean filterManager when start vb add opensearch_dashboards_context to embeddable. This can add filter and query in the expression. Issue Resolve #5643 #5644 #5646 #6512 Signed-off-by: Anan Zhuang <ananzh@amazon.com> --------- Signed-off-by: Anan Zhuang <ananzh@amazon.com> Co-authored-by: Miki <amoo_miki@yahoo.com> (cherry picked from commit 0ac9db3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…6686) * [VisBuilder] Fix filter and query bugs In this PR: add filter and query in vb clean filterManager when start vb add opensearch_dashboards_context to embeddable. This can add filter and query in the expression. Issue Resolve #5643 #5644 #5646 #6512 Signed-off-by: Anan Zhuang <ananzh@amazon.com> --------- Signed-off-by: Anan Zhuang <ananzh@amazon.com> Co-authored-by: Miki <amoo_miki@yahoo.com> (cherry picked from commit 0ac9db3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…rch-project#6460) * [VisBuilder] Fix filter and query bugs In this PR: add filter and query in vb clean filterManager when start vb add opensearch_dashboards_context to embeddable. This can add filter and query in the expression. Issue Resolve opensearch-project#5643 opensearch-project#5644 opensearch-project#5646 opensearch-project#6512 Signed-off-by: Anan Zhuang <ananzh@amazon.com> --------- Signed-off-by: Anan Zhuang <ananzh@amazon.com> Co-authored-by: Miki <amoo_miki@yahoo.com>
Description
Issues Resolved
_q
) is not saved which causes un-persistent state #5643 This issue is about filter and query are not saved.The fix is this part in the src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx
VisBuilder is using searchSourceFields to save states. This is different from Discover which uses searchSource. This fix will ensure the searchSourceInstance get updated filer and query and allow them to be saved in the saved object.
The fix is in src/plugins/vis_builder/public/plugin.ts to ensure filter state is cleaned if not pin filter.
The fix is in src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts
Basically it loads filter and query from saved object and do some type check. Then it updates data service.
The fix is in src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx and src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx and src/plugins/visualizations/public/index.ts (just export prepareJson method). The bug is due to we don't have
opensearch_dashboards_context
in vis builder which is normally used for filter and quey info.Screenshot
fiter-not-global.mov
_q
) is not saved which causes un-persistent state #5643 and [BUG][VisBuilder Migration] Missing filter and query (_q state) when reload a saved legacy vis builder #5646.save-filter-query.mov
filter_query_embeddable.mov
pin-filter.mov
Changelog
Check List
yarn test:jest
yarn test:jest_integration