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

[Vis: Default editor] EUIficate region map options tab #42944

Merged

Conversation

sulemanof
Copy link
Contributor

@sulemanof sulemanof commented Aug 8, 2019

Summary

A part of #38273.
EUIfication of the Options tab in the Region map vis.

This also fix #36017.

reqion_map

Checklist

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

For maintainers

# Conflicts:
#	src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx
#	src/legacy/core_plugins/kbn_vislib_vis_types/public/utils/with_injected_dependencies.tsx
#	src/legacy/core_plugins/tile_map/public/components/wms_options.tsx
…ns/region_map_options

# Conflicts:
#	src/legacy/core_plugins/region_map/public/region_map_vis_params.js
#	src/legacy/core_plugins/region_map/public/shim/legacy_dependencies_plugin.ts
#	src/legacy/core_plugins/region_map/public/types.ts
@sulemanof sulemanof requested a review from a team as a code owner August 8, 2019 14:57
@sulemanof sulemanof added Feature:Region Map Feature:Vis Editor Visualization editor issues release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.4.0 v8.0.0 labels Aug 8, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@elasticmachine
Copy link
Contributor

💔 Build Failed

@sulemanof sulemanof force-pushed the EUIfication/options/region_map_options branch from 48cccc2 to 77a903c Compare August 9, 2019 10:06
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@sulemanof sulemanof requested a review from timroes August 9, 2019 13:23
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@maryia-lapata maryia-lapata 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 on Chrome Mac.

Please don't forget about refactoring from #42944 (review)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@flash1293
Copy link
Contributor

I'm not sure about the default value in selects in the region map options - it looks like you can't go back to the empty state once you've chosen a vector map:

vector_map_select

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.

Code mostly LGTM with two small nits/hints. I think it makes sense to revisit the possible usability issue in the gif above - it just feels strange for the user to have a one-way path in the UI they can't get back from IMHO. Maybe it was discussed already somewhere else.

setEmsHotLink(newLayer);
}
},
[vectorLayers]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should also include setValue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently we build the logic with static setValue prop, but it could be changed in the future.. so it would make sense to watch it also. Thnx!

return clonedLayer;
}
export const mapToLayerWithId = (prefix: string, layer: FileLayer): VectorLayer => ({
...layer,
Copy link
Contributor

Choose a reason for hiding this comment

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

The removal of cloneDeep means that the FileLayerField objects and the array of those objects in the layer will reference the original ones. Are we sure they are not mutated somewhere? This could cause some bugs that are hard to track down.

It might be totally fine, just to make sure as I'm not familiar with the control flow in that part of the code.

Copy link
Contributor Author

@sulemanof sulemanof Aug 15, 2019

Choose a reason for hiding this comment

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

I've checked the code flow and these values are read-only. Also FileLayer array comes straight from the server, so they are safe for modifying.
Of course I could keep the cloneDeep here, but didn't see a necessity in it and skip for a performance boost.

@sulemanof
Copy link
Contributor Author

I'm not sure about the default value in selects in the region map options - it looks like you can't go back to the empty state once you've chosen a vector map:

Hey, @flash1293 !
Actually, we can't have here an empty value, because it would be an unnecessary vis (without any values on the map). The vis works on mapping the data from elasticsearch to the selected layer data.

Also, there is the logic with setting the default value from this dropdown (the first availabale) after initialization. But currently it doesn't work as expected due to existing issue. It caused by inner visualization building logic and does't depend on this PR, so I will prepare a fix for it in a separate PR. After the fix we won't have empty value in the dropdown.

…ns/region_map_options

# Conflicts:
#	src/legacy/core_plugins/kbn_vislib_vis_types/public/controls/select.tsx
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 in this case, thanks for your explanation!

Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

I think we can get rid of sleeps and use innerHtml to get options text in the functional tests

test/functional/apps/visualize/_region_map.js Outdated Show resolved Hide resolved
test/functional/apps/visualize/_region_map.js Outdated Show resolved Hide resolved
test/functional/apps/visualize/_region_map.js Outdated Show resolved Hide resolved
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@sulemanof sulemanof requested a review from dmlemeshko August 15, 2019 15:35
Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@sulemanof sulemanof merged commit df72f91 into elastic:master Aug 15, 2019
@sulemanof sulemanof deleted the EUIfication/options/region_map_options branch August 15, 2019 18:09
sulemanof added a commit to sulemanof/kibana that referenced this pull request Aug 15, 2019
* EUIficate region_map_options

* Reuse types

* Remove wms_options directive

* Remove style import

* Fix issue with join field default value

# Conflicts:
#	src/legacy/core_plugins/region_map/public/region_map_vis_params.html
sulemanof added a commit that referenced this pull request Aug 16, 2019
* EUIficate region_map_options

* Reuse types

* Remove wms_options directive

* Remove style import

* Fix issue with join field default value

# Conflicts:
#	src/legacy/core_plugins/region_map/public/region_map_vis_params.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Region Map Feature:Vis Editor Visualization editor issues release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Region Map] Join field always displaying default value
7 participants