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 2022/01/12 01:09:02 UTC
[superset] 06/18: 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
commit 1183c0010ae7ed1b2f24725f226585684da6fbb3
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/DataTablesPane/index.tsx | 1 -
2 files changed, 19 insertions(+), 4 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/DataTablesPane/index.tsx b/superset-frontend/src/explore/components/DataTablesPane/index.tsx
index 2d91b03..533d14c 100644
--- a/superset-frontend/src/explore/components/DataTablesPane/index.tsx
+++ b/superset-frontend/src/explore/components/DataTablesPane/index.tsx
@@ -278,7 +278,6 @@ export const DataTablesPane = ({
},
[queryFormData, columnNames],
);
- console.log(queryFormData);
useEffect(() => {
setItem(LocalStorageKeys.is_datapanel_open, panelOpen);
}, [panelOpen]);