diff --git a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/HeaderActionsDropdown.test.tsx b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/HeaderActionsDropdown.test.tsx index e112e7e5310de..deea296d4c04f 100644 --- a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/HeaderActionsDropdown.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/HeaderActionsDropdown.test.tsx @@ -92,6 +92,14 @@ const editModeOnWithFilterScopesProps = { }, }; +const guestUserProps = { + ...createProps(), + dashboardInfo: { + ...createProps().dashboardInfo, + userId: undefined, + }, +}; + function setup(props: HeaderDropdownProps) { return render(
@@ -134,6 +142,14 @@ test('should render the menu items in edit mode', async () => { expect(screen.getByText('Download')).toBeInTheDocument(); }); +test('should render the menu items in Embedded mode', async () => { + setup(guestUserProps); + expect(screen.getAllByRole('menuitem')).toHaveLength(3); + expect(screen.getByText('Refresh dashboard')).toBeInTheDocument(); + expect(screen.getByText('Download')).toBeInTheDocument(); + expect(screen.getByText('Set auto-refresh interval')).toBeInTheDocument(); +}); + describe('with native filters feature flag disabled', () => { beforeAll(() => { isFeatureEnabledMock = jest diff --git a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx index 4d8bcf4ee0930..b0d3fc251e9d9 100644 --- a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx +++ b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx @@ -216,6 +216,8 @@ class HeaderActionsDropdown extends React.PureComponent { const emailSubject = `${emailTitle} ${dashboardTitle}`; const emailBody = t('Check out this dashboard: '); + const isEmbedded = !dashboardInfo?.userId; + const url = getDashboardUrl({ pathname: window.location.pathname, filters: getActiveFilters(), @@ -237,7 +239,7 @@ class HeaderActionsDropdown extends React.PureComponent { {t('Refresh dashboard')} )} - {!editMode && ( + {!editMode && !isEmbedded && (