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

Update property when switching layer config panel #158

Merged

Conversation

junqiu-lei
Copy link
Member

@junqiu-lei junqiu-lei commented Jan 4, 2023

Signed-off-by: Junqiu Lei junqiu@amazon.com

Description

This PR contains:

  • Fixes documents layer data source property not update properly when directly switch to another layer
  • Adds warn modal for unsaved layer configuration when want switch to another layer.

###Demo

Screen.Recording.2023-01-05.at.12.06.20.PM.mov

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
@junqiu-lei junqiu-lei self-assigned this Jan 4, 2023
@junqiu-lei junqiu-lei requested a review from a team January 4, 2023 06:51
@@ -30,14 +30,12 @@ interface Props {
setSelectedLayerConfig: Function;
selectedLayerConfig: DocumentLayerSpecification;
setIsUpdateDisabled: Function;
layersIndexPatterns: IndexPattern[];
}

export const DocumentLayerSource = ({
Copy link
Member

Choose a reason for hiding this comment

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

It looks unnecessary to keep the component DocumentLayerSource state of selectedNumber tooltipSelection, etc.

It could use layer config passed by props and update the layer config directly with setSelectedLayerConfig, like what we do in onFiltersUpdated. Layer config passed by props should be the only source of truth. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, just updated the code, thanks!

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
@junqiu-lei junqiu-lei merged commit 77b71c8 into opensearch-project:feature/new-maps Jan 5, 2023
@junqiu-lei junqiu-lei deleted the layer_switch branch January 5, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants