From a197aeda9dbf489064bb3c7087fa2d039cf1d696 Mon Sep 17 00:00:00 2001 From: Nidhi Bhat G Date: Fri, 14 Jun 2024 19:26:25 +0530 Subject: [PATCH] [ui-storageBrowser]Handle errors and improvements --- .../StorageBrowserActions/StorageBrowserActions.tsx | 9 +++++---- .../StorageBrowserTable/StorageBrowserTable.tsx | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserActions/StorageBrowserActions.tsx b/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserActions/StorageBrowserActions.tsx index ac5f9d08844..7738e6b0c7d 100644 --- a/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserActions/StorageBrowserActions.tsx +++ b/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserActions/StorageBrowserActions.tsx @@ -41,10 +41,11 @@ const StorageBrowserActions = ({ selectedFiles }: StorageBrowserRowActionsProps) const { t } = i18nReact.useTranslation(); const isSummaryEnabled = () => { + const selectedFile = selectedFiles[0]; return ( selectedFiles.length == 1 && - (isHDFS(selectedFiles[0].path) || isOFS(selectedFiles[0].path)) && - selectedFiles[0].type === 'file' + (isHDFS(selectedFile.path) || isOFS(selectedFile.path)) && + selectedFile.type === 'file' ); }; @@ -74,8 +75,8 @@ const StorageBrowserActions = ({ selectedFiles }: StorageBrowserRowActionsProps) }} trigger={['click', 'hover']} > - diff --git a/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserTable/StorageBrowserTable.tsx b/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserTable/StorageBrowserTable.tsx index 3191c196a86..0fece426008 100644 --- a/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserTable/StorageBrowserTable.tsx +++ b/desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserTable/StorageBrowserTable.tsx @@ -32,6 +32,7 @@ import { PrimaryButton } from 'cuix/dist/components/Button'; import Table from 'cuix/dist/components/Table'; import { i18nReact } from '../../../../utils/i18nReact'; +import huePubSub from '../../../../utils/huePubSub'; import { mkdir, touch } from '../../../../reactComponents/FileChooser/api'; import { PageStats, @@ -226,8 +227,8 @@ const StorageBrowserTable = ({ setRefreshKey(oldKey => oldKey + 1); }) .catch(error => { - // eslint-disable-next-line no-restricted-syntax - console.log(error); + huePubSub.publish('hue.error', error); + setShowNewFolderModal(false); }) .finally(() => { setLoadingFiles(false); @@ -241,8 +242,8 @@ const StorageBrowserTable = ({ setRefreshKey(oldKey => oldKey + 1); }) .catch(error => { - // eslint-disable-next-line no-restricted-syntax - console.log(error); + huePubSub.publish('hue.error', error); + setShowNewFileModal(false); }) .finally(() => { setLoadingFiles(false);