-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat: Draggable and Resizable Modal #16394
Conversation
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@geido Ephemeral environment spinning up at http://34.219.205.253:8080. Credentials are |
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.movScreen.Recording.2021-08-23.at.6.52.41.PM.mov |
Cool @junlincc. Let's get this merged first and I'll have a look at that Modal in the Dashboard |
There was a problem hiding this 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.
resizable?: boolean; | ||
resizableConfig?: ResizableProps; | ||
draggable?: boolean; | ||
draggableConfig?: DraggableProps; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 👍
There was a problem hiding this 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.
Ephemeral environment shutdown and build artifacts deleted. |
* 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) ...
* 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
* 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
SUMMARY
This PR introduces four new options to the Modal component
resizable
: It makes the Modal resizable using re-resizableresizableConfig
: It accepts a re-resizable configuration objectdraggable
: It makes the Modal draggable using react-draggableresizableConfig
: It accepts a react-draggable configuration objectThe
resizable
anddraggable
are completely independent of each other, they can be used in combination or not used at all.Note: When
resizable
or/anddraggable
are used, the Modal mask will be disabled.Note: When
resizable
anddraggable
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
anddraggable
options have been enabled for the "View Query" Modal. The Modal has been slightly enhanced in order for theSyntaxHighlighter
Component to take the full height.BEFORE
AFTER
draggable_resizable.mp4
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION