Skip to content

Commit

Permalink
remove loc target
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianWhitneyAI committed Oct 31, 2024
1 parent 1bc859f commit cdc82e5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 45 deletions.
13 changes: 3 additions & 10 deletions packages/core/components/Modal/MoveFileManifest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileDetail[]>([]);
const [totalSize, setTotalSize] = React.useState<string | undefined>();
Expand All @@ -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 = (
Expand Down Expand Up @@ -93,7 +86,7 @@ export default function MoveFileManifest({ onDismiss }: ModalProps) {
/>
}
onDismiss={onDismiss}
title={`Move Files to ${moveFileTarget}`}
title="Move Files to NAS Cache"
/>
);
}
26 changes: 13 additions & 13 deletions packages/core/hooks/useFileAccessContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
? [
{
Expand All @@ -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(
Expand Down
12 changes: 2 additions & 10 deletions packages/core/state/interaction/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
}

Expand All @@ -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,
},
};
}
4 changes: 2 additions & 2 deletions packages/core/state/interaction/logics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
});
Expand Down
10 changes: 1 addition & 9 deletions packages/core/state/interaction/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -59,7 +58,6 @@ export interface InteractionStateBranch {
hasUsedApplicationBefore: boolean;
isAicsEmployee?: boolean;
isOnWeb: boolean;
moveFileTarget?: string;
platformDependentServices: PlatformDependentServices;
refreshKey?: string;
selectedPublicDataset?: PublicDataset;
Expand All @@ -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,
Expand All @@ -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",
},
Expand Down Expand Up @@ -198,10 +191,9 @@ export default makeReducer<InteractionStateBranch>(
...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
Expand Down
1 change: 0 additions & 1 deletion packages/core/state/interaction/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit cdc82e5

Please sign in to comment.