You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "cezudas (via GitHub)" <gi...@apache.org> on 2024/10/28 07:17:02 UTC
[PR] fix(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context [superset]
cezudas opened a new pull request, #30724:
URL: https://github.com/apache/superset/pull/30724
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
When a dashboard is loaded in embedded mode, no 'Edit chart' functionality makes sense regardless of whether the guest user has `supersetCanExplore` permission.
Why? Because the `/explore` page isn't available in the DashboardEmbed mode so if the role provided for `GUEST_ROLE_NAME` has `supersetCanExplore` permission the 'Edit chart' functionality would not work (guest user will see a blank page in the embed mode)
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->

### 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(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context [superset]
Posted by "cezudas (via GitHub)" <gi...@apache.org>.
cezudas closed pull request #30724: fix(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context
URL: https://github.com/apache/superset/pull/30724
--
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(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context [superset]
Posted by "cezudas (via GitHub)" <gi...@apache.org>.
cezudas commented on code in PR #30724:
URL: https://github.com/apache/superset/pull/30724#discussion_r1855948762
##########
superset-frontend/src/hooks/useIsEmbedded.ts:
##########
@@ -0,0 +1,5 @@
+import { useSelector } from 'react-redux';
+import { RootState } from 'src/dashboard/types';
+
+export const useIsEmbedded = () =>
+ useSelector<RootState, boolean>(({ dashboardInfo }) => !dashboardInfo.userId);
Review Comment:
Hi @geido @sadpandajoe PHAL :)
--
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(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context [superset]
Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on code in PR #30724:
URL: https://github.com/apache/superset/pull/30724#discussion_r1819033547
##########
superset-frontend/src/hooks/useIsEmbedded.ts:
##########
@@ -0,0 +1,5 @@
+import { useSelector } from 'react-redux';
+import { RootState } from 'src/dashboard/types';
+
+export const useIsEmbedded = () =>
+ useSelector<RootState, boolean>(({ dashboardInfo }) => !dashboardInfo.userId);
Review Comment:
I am not sure that this is a reliable way to identify an embedded context
--
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(embedded): Hide "Edit chart" menu option as well as "Edit chart" button in "View as table" modal for embedded context [superset]
Posted by "cezudas (via GitHub)" <gi...@apache.org>.
cezudas commented on code in PR #30724:
URL: https://github.com/apache/superset/pull/30724#discussion_r1843472490
##########
superset-frontend/src/hooks/useIsEmbedded.ts:
##########
@@ -0,0 +1,5 @@
+import { useSelector } from 'react-redux';
+import { RootState } from 'src/dashboard/types';
+
+export const useIsEmbedded = () =>
+ useSelector<RootState, boolean>(({ dashboardInfo }) => !dashboardInfo.userId);
Review Comment:
10x for the suggestion! Is this second approach better? PHAL
--
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