From cdc82e59063fb48cd824e4feaa6806a4f9bb24d1 Mon Sep 17 00:00:00 2001 From: Brian Whitney Date: Thu, 31 Oct 2024 15:50:26 -0700 Subject: [PATCH] remove loc target --- .../Modal/MoveFileManifest/index.tsx | 13 +++------- .../core/hooks/useFileAccessContextMenu.ts | 26 +++++++++---------- packages/core/state/interaction/actions.ts | 12 ++------- packages/core/state/interaction/logics.ts | 4 +-- packages/core/state/interaction/reducer.ts | 10 +------ packages/core/state/interaction/selectors.ts | 1 - 6 files changed, 21 insertions(+), 45 deletions(-) diff --git a/packages/core/components/Modal/MoveFileManifest/index.tsx b/packages/core/components/Modal/MoveFileManifest/index.tsx index de9fac41..41611686 100644 --- a/packages/core/components/Modal/MoveFileManifest/index.tsx +++ b/packages/core/components/Modal/MoveFileManifest/index.tsx @@ -21,7 +21,6 @@ export default function MoveFileManifest({ onDismiss }: ModalProps) { selection.selectors.getFileSelection, FileSelection.selectionsAreEqual ); - const moveFileTarget = useSelector(interaction.selectors.getMoveFileTarget); const [fileDetails, setFileDetails] = React.useState([]); const [totalSize, setTotalSize] = React.useState(); @@ -43,14 +42,8 @@ export default function MoveFileManifest({ onDismiss }: ModalProps) { }, [fileSelection, fileService]); const onMove = () => { - if (moveFileTarget) { - dispatch(interaction.actions.moveFiles(fileDetails, moveFileTarget)); - onDismiss(); - } else { - console.warn( - "Move file target location is undefined. Cannot proceed with moving files." - ); - } + dispatch(interaction.actions.moveFiles(fileDetails)); + onDismiss(); }; const body = ( @@ -93,7 +86,7 @@ export default function MoveFileManifest({ onDismiss }: ModalProps) { /> } onDismiss={onDismiss} - title={`Move Files to ${moveFileTarget}`} + title="Move Files to NAS Cache" /> ); } diff --git a/packages/core/hooks/useFileAccessContextMenu.ts b/packages/core/hooks/useFileAccessContextMenu.ts index 7381316f..372c25e1 100644 --- a/packages/core/hooks/useFileAccessContextMenu.ts +++ b/packages/core/hooks/useFileAccessContextMenu.ts @@ -135,18 +135,6 @@ export default (filters?: FileFilter[], onDismiss?: () => void) => { ], }, }, - { - key: "download", - text: "Download", - title: "Download selected files to a specific directory", - disabled: !filters && fileSelection.count() === 0, - iconProps: { - iconName: "Download", - }, - onClick() { - dispatch(interaction.actions.downloadFiles()); - }, - }, ...(isQueryingAicsFms ? [ { @@ -156,11 +144,23 @@ export default (filters?: FileFilter[], onDismiss?: () => void) => { disabled: !filters && fileSelection.count() === 0, iconProps: { iconName: "MoveToFolder" }, onClick() { - dispatch(interaction.actions.showMoveFileManifest("NAS")); + dispatch(interaction.actions.showMoveFileManifest()); }, }, ] : []), + { + key: "download", + text: "Download", + title: "Download selected files to a specific directory", + disabled: !filters && fileSelection.count() === 0, + iconProps: { + iconName: "Download", + }, + onClick() { + dispatch(interaction.actions.downloadFiles()); + }, + }, ]; dispatch( diff --git a/packages/core/state/interaction/actions.ts b/packages/core/state/interaction/actions.ts index 7c9d79ca..7f85149c 100644 --- a/packages/core/state/interaction/actions.ts +++ b/packages/core/state/interaction/actions.ts @@ -690,17 +690,11 @@ export const SHOW_MOVE_FILE_MANIFEST = makeConstant(STATE_BRANCH_NAME, "show-mov export interface ShowMoveFileManifestAction { type: string; - payload: { - target: string; - }; } -export function showMoveFileManifest(target: string): ShowMoveFileManifestAction { +export function showMoveFileManifest(): ShowMoveFileManifestAction { return { type: SHOW_MOVE_FILE_MANIFEST, - payload: { - target, - }, }; } @@ -710,16 +704,14 @@ export interface MoveFilesAction { type: string; payload: { fileDetails: FileDetail[]; - target: string; }; } -export function moveFiles(fileDetails: FileDetail[], target: string): MoveFilesAction { +export function moveFiles(fileDetails: FileDetail[]): MoveFilesAction { return { type: MOVE_FILES, payload: { fileDetails, - target, }, }; } diff --git a/packages/core/state/interaction/logics.ts b/packages/core/state/interaction/logics.ts index 4a882aa5..3e70a360 100644 --- a/packages/core/state/interaction/logics.ts +++ b/packages/core/state/interaction/logics.ts @@ -579,13 +579,13 @@ const setIsSmallScreen = createLogic({ /** * Interceptor responsible for handling the MOVE_FILES action. - * Logs the target location for file movement in the console. + * Logs details of files that are being moved. */ const moveFilesLogic = createLogic({ type: MOVE_FILES, process(deps, dispatch, done) { const action = deps.action as MoveFilesAction; - console.log(`Moving files to location: ${action.payload.target}`); + console.log(`Moving files:`, action.payload.fileDetails); done(); }, }); diff --git a/packages/core/state/interaction/reducer.ts b/packages/core/state/interaction/reducer.ts index 07655889..158108c5 100644 --- a/packages/core/state/interaction/reducer.ts +++ b/packages/core/state/interaction/reducer.ts @@ -20,7 +20,6 @@ import { MARK_AS_USED_APPLICATION_BEFORE, MARK_AS_DISMISSED_SMALL_SCREEN_WARNING, ShowManifestDownloadDialogAction, - ShowMoveFileManifestAction, SET_IS_AICS_EMPLOYEE, PROMPT_FOR_DATA_SOURCE, DownloadManifestAction, @@ -59,7 +58,6 @@ export interface InteractionStateBranch { hasUsedApplicationBefore: boolean; isAicsEmployee?: boolean; isOnWeb: boolean; - moveFileTarget?: string; platformDependentServices: PlatformDependentServices; refreshKey?: string; selectedPublicDataset?: PublicDataset; @@ -71,10 +69,6 @@ export interface InteractionStateBranch { export const initialState: InteractionStateBranch = { contextMenuIsVisible: false, contextMenuItems: [], - // Passed to `ContextualMenu` as `target`. From the "@fluentui/react" docs: - // "The target that ContextualMenu should try to position itself based on. - // It can be either an element, a query selector string resolving to a valid element, or a MouseEvent. - // If a MouseEvent is given, the origin point of the event will be used." contextMenuPositionReference: null, datasetDetailsPanelIsVisible: false, fileExplorerServiceBaseUrl: DEFAULT_CONNECTION_CONFIG.baseUrl, @@ -90,7 +84,6 @@ export const initialState: InteractionStateBranch = { fileViewerService: new FileViewerServiceNoop(), frontendInsights: new FrontendInsights({ application: { - // Kept old name to compare usage more easily in Amplitude UI name: "FMS File Explorer", version: "0.0.0-noop", }, @@ -198,10 +191,9 @@ export default makeReducer( ...state, selectedPublicDataset: action.payload, }), - [SHOW_MOVE_FILE_MANIFEST]: (state, action: ShowMoveFileManifestAction) => ({ + [SHOW_MOVE_FILE_MANIFEST]: (state) => ({ ...state, visibleModal: ModalType.MoveFileManifest, - moveFileTarget: action.payload.target, }), }, initialState diff --git a/packages/core/state/interaction/selectors.ts b/packages/core/state/interaction/selectors.ts index bf7096df..ec880228 100644 --- a/packages/core/state/interaction/selectors.ts +++ b/packages/core/state/interaction/selectors.ts @@ -47,7 +47,6 @@ export const getUserSelectedApplications = (state: State) => state.interaction.userSelectedApplications; export const getVisibleModal = (state: State) => state.interaction.visibleModal; export const isAicsEmployee = (state: State) => state.interaction.isAicsEmployee; -export const getMoveFileTarget = (state: State) => state.interaction.moveFileTarget; // COMPOSED SELECTORS export const getApplicationVersion = createSelector(