You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by aa...@apache.org on 2022/02/09 23:03:13 UTC

[superset] 05/18: Fetch bug fixed (#16376)

This is an automated email from the ASF dual-hosted git repository.

aafghahi pushed a commit to branch refactorReports
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d25c8418dabb9b324b575ecc93fcaae0726d31e2
Author: Lyndsi Kay Williams <55...@users.noreply.github.com>
AuthorDate: Fri Aug 20 12:51:29 2021 -0500

    Fetch bug fixed (#16376)
---
 .../HeaderReportActionsDropdown/index.tsx          |  1 +
 .../dashboard/components/Header/Header.test.tsx    |  1 -
 .../src/dashboard/components/Header/index.jsx      |  1 -
 .../components/ExploreChartHeader/index.jsx        |  8 ++------
 superset-frontend/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 cf2ae7f..6e42b07 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 1a7ae85..ea94ace 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 61d7570..2137d90 100644
--- a/superset-frontend/src/dashboard/components/Header/index.jsx
+++ b/superset-frontend/src/dashboard/components/Header/index.jsx
@@ -74,7 +74,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/index.jsx b/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx
index 8458bef..8c45838 100644
--- a/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx
+++ b/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx
@@ -28,11 +28,7 @@ import {
   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 'src/dashboard/util/propShapes';
 import EditableTitle from 'src/components/EditableTitle';
@@ -307,7 +303,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 cdf9102..669c720 100644
--- a/superset-frontend/src/reports/actions/reports.js
+++ b/superset-frontend/src/reports/actions/reports.js
@@ -78,22 +78,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,
+      }),
     );
   }
 };