From 70b7cdabdd9546724132ecef29ce5b8d5cf5d2ed Mon Sep 17 00:00:00 2001 From: Sarah Gray Date: Thu, 3 Oct 2024 16:34:20 -0500 Subject: [PATCH 1/3] adding in separate canMove check for toolbar Move button --- .../datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx index 3bc79721e..6074e0f4b 100644 --- a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx +++ b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx @@ -96,6 +96,11 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ user && selectedFiles.length >= 1 && !selectedFiles[0].path.endsWith('.hazmapper'), + canMove: + user && + selectedFiles.length>= 1 && + !isReadOnly && + !selectedFiles[0].path.endsWith('.hazmapper'), canTrash: user && selectedFiles.length >= 1 && @@ -138,7 +143,7 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ {({ onClick }) => ( From 23b765c55d0438f63dba689be1fb03ee223367ee Mon Sep 17 00:00:00 2001 From: Nathan Franklin Date: Thu, 3 Oct 2024 19:40:26 -0500 Subject: [PATCH 2/3] Fix linting --- .../modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx index 6074e0f4b..3f44421b5 100644 --- a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx +++ b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx @@ -98,7 +98,7 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ !selectedFiles[0].path.endsWith('.hazmapper'), canMove: user && - selectedFiles.length>= 1 && + selectedFiles.length >= 1 && !isReadOnly && !selectedFiles[0].path.endsWith('.hazmapper'), canTrash: From c19f58b0153940ea30eab7b59d2e0a27e28de9b5 Mon Sep 17 00:00:00 2001 From: Nathan Franklin Date: Thu, 3 Oct 2024 19:51:33 -0500 Subject: [PATCH 3/3] Fix check for hazmapper files --- .../src/DatafilesToolbar/DatafilesToolbar.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx index 3f44421b5..15689d998 100644 --- a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx +++ b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx @@ -83,6 +83,11 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ const rules = useMemo( function () { + // Check if none of the selected files end with `.hazmapper`. + const notContainingHazmapperFile = selectedFiles.every( + (file) => !file.path.endsWith('.hazmapper') + ); + // Rules for which toolbar buttons are active for a given selection. return { canPreview: @@ -91,26 +96,24 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ user && selectedFiles.length === 1 && !isReadOnly && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, canCopy: - user && - selectedFiles.length >= 1 && - !selectedFiles[0].path.endsWith('.hazmapper'), + user && selectedFiles.length >= 1 && notContainingHazmapperFile, canMove: user && selectedFiles.length >= 1 && !isReadOnly && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, canTrash: user && selectedFiles.length >= 1 && !isReadOnly && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, // Disable downloads from frontera.work until we have a non-flaky mount on ds-download. canDownload: selectedFiles.length >= 1 && system !== USER_WORK_SYSTEM && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, }; }, [selectedFiles, isReadOnly, user, system]