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

fixes visualization editor selection being reset #30073

Merged
merged 14 commits into from
Mar 4, 2019

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Feb 5, 2019

Summary

Resolves #29881

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@ppisljar ppisljar added WIP Work in progress v7.0.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Feb 5, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar changed the title Fix/region map fixes visualization editor selection being reset Feb 12, 2019
@ppisljar ppisljar added review and removed WIP Work in progress labels Feb 12, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar added WIP Work in progress and removed review labels Feb 12, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

I tested this locally (Chrome OSX) and can confirm that it's working.

Just to make sure I understand the implementation: I assume the root cause of the issue was vis.params being mutated? (Presumably by decorateVisObject, or somewhere else too)?

What is the guidance going to be moving forward on the relationship between visParams vs vis.params, and when to use each? There are still lots of (unchanged) places where visualizations are referencing vis.params, and my only concern is that introducing another argument to the render() method of a vis still doesn't make its purpose immediately clear.

It seems to me that if we are trying to replace this method of accessing params, we should consider updating it everywhere (which could be a lot of places...). And perhaps even thinking of ways to discourage the use of vis.params so people don't shoot themselves in the foot moving forward.

@ppisljar
Copy link
Member Author

@lukeelmers everything past visualizationLoader (so all visualizations) should not be using vis.params but rather the visParams, if there is any reference left its a bug, or some special condition ... let me know about the ones you are worried

@Crazybus
Copy link

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon
Copy link
Contributor

Any thoughts on test coverage? Functional looks tough given it's only there if you wait some time. But maybe possible to add unit/jest to cover it?

@ppisljar
Copy link
Member Author

the plan was to add a dummy unit test that would set a fake variable, run visualize loader and check if vis.params object wasn't mutated ... but a better idea would be well appreciated

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar added review and removed WIP Work in progress labels Feb 25, 2019
# Conflicts:
#	src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Okay, looked through this again and I think it all makes sense to me! Added one question.

One thing I think is worth thinking about as we move forward is whether there’s a good way to ensure people don’t accidentally use vis.params instead of visParams... it feels like a mistake that would be very easy to make.

@ppisljar
Copy link
Member Author

@lukeelmers yes, the idea is to not pass down vis object anymore, but rather figure out what from it is still necessary and just pass down that specifically. Something to look into in the following weeks.

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

LGTM, tested and works - just one nitpick and a question about a code change.

if (!(status.resize || status.data || status.params)) return;

if (status.params || status.aggs) {
this._updateParams();
if (status.params || status.data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this._updateParams and this._updateData have the same if condition now and can be merged into one function since they are not called from somewhere else.

visConfig.metric.metrics = schemas.metric;
metric: schemas => {
const visConfig = { dimensions: {} } as any;
visConfig.dimensions.metrics = schemas.metric;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this put into dimensions now? Was this a bug in the old version? I realize this is the new pipeline infrastructure, just asking to learn about the code base.

Copy link
Member Author

Choose a reason for hiding this comment

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

historically metric had a bit different structure of params that other visualizations (everything nested under metric). Initially i tried to follow that but realized its causing additional problems as then we have to check for that special condition in various places.

ppisljar added 2 commits March 3, 2019 23:49
# Conflicts:
#	src/legacy/core_plugins/metrics/public/components/vis_editor.js
@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar
Copy link
Member Author

ppisljar commented Mar 4, 2019

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar merged commit 4a0dee5 into elastic:master Mar 4, 2019
ppisljar added a commit to ppisljar/kibana that referenced this pull request Mar 4, 2019
ppisljar added a commit to ppisljar/kibana that referenced this pull request Mar 4, 2019
# Conflicts:
#	src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts
ppisljar added a commit that referenced this pull request Mar 6, 2019
# Conflicts:
#	src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts
@ppisljar ppisljar added the chore label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore review Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants