Web: Files: Added toast for success conversion.

This commit is contained in:
Tatiana Lopaeva 2022-01-11 18:48:09 +03:00
parent 6ba659ac04
commit 1941ceee28
2 changed files with 27 additions and 11 deletions

View File

@ -55,7 +55,7 @@ const ConvertDialogComponent = (props) => {
action: "convert",
};
item.fileInfo = convertItem;
convertFile(item);
convertFile(item, t);
} else {
hideMessage && hideConfirmConvert();
convertUploadedFiles(t);

View File

@ -17,7 +17,7 @@ import {
moveToFolder,
fileCopyAs,
} from "@appserver/common/api/files";
import toastr from "studio/toastr";
class UploadDataStore {
formatsStore;
treeFoldersStore;
@ -198,7 +198,7 @@ class UploadDataStore {
this.setUploadData(newUploadData);
};
convertFile = (file) => {
convertFile = (file, t) => {
this.dialogsStore.setConvertItem(null);
const alreadyConverting = this.files.some(
@ -218,7 +218,7 @@ class UploadDataStore {
if (!this.filesToConversion.length) {
this.filesToConversion.push(file);
this.startConversion();
this.startConversion(t);
} else {
this.filesToConversion.push(file);
}
@ -276,7 +276,7 @@ class UploadDataStore {
return (fileIndex / length) * 100;
};
startConversion = async () => {
startConversion = async (t) => {
const {
isRecentFolder,
isFavoritesFolder,
@ -344,6 +344,7 @@ class UploadDataStore {
if (progress === 100) {
runInAction(() => {
const file = this.files.find((file) => file.fileId === fileId);
if (file) {
file.convertProgress = progress;
file.inConversion = false;
@ -357,6 +358,21 @@ class UploadDataStore {
file.fileInfo = fileInfo;
needToRefreshFilesList && this.refreshFiles(file);
}
if (file && (isRecentFolder || isFavoritesFolder || isShareFolder)) {
const folderId = file.fileInfo?.folderId;
const fileTitle = file.fileInfo?.title;
folderId &&
getFolderInfo(folderId).then((folderInfo) =>
toastr.success(
t("FileConversionCompleted", {
fileTitle,
folderTitle: folderInfo.title,
})
)
);
}
const percent = this.getConversationPercent(index + 1);
this.setConversionPercent(percent, !!error);
}
@ -502,12 +518,12 @@ class UploadDataStore {
}
}
if (
if (
newPath[newPath.length - 1] !== this.selectedFolderStore.id &&
path.length
) {
) {
return;
}
}
const addNewFile = () => {
if (folderInfo) {
@ -573,7 +589,7 @@ class UploadDataStore {
const newExpandedKeys = expandedKeys.filter(
(x) => x !== newPath[newPath.length - 1] + ""
);
);
setExpandedKeys(newExpandedKeys);
@ -583,7 +599,7 @@ class UploadDataStore {
this.filesStore.folders.length === 1 ? this.filesStore.folders : [],
this.filesStore.folders.length
);
}
}
}
};
@ -668,7 +684,7 @@ class UploadDataStore {
} else {
if (currentFile.action === "uploaded") {
this.refreshFiles(currentFile);
}
}
return Promise.resolve();
}
};