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

Add support to draw rectangle shape to filter documents #348

Merged
merged 3 commits into from
Mar 22, 2023

Conversation

VijayanB
Copy link
Member

@VijayanB VijayanB commented Mar 15, 2023

Description

Add rectangle draw mode similar to Polygon.

Issues Resolved

#213

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.

Screen.Recording.2023-03-14.at.10.24.55.PM.mov

@VijayanB VijayanB requested a review from a team March 15, 2023 03:16
@VijayanB VijayanB changed the title Add support to draw rectangle filter to filter documents Add support to draw rectangle shape to filter documents Mar 15, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2023

Codecov Report

Merging #348 (162096f) into main (3a20e81) will decrease coverage by 1.68%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #348      +/-   ##
==========================================
- Coverage   85.71%   84.04%   -1.68%     
==========================================
  Files          18       19       +1     
  Lines         448      470      +22     
  Branches       66       71       +5     
==========================================
+ Hits          384      395      +11     
- Misses         43       53      +10     
- Partials       21       22       +1     

see 5 files with indirect coverage changes

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

@VijayanB VijayanB self-assigned this Mar 15, 2023
Signed-off-by: Vijayan Balasubramanian <[email protected]>
@@ -53,6 +62,8 @@ export const DrawFilterShape = ({
useEffect(() => {
if (filterProperties.mode === FILTER_DRAW_MODE.POLYGON) {
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.DRAW_POLYGON);
} else if (filterProperties.mode === FILTER_DRAW_MODE.RECTANGLE) {
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.DRAW_RECTANGLE);
} else {
// default mode
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.SIMPLE_SELECT);
Copy link
Member

Choose a reason for hiding this comment

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

How about use switch here?

function setDrawMode(mode) {
  switch (mode) {
    case FILTER_DRAW_MODE.POLYGON:
      return MAPBOX_GL_DRAW_MODES.DRAW_POLYGON;
    case FILTER_DRAW_MODE.RECTANGLE:
      return MAPBOX_GL_DRAW_MODES.DRAW_RECTANGLE;
    default:
      return MAPBOX_GL_DRAW_MODES.SIMPLE_SELECT;
  }
}

useEffect(() => {
  mapboxDrawRef.current.changeMode(setDrawMode(filterProperties.mode));
}, [filterProperties.mode]);

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

@junqiu-lei
Copy link
Member

junqiu-lei commented Mar 15, 2023

From the demo video, there are two draw controller icons, is it expected?

@VijayanB
Copy link
Member Author

VijayanB commented Mar 16, 2023

From the demo video, there are two draw controller icons, is it expected?

I am waiting for new 'rectangle icon " from UX. Will replace it in new PR.

Signed-off-by: Vijayan Balasubramanian <[email protected]>
@VijayanB VijayanB requested a review from junqiu-lei March 16, 2023 17:11
junqiu-lei
junqiu-lei previously approved these changes Mar 16, 2023
@VijayanB VijayanB merged commit a42c915 into opensearch-project:main Mar 22, 2023
@VijayanB VijayanB deleted the add-rectangle-ui branch March 22, 2023 23:55
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 22, 2023
* Add rectangle ui tool bar

Signed-off-by: Vijayan Balasubramanian <[email protected]>
(cherry picked from commit a42c915)
VijayanB pushed a commit that referenced this pull request Mar 23, 2023
* Add rectangle ui tool bar

Signed-off-by: Vijayan Balasubramanian <[email protected]>
@VijayanB VijayanB added enhancement New feature or request v2.7.0 labels Mar 23, 2023
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