From 0f8cf4bc5cdfd7b407a6c64ecd6d0d6e2b5af1c4 Mon Sep 17 00:00:00 2001 From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Date: Fri, 20 Aug 2021 12:51:29 -0500 Subject: [PATCH] Fetch bug fixed (#16376) --- .../HeaderReportActionsDropdown/index.tsx | 1 + .../components/Header/Header.test.tsx | 1 - .../src/dashboard/components/Header/index.jsx | 1 - .../explore/components/ExploreChartHeader.jsx | 8 ++----- .../src/reports/actions/reports.js | 24 +++++++++---------- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx index cf2ae7f89abb1..6e42b07531b4c 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx @@ -55,6 +55,7 @@ export default function HeaderReportActionsDropDown({ >(state => state.user || state.explore?.user); const reportsIds = Object.keys(reports || []); const report: AlertObject = reports?.[reportsIds[0]]; + console.log(report); const [ currentReportDeleting, setCurrentReportDeleting, diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx index 5d1b6af995295..6773b0c1af2ec 100644 --- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx @@ -57,7 +57,6 @@ const createProps = () => ({ dashboardTitle: 'Dashboard Title', charts: {}, layout: {}, - reports: {}, expandedSlices: {}, css: '', customCss: '', diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx index 80b250d943825..e0a686629057f 100644 --- a/superset-frontend/src/dashboard/components/Header/index.jsx +++ b/superset-frontend/src/dashboard/components/Header/index.jsx @@ -73,7 +73,6 @@ const propTypes = { onChange: PropTypes.func.isRequired, fetchFaveStar: PropTypes.func.isRequired, fetchCharts: PropTypes.func.isRequired, - fetchUISpecificReport: PropTypes.func.isRequired, saveFaveStar: PropTypes.func.isRequired, savePublished: PropTypes.func.isRequired, updateDashboardTitle: PropTypes.func.isRequired, diff --git a/superset-frontend/src/explore/components/ExploreChartHeader.jsx b/superset-frontend/src/explore/components/ExploreChartHeader.jsx index 77bf6c3dbc490..6bb61c8d32ded 100644 --- a/superset-frontend/src/explore/components/ExploreChartHeader.jsx +++ b/superset-frontend/src/explore/components/ExploreChartHeader.jsx @@ -22,11 +22,7 @@ import { bindActionCreators } from 'redux'; import PropTypes from 'prop-types'; import { styled, t } from '@superset-ui/core'; import { Tooltip } from 'src/components/Tooltip'; -import { - fetchUISpecificReport, - toggleActive, - deleteActiveReport, -} from 'src/reports/actions/reports'; +import { toggleActive, deleteActiveReport } from 'src/reports/actions/reports'; import HeaderReportActionsDropdown from 'src/components/ReportModal/HeaderReportActionsDropdown'; import { chartPropShape } from '../../dashboard/util/propShapes'; import ExploreActionButtons from './ExploreActionButtons'; @@ -243,7 +239,7 @@ ExploreChartHeader.propTypes = propTypes; function mapDispatchToProps(dispatch) { return bindActionCreators( - { sliceUpdated, fetchUISpecificReport, toggleActive, deleteActiveReport }, + { sliceUpdated, toggleActive, deleteActiveReport }, dispatch, ); } diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/reports/actions/reports.js index a46849e43a7d7..16cc8cc7c5e95 100644 --- a/superset-frontend/src/reports/actions/reports.js +++ b/superset-frontend/src/reports/actions/reports.js @@ -79,22 +79,22 @@ const structureFetchAction = (dispatch, getState) => { const { user, dashboardInfo, charts, explore } = state; if (dashboardInfo) { dispatch( - fetchUISpecificReport( - user.userId, - 'dashboard_id', - 'dashboards', - dashboardInfo.id, - ), + fetchUISpecificReport({ + userId: user.userId, + filterField: 'dashboard_id', + creationMethod: 'dashboards', + resourceId: dashboardInfo.id, + }), ); } else { const [chartArr] = Object.keys(charts); dispatch( - fetchUISpecificReport( - explore.user.userId, - 'chart_id', - 'charts', - charts[chartArr].id, - ), + fetchUISpecificReport({ + userId: explore.user.userId, + filterField: 'chart_id', + creationMethod: 'charts', + resourceId: charts[chartArr].id, + }), ); } };