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

feat: Draggable and Resizable Modal #16394

Merged
merged 11 commits into from
Aug 25, 2021
Merged

feat: Draggable and Resizable Modal #16394

merged 11 commits into from
Aug 25, 2021

Conversation

geido
Copy link
Member

@geido geido commented Aug 22, 2021

SUMMARY

This PR introduces four new options to the Modal component

resizable: It makes the Modal resizable using re-resizable
resizableConfig: It accepts a re-resizable configuration object
draggable: It makes the Modal draggable using react-draggable
resizableConfig: It accepts a react-draggable configuration object

The resizable and draggable are completely independent of each other, they can be used in combination or not used at all.

Note: When resizable or/and draggable are used, the Modal mask will be disabled.

Note: When resizable and draggable are not used, the original Modal node will be returned. This is to minimize the impact of these changes on existing Modals.

SHOULD I USE THESE OPTIONS?

This is up for debate. Personally, I believe resizable and draggable Modals can be useful in very specific cases but should never be used heavily. A better UX solution should be found when the need of resizable and draggable Modals increases.

FIRST EXAMPLE: VIEW QUERY MODAL

Both resizable and draggable options have been enabled for the "View Query" Modal. The Modal has been slightly enhanced in order for the SyntaxHighlighter Component to take the full height.

BEFORE

Screen Shot 2021-08-22 at 23 16 11

AFTER

draggable_resizable.mp4

TESTING INSTRUCTIONS

  1. Open Explore
  2. Click on "View Query"
  3. Hover the title and drag the Modal in the window
  4. Hover and drag the right, right bottom, and bottom corners to resize the modal

ADDITIONAL INFORMATION

  • Has associated issue: Fixes [Viewquery]Allow View Query Screen to move around #16205
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@geido
Copy link
Member Author

geido commented Aug 22, 2021

@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #16394 (7866549) into master (c14364c) will decrease coverage by 0.02%.
The diff coverage is 73.07%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16394      +/-   ##
==========================================
- Coverage   76.55%   76.52%   -0.03%     
==========================================
  Files        1000     1000              
  Lines       53500    53537      +37     
  Branches     6819     6843      +24     
==========================================
+ Hits        40956    40969      +13     
- Misses      12306    12330      +24     
  Partials      238      238              
Flag Coverage Δ
javascript 70.65% <73.07%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...set-frontend/src/components/ModalTrigger/index.jsx 95.65% <ø> (ø)
.../components/ExploreAdditionalActionsMenu/index.jsx 100.00% <ø> (ø)
...src/explore/components/controls/ViewQueryModal.tsx 76.92% <66.66%> (+0.92%) ⬆️
superset-frontend/src/components/Modal/Modal.tsx 85.22% <73.46%> (-14.78%) ⬇️
...et-frontend/src/components/Select/NativeSelect.tsx 80.00% <0.00%> (-20.00%) ⬇️
...frontend/src/views/CRUD/alert/AlertReportModal.tsx 61.48% <0.00%> (-1.41%) ⬇️
...views/CRUD/alert/components/NotificationMethod.tsx 72.97% <0.00%> (-0.72%) ⬇️
superset/db_engine_specs/presto.py 89.95% <0.00%> (-0.42%) ⬇️
...dashboard/components/SliceHeaderControls/index.tsx 75.00% <0.00%> (-0.40%) ⬇️
superset/views/base.py 75.86% <0.00%> (-0.17%) ⬇️
... and 41 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c14364c...7866549. Read the comment docs.

@geido
Copy link
Member Author

geido commented Aug 23, 2021

/testenv up

@github-actions
Copy link
Contributor

@geido Ephemeral environment spinning up at http://34.219.205.253:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@junlincc
Copy link
Member

solid work!! lgtm! resizable, dragable, scroll as needed, awesome!! can you change the static modal in dashboard to the same? in a 2nd pr is fine

Screen.Recording.2021-08-23.at.6.49.23.PM.mov
Screen.Recording.2021-08-23.at.6.52.41.PM.mov

@junlincc junlincc added the need:review Requires a code review label Aug 23, 2021
@geido
Copy link
Member Author

geido commented Aug 24, 2021

Cool @junlincc. Let's get this merged first and I'll have a look at that Modal in the Dashboard

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

A few minor comments, but I'm sure these can be tackled later - LGTM and works really nicely! I also want to echo @junlincc request to enable this on the Dashboard view where I do the majority of query checking nowadays.

superset-frontend/src/components/Modal/Modal.tsx Outdated Show resolved Hide resolved
Comment on lines +56 to +59
resizable?: boolean;
resizableConfig?: ResizableProps;
draggable?: boolean;
draggableConfig?: DraggableProps;
Copy link
Member

Choose a reason for hiding this comment

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

It feels slightly redundant to have four props for essentially two features. Would it be possible to squeeze the resizable into ResizableProps as an enabled prop which is assumed to default to false? Same for draggable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would say that resizableConfig and draggableConfig might be a bit overkilling here and the only reason why I put them there is that I cannot predict right now how many of those options we will need in the future. We might as well realize we don't need any and just shut them down.

So rather than squeezing resizable and draggable inside the config which looks like very standard props, I would first implement these types of Modals in a few places and then either shut the config props down altogether or just come up with a few elected ones as overridable defaults. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that works just fine. The reason I pointed this out is this prop structure looked "unexpected" (for the lack of a better word), but I assumed there was a good reason for it. I completely agree; let's get this merged soon and do many small iterative improvements later rather than one big PR now 👍

Copy link
Member

@junlincc junlincc left a comment

Choose a reason for hiding this comment

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

product sign-off🙏

@jinghua-qa let's add to test case.

@geido geido merged commit db11c3e into apache:master Aug 25, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@geido geido deleted the fix/issue_16205_draggable_resizable_modal branch August 25, 2021 13:12
amitmiran137 pushed a commit to nielsen-oss/superset that referenced this pull request Aug 26, 2021
* upstream/master: (25 commits)
  chore(ci): bump pylint to 2.10.2 (apache#16463)
  fix: prevent page crash when chart can't render (apache#16464)
  chore: fixed slack invite link (apache#16466)
  fix(native-filters): handle null values in value filter (apache#16460)
  feat: add function list to auto-complete to Clickhouse datasource (apache#16234)
  refactor(explore): improve typing for Dnd controls (apache#16362)
  fix(explore): update overwrite button on perm change (apache#16437)
  feat: Draggable and Resizable Modal (apache#16394)
  refactor: sql_json view endpoint (apache#16441)
  fix(dashboard): undo and redo buttons weird alignment  (apache#16417)
  fix: setupPlugin in chart list page (apache#16413)
  fix: Disable Slack notification method if no api token (apache#16367)
  feat: add Shillelagh DB engine spec (apache#16416)
  fix: copy to Clipboard order (apache#16299)
  docs: make FEATURE_FLAGS.md reference a link (apache#16415)
  chore(viz): bump superset-ui to 0.17.87 (apache#16420)
  feat: add activate command (apache#16404)
  Revert "fix(explore): let admin overwrite slice (apache#16290)" (apache#16408)
  fix(explore): retain chart ownership on query context update (apache#16419)
  chore: Removes the TODOs and uses the default page size (apache#16422)
  ...
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* Implement resizable prop

* Implement resizableConfig

* Implement fluid Syntax Highlighter

* Implement draggable

* Destroy on close

* Implement draggableConfig

* Enhance with footer calculation

* Add new line

* Make whole header draggable trigger
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* Implement resizable prop

* Implement resizableConfig

* Implement fluid Syntax Highlighter

* Implement draggable

* Destroy on close

* Implement draggableConfig

* Enhance with footer calculation

* Add new line

* Make whole header draggable trigger
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels need:review Requires a code review size/L 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Viewquery]Allow View Query Screen to move around
4 participants