Commit 23739229 authored by mehdilouraoui's avatar mehdilouraoui
Browse files

refactor(backgound-info): allow user to open exported file

parent f5289a75
......@@ -57,9 +57,6 @@ const BackgroundLoadingInfo: FC<BackgroundLoadingInfoProps> = ({
loadingInfo.goal - 1 === loadingInfo.progress,
[]
);
// const showInFolderExportedFile = useCallback((loadingInfo: LoadingInfo) =>
// isLoaded(loadingInfo) ? openExternalElement() : null[loadingItems]
// );
const selectLabel = useCallback(
(loadingInfo: LoadingInfo) =>
......
......@@ -27,12 +27,14 @@ type LoadingInfoProps = {
loadingInfo: LoadingInfo;
color: string;
label: string;
isLoaded: boolean;
};
const LoadingInfoDisplay: FC<LoadingInfoProps> = ({
loadingInfo,
color = "black",
label,
isLoaded,
}) => (
<LoadingBarContainer color={color}>
<LoadingBarName>{label || loadingInfo.label}</LoadingBarName>
......
......@@ -28,6 +28,7 @@ const ExportModalContentContainer: FC<ExportModalContentContainerProps> = ({
type: ActionType.TRACK_EVENT,
});
dispatch(exportFunction(exportPath));
console.log(exportId);
};
return (
......
......@@ -21,7 +21,6 @@ export const treeCsvExporterThunk = (
const state = getState();
const filesAndFolders = getFilesAndFoldersFromStore(state);
// We remove the root element and add the header line
const totalProgress = Object.keys(filesAndFolders).length;
const loaderMessage = translations.t("export.creatingTreeCsvExport");
......
......@@ -53,11 +53,13 @@ const success = (t: TFunction, filePath: string) => () =>
export const deletionScriptExporterThunk = (
filePath: string
): ArchifiltreThunkAction => (dispatch, getState) =>
compose(
): ArchifiltreThunkAction => (dispatch, getState) => {
console.log(filePath);
return compose(
liftPromise(success(translations.t.bind(translations), filePath)),
curriedWriteFile(filePath),
({ originalPath, elementsToDelete }) =>
generateDeletionScript(originalPath, elementsToDelete),
extractParamsFromState
)(getState());
};
......@@ -4,6 +4,7 @@ export const START_LOADING = "LOADING_INFO/START_LOADING";
export const UPDATE_LOADING = "LOADING_INFO/UPDATE_LOADING";
export const PROGRESS_LOADING = "LOADING_INFO/PROGRESS_LOADING";
export const COMPLETE_LOADING = "LOADING_INFO/COMPLETE_LOADING";
export const ADD_EXPORTED_PATH = "LOADING_INFO/ADD_EXPORTED_PATH";
export const REGISTER_ERROR = "LOADING_INFO/REGISTER_ERROR";
export const RESET_LOADING = "LOADING_INFO/RESET_LOADING";
export const DISMISS_ALL_COMPLETE = "LOADING_INFO/DISMISS_ALL_COMPLETE";
......@@ -20,6 +21,7 @@ export interface LoadingInfo {
goal: number;
label: string;
loadedLabel: string;
exportedPath?: string;
}
export interface LoadingInfoMap {
......@@ -41,6 +43,7 @@ interface StartLoadingAction {
goal: number;
label: string;
loadedLabel: string;
exportedPath?: string;
}
interface UpdateLoadingAction {
......@@ -61,6 +64,12 @@ interface CompleteLoadingAction {
id: string;
}
interface AddExportedPathAction {
type: typeof ADD_EXPORTED_PATH;
id: string;
exportedPath: string;
}
interface RegisterErrorAction {
type: typeof REGISTER_ERROR;
error: ArchifiltreError;
......@@ -81,4 +90,5 @@ export type LoadingInfoAction =
| CompleteLoadingAction
| RegisterErrorAction
| ResetLoadingAction
| DismissAllComplete;
| DismissAllComplete
| AddExportedPathAction;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment