From 368903b1e01e58822799f439f63c45bca7006eca Mon Sep 17 00:00:00 2001 From: Luca Tagliabue Date: Fri, 21 Jun 2024 12:23:15 +0200 Subject: [PATCH] chore: fix notification (missing content) and remove useless field from importList array --- .../ImportButton/import-current-button.jsx | 4 ++-- .../models/Details/current/imports/columns.jsx | 7 ------- .../models/Details/current/imports/index.jsx | 10 ++-------- ui/src/container/models/Details/index.jsx | 2 +- .../models/Details/overview/index.jsx | 18 +++++++++++++++--- .../Details/reference/imports/columns.jsx | 7 ------- .../models/Details/reference/imports/index.jsx | 10 ++-------- ui/src/store/middlewares.js | 2 +- ui/src/store/state/notification/hooks.js | 5 +++-- 9 files changed, 26 insertions(+), 39 deletions(-) diff --git a/ui/src/components/ImportButton/import-current-button.jsx b/ui/src/components/ImportButton/import-current-button.jsx index ef49ad28..d7c8b880 100644 --- a/ui/src/components/ImportButton/import-current-button.jsx +++ b/ui/src/components/ImportButton/import-current-button.jsx @@ -8,8 +8,8 @@ const { useImportCurrentDataMutation } = modelsApiSlice; function ImportCurrentDatasetButton({ type = 'primary-light' }) { const { uuid: modelUUID } = useParams(); - const [triggerImportFeedback, { isLoading, isError }] = useImportCurrentDataMutation({ fixedCacheKey: `imports-reference-data-${modelUUID}` }); - const isSubmitDisabled = isLoading || isError; + const [triggerImportFeedback, { isLoading }] = useImportCurrentDataMutation({ fixedCacheKey: `imports-reference-data-${modelUUID}` }); + const isSubmitDisabled = isLoading; const disableUploadAction = () => false; diff --git a/ui/src/container/models/Details/current/imports/columns.jsx b/ui/src/container/models/Details/current/imports/columns.jsx index 48a5b05f..deb5f7a6 100644 --- a/ui/src/container/models/Details/current/imports/columns.jsx +++ b/ui/src/container/models/Details/current/imports/columns.jsx @@ -6,13 +6,6 @@ import moment from 'moment'; import { DataTableAction, FontAwesomeIcon, Spinner } from '@radicalbit/radicalbit-design-system'; export const getColumns = (activeFilters, activeSorter) => [ - columnFactory({ - title: 'File name', - dataIndex: 'fileName', - key: 'fileName', - activeFilters, - activeSorter, - }), columnFactory({ title: 'File path', dataIndex: 'path', diff --git a/ui/src/container/models/Details/current/imports/index.jsx b/ui/src/container/models/Details/current/imports/index.jsx index f4aa4e5a..9af58b43 100644 --- a/ui/src/container/models/Details/current/imports/index.jsx +++ b/ui/src/container/models/Details/current/imports/index.jsx @@ -59,19 +59,13 @@ function FeedbackTable() { const queryParams = useSelector((state) => contextConfigurationSelectors.selectQueryParamsSelector(state, NamespaceEnum.CURRENT_IMPORT)); const { data } = useGetCurrentImportsQuery({ uuid: modelUUID, queryParams }); - const importList = data?.items.map((item) => ({ - ...item, - fileName: item.path.split('current/')[1], - path: `${item.path.split('current/')[0]}current/`, - errorEntries: 0, - entries: 100, - })) ?? []; + const items = data?.items || []; const recordCount = data?.total; return ( }, - { label: 'Variables', key: OVERVIEW_TABS_ENUM.VARIABLES, children: }, - { label: 'Outputs', key: OVERVIEW_TABS_ENUM.OUTPUTS, children: }, + { + label: 'Summary', + key: OVERVIEW_TABS_ENUM.SUMMARY, + children: , + }, + { + label: 'Variables', + key: OVERVIEW_TABS_ENUM.VARIABLES, + children: , + }, + { + label: 'Outputs', + key: OVERVIEW_TABS_ENUM.OUTPUTS, + children: , + }, ]; return ( diff --git a/ui/src/container/models/Details/reference/imports/columns.jsx b/ui/src/container/models/Details/reference/imports/columns.jsx index 237feefe..10441545 100644 --- a/ui/src/container/models/Details/reference/imports/columns.jsx +++ b/ui/src/container/models/Details/reference/imports/columns.jsx @@ -5,13 +5,6 @@ import moment from 'moment'; import { FontAwesomeIcon, Spinner } from '@radicalbit/radicalbit-design-system'; export const getColumns = (activeFilters, activeSorter) => [ - columnFactory({ - title: 'File name', - dataIndex: 'fileName', - key: 'fileName', - activeFilters, - activeSorter, - }), columnFactory({ title: 'File path', dataIndex: 'path', diff --git a/ui/src/container/models/Details/reference/imports/index.jsx b/ui/src/container/models/Details/reference/imports/index.jsx index dbe91663..362d98f5 100644 --- a/ui/src/container/models/Details/reference/imports/index.jsx +++ b/ui/src/container/models/Details/reference/imports/index.jsx @@ -43,19 +43,13 @@ function FeedbackTable() { const { uuid: modelUUID } = useParams(); const { data } = useGetReferenceImportsQuery({ uuid: modelUUID }); - const importList = data?.items.map((item) => ({ - ...item, - fileName: item.path.split('reference/')[1], - path: `${item.path.split('reference/')[0]}reference/`, - errorEntries: 0, - entries: 100, - })) ?? []; + const items = data?.items || []; const recordCount = data?.total; return ( (next) => (action) => { const error2 = action.payload?.data?.error?.message; // likes models-repo errors const error3 = action.payload?.data; const message = error1 || error2 || error3 || 'generic error'; - const notificationMessage = notificationErrorJson({ status, statusText: message }); + const notificationMessage = notificationErrorJson({ status, message }); dispatch(setNotificationMessage(notificationMessage)); } diff --git a/ui/src/store/state/notification/hooks.js b/ui/src/store/state/notification/hooks.js index 2e28a4d9..3d45c97c 100644 --- a/ui/src/store/state/notification/hooks.js +++ b/ui/src/store/state/notification/hooks.js @@ -11,10 +11,11 @@ const useNotification = () => { const notificationMessage = useSelector(selectNotificationMessage); const notificationShowMessage = useSelector(selectNotificationShowMessage); + console.debug(notificationMessage); useEffect(() => { if (notificationShowMessage) { - const { type, title } = notificationMessage; - Message[type](title); + const { type, title, content } = notificationMessage; + Message[type]({ title, content }); dispatch(resetNotificationMessage()); }