Fixed Bug 68975 - Rooms.FormRoom.Quota. There is no message about quota being exceeded when trying to copy a PDF form into Form Room through the Start filling button in the editor.

This commit is contained in:
Timofey Boyko 2024-07-08 16:19:51 +03:00
parent 7a8c4dcfab
commit f9fb0e1964

View File

@ -27,7 +27,7 @@
import { useCallback, useRef, useState } from "react"; import { useCallback, useRef, useState } from "react";
import { ConflictResolveType } from "@docspace/shared/enums"; import { ConflictResolveType } from "@docspace/shared/enums";
import { checkFileConflicts, copyToFolder } from "@docspace/shared/api/files"; import { copyToFolder, getProgress } from "@docspace/shared/api/files";
// import { getOperationProgress } from "@docspace/shared/utils/getOperationProgress"; // import { getOperationProgress } from "@docspace/shared/utils/getOperationProgress";
import type { import type {
@ -40,9 +40,13 @@ import type {
import type { TRoomSecurity } from "@docspace/shared/api/rooms/types"; import type { TRoomSecurity } from "@docspace/shared/api/rooms/types";
import type { TBreadCrumb } from "@docspace/shared/components/selector/Selector.types"; import type { TBreadCrumb } from "@docspace/shared/components/selector/Selector.types";
import type { TSelectedFileInfo } from "@docspace/shared/selectors/Files/FilesSelector.types"; import type { TSelectedFileInfo } from "@docspace/shared/selectors/Files/FilesSelector.types";
import type { ConflictStateType } from "@/types"; import { toastr } from "@docspace/shared/components/toast";
import { TData } from "@docspace/shared/components/toast/Toast.type";
// import { useTranslation } from "react-i18next"; // import { useTranslation } from "react-i18next";
import type { ConflictStateType } from "@/types";
const DefaultConflictDataDialogState: ConflictStateType = { const DefaultConflictDataDialogState: ConflictStateType = {
visible: false, visible: false,
resolve: () => {}, resolve: () => {},
@ -115,7 +119,6 @@ const useStartFillingSelectDialog = (fileInfo: TFile | undefined) => {
const url = new URL(`${window.location.origin}/rooms/shared/filter`); const url = new URL(`${window.location.origin}/rooms/shared/filter`);
url.searchParams.set("folder", selectedItemId.toString()); url.searchParams.set("folder", selectedItemId.toString());
window.location.replace(url.toString());
// const hasConfictFiles = await checkFileConflicts( // const hasConfictFiles = await checkFileConflicts(
// selectedItemId, // selectedItemId,
@ -136,7 +139,8 @@ const useStartFillingSelectDialog = (fileInfo: TFile | undefined) => {
// } // }
// } // }
copyToFolder( try {
await copyToFolder(
Number(selectedItemId), Number(selectedItemId),
[], [],
[fileInfo.id], [fileInfo.id],
@ -144,9 +148,29 @@ const useStartFillingSelectDialog = (fileInfo: TFile | undefined) => {
false, false,
); );
requestRunning.current = false; const error = await new Promise((resolve) => {
const interval = setInterval(async () => {
const [progress] = await getProgress();
if (progress?.finished) {
clearInterval(interval);
resolve(progress.error);
}
}, 1000);
});
if (error) {
toastr.error(error);
} else {
window.location.replace(url.toString());
onClose(); onClose();
}
} catch (e) {
toastr.error(e as TData);
onClose();
} finally {
requestRunning.current = false;
}
}; };
const getIsDisabled = ( const getIsDisabled = (