From c40b337978717b149984ed00c5359cf2c2394254 Mon Sep 17 00:00:00 2001 From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Date: Fri, 28 Jan 2022 15:29:44 -0600 Subject: [PATCH] feat: Added success toasts for database, dataset, chart, dashboard, and query imports (#18190) * Added imports toasts * Removed generic import toast * Remove addSuccessToast from props * Added addSuccessToast back to prop type * Made success toast strings translatable --- superset-frontend/src/components/ImportModal/index.tsx | 2 -- superset-frontend/src/views/CRUD/chart/ChartList.tsx | 1 + superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx | 1 + superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx | 1 + superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx | 1 + .../src/views/CRUD/data/savedquery/SavedQueryList.tsx | 1 + 6 files changed, 5 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/components/ImportModal/index.tsx b/superset-frontend/src/components/ImportModal/index.tsx index 17e6cb3b589b..7d0067257d3e 100644 --- a/superset-frontend/src/components/ImportModal/index.tsx +++ b/superset-frontend/src/components/ImportModal/index.tsx @@ -117,7 +117,6 @@ const ImportModelsModal: FunctionComponent = ({ passwordsNeededMessage, confirmOverwriteMessage, addDangerToast, - addSuccessToast, onModelImport, show, onHide, @@ -184,7 +183,6 @@ const ImportModelsModal: FunctionComponent = ({ confirmedOverwrite, ).then(result => { if (result) { - addSuccessToast(t('The import was successful')); clearModal(); onModelImport(); } diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index cd3051444fa7..74493751b28b 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -197,6 +197,7 @@ function ChartList(props: ChartListProps) { const handleChartImport = () => { showImportModal(false); refreshData(); + addSuccessToast(t('Chart imported')); }; const canCreate = hasPerm('can_write'); diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 0475ca950e86..aa1b9fc7b717 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -141,6 +141,7 @@ function DashboardList(props: DashboardListProps) { const handleDashboardImport = () => { showImportModal(false); refreshData(); + addSuccessToast(t('Dashboard imported')); }; const { userId } = props.user; diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx index 355d8335ee15..23ccf4a7a2cf 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx @@ -110,6 +110,7 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) { const handleDatabaseImport = () => { showImportModal(false); refreshData(); + addSuccessToast(t('Database imported')); }; const openDatabaseDeleteModal = (database: DatabaseObject) => diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx index 0fa2697ed6dd..c99a69e1c117 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx @@ -147,6 +147,7 @@ const DatasetList: FunctionComponent = ({ const handleDatasetImport = () => { showImportModal(false); refreshData(); + addSuccessToast(t('Dataset imported')); }; const canEdit = hasPerm('can_write'); diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx index 1baa674d4654..df3f16a858c1 100644 --- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx +++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx @@ -127,6 +127,7 @@ function SavedQueryList({ const handleSavedQueryImport = () => { showImportModal(false); refreshData(); + addSuccessToast(t('Query imported')); }; const canCreate = hasPerm('can_write');