You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/19 17:24:21 UTC
[GitHub] [superset] ktmud commented on a diff in pull request #19772: fix(dashboard): copy permalink to dashboard chart
ktmud commented on code in PR #19772:
URL: https://github.com/apache/superset/pull/19772#discussion_r853308220
##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -49,23 +45,17 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
addDangerToast,
addSuccessToast,
dashboardId,
- formData,
+ hash,
Review Comment:
I'm trying to understand what `hash` means and how it is used but couldn't wrap my head around it very easily. Can it be named to something more unique so it's more searchable?
##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -49,23 +45,17 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
addDangerToast,
addSuccessToast,
dashboardId,
- formData,
+ hash,
...rest
} = props;
async function generateUrl() {
- // chart
- if (formData) {
- // we need to remove reserved dashboard url params
- return getChartPermalink(formData, RESERVED_DASHBOARD_URL_PARAMS);
- }
- // dashboard
const nativeFiltersKey = getUrlParam(URL_PARAMS.nativeFiltersKey);
let filterState = {};
if (nativeFiltersKey && dashboardId) {
filterState = await getFilterValue(dashboardId, nativeFiltersKey);
}
- return getDashboardPermalink(String(dashboardId), filterState);
+ return getDashboardPermalink(String(dashboardId), filterState, hash);
Review Comment:
Would be nice if we make this more explicit:
```suggestion
return getDashboardPermalink({
dashboardId, # need to relax the type restriction in `getDashboardPermalink` as well
filterState,
hash: dashboardComponentId
});
```
##########
superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx:
##########
@@ -310,13 +311,14 @@ class SliceHeaderControls extends React.PureComponent<
{supersetCanShare && (
<ShareMenuItems
+ dashboardId={dashboardId}
+ hash={componentId}
Review Comment:
```suggestion
dashboardComponentId={componentId}
```
Can we push down the concept of `hash` to only when we interact with the URL? It took me a while to realize what it really means.
--
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