You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2021/08/20 22:06:22 UTC

[superset] branch refactorReports updated: continued refactoring (#16377)

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

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


The following commit(s) were added to refs/heads/refactorReports by this push:
     new 2739d66  continued refactoring (#16377)
2739d66 is described below

commit 2739d6679e46488a5739ba3d446400749dacd51f
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Fri Aug 20 18:04:57 2021 -0400

    continued refactoring (#16377)
---
 .../HeaderReportActionsDropdown/index.tsx          | 22 +++++++++++++++++++---
 .../explore/components/DataTableControl/index.tsx  |  1 -
 .../explore/components/DataTablesPane/index.tsx    |  1 -
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
index 6e42b07..f9fdca0 100644
--- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
+++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useRef } from 'react';
 import { useSelector, useDispatch } from 'react-redux';
 import { t, SupersetTheme, css, useTheme } from '@superset-ui/core';
 import Icons from 'src/components/Icons';
@@ -55,14 +55,13 @@ 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,
   ] = useState<AlertObject | null>(null);
   const theme = useTheme();
   const [showModal, setShowModal] = useState(false);
-
+  const dashboardIdRef = useRef(dashboardId);
   const toggleActiveKey = async (data: AlertObject, checked: boolean) => {
     if (data?.id) {
       toggleActive(data, checked);
@@ -104,6 +103,23 @@ export default function HeaderReportActionsDropDown({
     }
   }, []);
 
+  useEffect(() => {
+    if (
+      canAddReports() &&
+      dashboardId &&
+      dashboardId !== dashboardIdRef.current
+    ) {
+      dispatch(
+        fetchUISpecificReport({
+          userId: user.userId,
+          filterField: 'dashboard_id',
+          creationMethod: 'dashboards',
+          resourceId: dashboardId,
+        }),
+      );
+    }
+  }, [dashboardId]);
+
   const menu = () => (
     <Menu selectable={false} css={{ width: '200px' }}>
       <Menu.Item>
diff --git a/superset-frontend/src/explore/components/DataTableControl/index.tsx b/superset-frontend/src/explore/components/DataTableControl/index.tsx
index 3e2d4c1..16a6c64 100644
--- a/superset-frontend/src/explore/components/DataTableControl/index.tsx
+++ b/superset-frontend/src/explore/components/DataTableControl/index.tsx
@@ -125,7 +125,6 @@ export const useTableColumns = (
                 accessor: row => row[key],
                 Header: key,
                 Cell: ({ value }) => {
-                  console.log(data);
                   if (value === true) {
                     return BOOL_TRUE_DISPLAY;
                   }
diff --git a/superset-frontend/src/explore/components/DataTablesPane/index.tsx b/superset-frontend/src/explore/components/DataTablesPane/index.tsx
index a25b773..a7c5bd3 100644
--- a/superset-frontend/src/explore/components/DataTablesPane/index.tsx
+++ b/superset-frontend/src/explore/components/DataTablesPane/index.tsx
@@ -201,7 +201,6 @@ export const DataTablesPane = ({
     },
     [queryFormData],
   );
-  console.log(queryFormData);
   useEffect(() => {
     setInLocalStorage(STORAGE_KEYS.isOpen, panelOpen);
   }, [panelOpen]);