You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rtexelm (via GitHub)" <gi...@apache.org> on 2024/03/20 18:49:00 UTC

[PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

rtexelm opened a new pull request, #27593:
URL: https://github.com/apache/superset/pull/27593

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   This adds a distinction to the context of the hover menu icons being a full row of the dashboard editor rather than the left most chart. It's purpose is to avoid confusion as to what these icons would affect.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   B:
   <img width="1792" alt="row icons" src="https://github.com/apache/superset/assets/92495987/6063ffe2-5184-403c-b1dc-387e01a6849f">
   A:
   ![new-hover](https://github.com/apache/superset/assets/92495987/34087f09-ffe3-4690-9a84-6acd66e8a9a1)
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   Edit a dashboard then hover over the menu icons to the left of any row
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #27593:
URL: https://github.com/apache/superset/pull/27593#discussion_r1539738046


##########
superset-frontend/src/dashboard/components/menu/HoverMenu.tsx:
##########
@@ -70,6 +72,18 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
     children: null,
   };
 
+  handleMouseEnter = () => {
+    if (this.props.onHover) {
+      this.props.onHover(true);
+    }
+  };
+
+  handleMouseLeave = () => {
+    if (this.props.onHover) {
+      this.props.onHover(false);

Review Comment:
   This looks great. Another small nit, I'd suggest being more explicit when defining this onHover function above. When calling it here, there's no context about what this boolean means. If possible, I usually like to pass a dictionary instead of a boolean argument, so `this.props.onHover({isHovered:false})` for example. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2013119828

   @rtexelm is there merit in in matching the line color/thickness to be the same as when you hover over a specific dashboard element?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho merged PR #27593:
URL: https://github.com/apache/superset/pull/27593


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "rtexelm (via GitHub)" <gi...@apache.org>.
rtexelm commented on code in PR #27593:
URL: https://github.com/apache/superset/pull/27593#discussion_r1533217893


##########
superset-frontend/src/dashboard/components/menu/HoverMenu.tsx:
##########
@@ -81,6 +82,8 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
             position === 'left' && 'hover-menu--left',
             position === 'top' && 'hover-menu--top',
           )}
+          onMouseEnter={onHover}
+          onMouseLeave={onHover}

Review Comment:
   @eschutho I've tried to add a boolean property of `hoveredState` to `inneRef.current` dependent on the `onMouseEnter/Leave` handlers soley inside `HoverMenu` but any changes are not registering when trying to add a class to the `GridRow` in `Row.jsx`. It might be that the `innerRef` is to `Draggable` so I would need to create some logic in there to handle the `hoveredState`? I think I need a more detailed rundown of what you mean in this case...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2027880423

   @rtexelm Yeah, this all looks good to me. Thanks for the improvements!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2010420181

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/27593?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `60.00000%` with `2 lines` in your changes are missing coverage. Please review.
   > Project coverage is 67.46%. Comparing base [(`ad7bd09`)](https://app.codecov.io/gh/apache/superset/commit/ad7bd09819d3fd6ac8f669c6f884551cbd66bcd6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`c72fc0c`)](https://app.codecov.io/gh/apache/superset/pull/27593?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 2 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/superset/pull/27593?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...nd/src/dashboard/components/gridComponents/Row.jsx](https://app.codecov.io/gh/apache/superset/pull/27593?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL1Jvdy5qc3g=) | 50.00% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/superset/pull/27593?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #27593      +/-   ##
   ==========================================
   - Coverage   67.46%   67.46%   -0.01%     
   ==========================================
     Files        1910     1910              
     Lines       74802    74805       +3     
     Branches     8345     8346       +1     
   ==========================================
   + Hits        50468    50469       +1     
   - Misses      22283    22284       +1     
   - Partials     2051     2052       +1     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/27593/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/27593/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.39% <60.00%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/27593?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #27593:
URL: https://github.com/apache/superset/pull/27593#discussion_r1532917374


##########
superset-frontend/src/dashboard/components/menu/HoverMenu.tsx:
##########
@@ -81,6 +82,8 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
             position === 'left' && 'hover-menu--left',
             position === 'top' && 'hover-menu--top',
           )}
+          onMouseEnter={onHover}
+          onMouseLeave={onHover}

Review Comment:
   Technically this component knows the state of the hover. OnMouseEnter = hovered onMouseLeave = not hovered. Instead of having the parent storing and toggling the state (which could get out of sync), I think we can be more explicit by letting this HoverMenu component save the state of the hover, and then there's already a ref getting passed in. We should be able to use that ref to get the state of the hover instead of having the onHover callback. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "rtexelm (via GitHub)" <gi...@apache.org>.
rtexelm commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2022170081

   Came across the problem that `getByTestId` was not finding `data-testid` but will find `data-test`. There is an override I found [here](https://testing-library.com/docs/queries/bytestid/) but I couldn't find it utilized in the codebase. I did find this in `babel.config.js`:
   
   ```json
   production: {
         plugins: [
           [
             'babel-plugin-jsx-remove-data-test-id',
             {
               attributes: 'data-test',
             },
           ],
         ],
       },
   ```
   Does this make sense for the substitution during testing?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2010688404

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "rtexelm (via GitHub)" <gi...@apache.org>.
rtexelm commented on code in PR #27593:
URL: https://github.com/apache/superset/pull/27593#discussion_r1540569257


##########
superset-frontend/src/dashboard/components/menu/HoverMenu.tsx:
##########
@@ -70,6 +72,18 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
     children: null,
   };
 
+  handleMouseEnter = () => {
+    if (this.props.onHover) {
+      this.props.onHover(true);
+    }
+  };
+
+  handleMouseLeave = () => {
+    if (this.props.onHover) {
+      this.props.onHover(false);

Review Comment:
   Thank you for this suggestion by the way, details like this really help me get better!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2010672833

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2038445773

   Ephemeral environment shutdown and build artifacts deleted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "rtexelm (via GitHub)" <gi...@apache.org>.
rtexelm commented on code in PR #27593:
URL: https://github.com/apache/superset/pull/27593#discussion_r1536459574


##########
superset-frontend/src/dashboard/components/menu/HoverMenu.tsx:
##########
@@ -81,6 +82,8 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
             position === 'left' && 'hover-menu--left',
             position === 'top' && 'hover-menu--top',
           )}
+          onMouseEnter={onHover}
+          onMouseLeave={onHover}

Review Comment:
   @eschutho Yikes, after an extensive rabbit hole it looks like there isn't really a great way of using a ref to update the state of `Row` based on hovered state of `HoverMenu` without a context provider. I'm thinking a callback is the better choice here but just in case, I made a commit with my attempt at handling things with a ref.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(Dashboard): Add border to row when hovering HoverMenu in edit mode [superset]

Posted by "rtexelm (via GitHub)" <gi...@apache.org>.
rtexelm commented on PR #27593:
URL: https://github.com/apache/superset/pull/27593#issuecomment-2013719041

   @john-bodley I thought making it 2px instead of 1 would hopefully differentiate it from a regular dashboard element, inspired by the styling from [WithPopoverMenu](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx) but using a dashed border to avoid confusion with that context.
   It could go further in that direction, changing the border style and color to be more distinct but I don't think it should be closer to the style of a chart or other dashboard element because rows represent a separate role as a container of those


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org