diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx index 45a3fde058cfc..88c90429103dd 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx @@ -28,8 +28,8 @@ import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import DeleteModal from 'src/components/DeleteModal'; import ReportModal from 'src/components/ReportModal'; import { ChartState } from 'src/explore/types'; -import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import { fetchUISpecificReport } from 'src/reports/actions/reports'; +import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; const deleteColor = (theme: SupersetTheme) => css` color: ${theme.colors.error.base}; diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx index 80145cb4ef303..5036132873584 100644 --- a/superset-frontend/src/dashboard/components/Header/index.jsx +++ b/superset-frontend/src/dashboard/components/Header/index.jsx @@ -160,6 +160,8 @@ class Header extends React.PureComponent { this.overwriteDashboard = this.overwriteDashboard.bind(this); this.showPropertiesModal = this.showPropertiesModal.bind(this); this.hidePropertiesModal = this.hidePropertiesModal.bind(this); + this.showReportModal = this.showReportModal.bind(this); + this.hideReportModal = this.hideReportModal.bind(this); } componentDidMount() { @@ -391,27 +393,6 @@ class Header extends React.PureComponent { this.setState({ showingPropertiesModal: false }); } -<<<<<<< HEAD - canAddReports() { - if (!isFeatureEnabled(FeatureFlag.ALERT_REPORTS)) { - return false; - } - const { user } = this.props; - if (!user?.userId) { - // this is in the case that there is an anonymous user. - return false; - } - const roles = Object.keys(user.roles || []); - const permissions = roles.map(key => - user.roles[key].filter( - perms => perms[0] === 'menu_access' && perms[1] === 'Manage', - ), - ); - return permissions[0].length > 0; - } - -======= ->>>>>>> code dry (#16358) render() { const { dashboardTitle, @@ -587,16 +568,33 @@ class Header extends React.PureComponent { )} - + {this.state.showingPropertiesModal && ( + { + const { + dashboardInfoChanged, + dashboardTitleChanged, + } = this.props; + dashboardInfoChanged({ + slug: updates.slug, + metadata: JSON.parse(updates.jsonMetadata), + }); + setColorSchemeAndUnsavedChanges(updates.colorScheme); + dashboardTitleChanged(updates.title); + if (updates.slug) { + window.history.pushState( + { event: 'dashboard_properties_changed' }, + '', + `/superset/dashboard/${updates.slug}/`, + ); + } + }} + /> + )} {this.state.showingReportModal && (