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

Limit max number of layers #216

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

VijayanB
Copy link
Member

@VijayanB VijayanB commented Jan 19, 2023

Description

Add restriction to create more than 100 layers.

Signed-off-by: Vijayan Balasubramanian balasvij@amazon.com

I took snapshot with 3 as max limit to avoid creating 20 layers

Screen Shot 2023-01-18 at 5 41 41 PM

Issues Resolved

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.

@VijayanB VijayanB requested a review from a team January 19, 2023 00:07
@VijayanB VijayanB self-assigned this Jan 19, 2023
@VijayanB VijayanB added enhancement New feature or request v2.6.0 labels Jan 19, 2023
@junqiu-lei
Copy link
Member

Need we add a warning message when user reached the max number?

@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2023

Codecov Report

Merging #216 (d35b5ec) into main (b03ac14) will increase coverage by 0.07%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   87.42%   87.50%   +0.07%     
==========================================
  Files           6        6              
  Lines         175      176       +1     
  Branches       24       24              
==========================================
+ Hits          153      154       +1     
  Misses         16       16              
  Partials        6        6              
Impacted Files Coverage Δ
...Dashboards/plugins/dashboards-maps/common/index.ts 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

common/index.ts Outdated
export const MIN_LONGITUDE = -180;
export const MAP_LAYER_DEFAULT_OPACITY_STEP = 1;
export const MAP_REFERENCE_LAYER_DEFAULT_OPACITY = 100;
export const MAX_LAYER_LIMIT = 100; // Move this setting to Map configuration later
Copy link
Collaborator

Choose a reason for hiding this comment

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

This setting of 100 is too big for the UI. I would recommend making a default setting as 20(no great reason to support this except that it is small and will make sure that UI is responsive.)

Also, given that whatever value we choose we may endup debating what is the right default value. I would say let's get this value from config file so that customer have a way to update this value if required.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. In future this value will be part of Map settings for users to configure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why we are not making this setting as of now and putting this as a part of future work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Map settings needs UX.

Copy link
Collaborator

Choose a reason for hiding this comment

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

wait there is a gap in the understanding. Let me rephrase what I was saying: I was saying we can take this settings from opensearch_dashboards.yml file.

Copy link
Member Author

@VijayanB VijayanB Jan 19, 2023

Choose a reason for hiding this comment

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

I don't think we need this to be part of osd yaml file. I am thinking about adding as ui settings similar to other dashboard objects. This will allow users to change this inside Dashboards instead of updating in yaml file, which requires OSD restart i believe

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that it will require an OSD bootstrap and making it as a dynamic settings that can be updated using UI will be great. Please point me to the github issue which we are using to track you proposed approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

export const MAP_LAYER_DEFAULT_OPACITY_STEP = 1;
export const MAP_REFERENCE_LAYER_DEFAULT_OPACITY = 100;
export const MAX_LAYER_LIMIT = 100; // Move this setting to Map configuration later
export const MAX_LAYER_NAME_LIMIT = 35;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add comments why we are using a default value. Your comment can say that this is default value for other components of dashboard will also be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want comment for layer name or layer limit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

layer name size limit

@@ -108,7 +110,7 @@ export const AddLayerPanel = ({
fill
onClick={showModal}
aria-label="Add layer"
isDisabled={IsLayerConfigVisible}
isDisabled={IsLayerConfigVisible || layerCount >= MAX_LAYER_LIMIT}
Copy link
Collaborator

Choose a reason for hiding this comment

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

when the add layer button is disabled, I am not able to see the tool-tip which provides info around why this button is disabled. If it is not added, please add the tool-tip, otherwise please refer the code here for the tool tip.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added. I was waiting for text review .

Add restriction to create more than 100 layers.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
@VijayanB VijayanB merged commit d4a051c into opensearch-project:main Jan 19, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 19, 2023
Add restriction to create more than 100 layers.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
(cherry picked from commit d4a051c)
VijayanB pushed a commit that referenced this pull request Jan 20, 2023
Add restriction to create more than 100 layers.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants