Client: added toast if an error occurs when change index
This commit is contained in:
parent
d90c1a1c74
commit
afcd61e64e
@ -65,6 +65,7 @@
|
||||
"EmptyScreenFolder": "No docs here yet",
|
||||
"EnableLink": "Enable link",
|
||||
"EnableNotifications": "Enable notifications",
|
||||
"ErrorChangeIndex": "Error when changing index. The problem may be caused on the server side. Reload the page or check your Internet connection settings.",
|
||||
"ExcludeSubfolders": "Exclude subfolders",
|
||||
"FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.",
|
||||
"FileContents": "File contents",
|
||||
|
@ -65,6 +65,7 @@
|
||||
"EmptyScreenFolder": "Здесь пока нет документов",
|
||||
"EnableLink": "Активировать ссылку",
|
||||
"EnableNotifications": "Включить уведомления",
|
||||
"ErrorChangeIndex": "Ошибка при изменении индекса. Проблема может быть вызвана на стороне сервера. Перезагрузите страницу или проверьте настройки подключения к Интернету.",
|
||||
"ExcludeSubfolders": "Исключить вложенные папки",
|
||||
"FavoritesEmptyContainerDescription": "Чтобы добавить файлы в избранное или удалить их из этого списка, используйте контекстное меню.",
|
||||
"FileContents": "Содержимое файла",
|
||||
|
@ -25,8 +25,10 @@
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import React from "react";
|
||||
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TTranslation } from "@docspace/shared/types";
|
||||
|
||||
import {
|
||||
ModalDialog,
|
||||
@ -42,7 +44,7 @@ import FilesActionsStore from "SRC_DIR/store/FilesActionsStore";
|
||||
import { TSelectedFolder } from "@docspace/client/src/store/SelectedFolderStore";
|
||||
|
||||
export interface ReorderIndexDialogProps {
|
||||
reorder: (id: number | string | null) => void;
|
||||
reorder: (id: number | string | null, t: TTranslation) => void;
|
||||
setIsVisible: (visible: boolean) => void;
|
||||
visible: boolean;
|
||||
selectedFolder: TSelectedFolder;
|
||||
@ -61,7 +63,7 @@ const ReorderIndexDialog = ({
|
||||
};
|
||||
|
||||
const onReorder = () => {
|
||||
reorder(selectedFolder?.id);
|
||||
reorder(selectedFolder?.id, t);
|
||||
setIsVisible(false);
|
||||
};
|
||||
|
||||
|
@ -361,6 +361,7 @@ StyledSimpleFilesRow.defaultProps = { theme: Base };
|
||||
|
||||
const SimpleFilesRow = (props) => {
|
||||
const {
|
||||
t,
|
||||
item,
|
||||
sectionWidth,
|
||||
dragging,
|
||||
@ -407,7 +408,7 @@ const SimpleFilesRow = (props) => {
|
||||
const isSmallContainer = sectionWidth <= 500;
|
||||
|
||||
const onChangeIndex = (action) => {
|
||||
return changeIndex(action, item);
|
||||
return changeIndex(action, item, t);
|
||||
};
|
||||
|
||||
const element = (
|
||||
|
@ -111,7 +111,7 @@ const FilesTableRow = (props) => {
|
||||
};
|
||||
|
||||
const onChangeIndex = (action) => {
|
||||
return onEditIndex(action, item);
|
||||
return onEditIndex(action, item, t);
|
||||
};
|
||||
|
||||
const onDragOverEvent = (dragActive, e) => {
|
||||
|
@ -332,7 +332,7 @@ const SectionBodyContent = (props) => {
|
||||
|
||||
if (!replaceable) return;
|
||||
|
||||
changeIndex(VDRIndexingAction.MoveIndex, replaceable);
|
||||
changeIndex(VDRIndexingAction.MoveIndex, replaceable, t);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -2719,7 +2719,7 @@ class FilesActionStore {
|
||||
await deleteFilesFromRecent(fileIds);
|
||||
await refreshFiles();
|
||||
};
|
||||
changeIndex = async (action, item) => {
|
||||
changeIndex = async (action, item, t) => {
|
||||
const { filesList } = this.filesStore;
|
||||
|
||||
const index = filesList.findIndex(
|
||||
@ -2762,19 +2762,27 @@ class FilesActionStore {
|
||||
|
||||
if (!replaceable) return;
|
||||
|
||||
await changeIndex(current?.id, replaceable.order, current?.isFolder);
|
||||
try {
|
||||
await changeIndex(current?.id, replaceable.order, current?.isFolder);
|
||||
|
||||
const items = [current, replaceable];
|
||||
setUpdateItems(items);
|
||||
const items = [current, replaceable];
|
||||
setUpdateItems(items);
|
||||
|
||||
const operationId = uniqueid("operation_");
|
||||
this.updateCurrentFolder(null, [id], true, operationId);
|
||||
const operationId = uniqueid("operation_");
|
||||
this.updateCurrentFolder(null, [id], true, operationId);
|
||||
} catch (e) {
|
||||
toastr.error(t("Files:ErrorChangeIndex"));
|
||||
}
|
||||
};
|
||||
|
||||
reorder = async (id) => {
|
||||
const operationId = uniqueid("operation_");
|
||||
await reorder(id);
|
||||
this.updateCurrentFolder(null, [id], true, operationId);
|
||||
reorder = async (id, t) => {
|
||||
try {
|
||||
const operationId = uniqueid("operation_");
|
||||
await reorder(id);
|
||||
this.updateCurrentFolder(null, [id], true, operationId);
|
||||
} catch (e) {
|
||||
toastr.error(t("Files:ErrorChangeIndex"));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user