Client: Add export room index to list and info panel context menu
This commit is contained in:
parent
ee89a8a40b
commit
e5dd58ac08
@ -294,7 +294,7 @@ const SectionHeaderContent = (props) => {
|
|||||||
startUpload,
|
startUpload,
|
||||||
getFolderModel,
|
getFolderModel,
|
||||||
onCreateRoom,
|
onCreateRoom,
|
||||||
onClickExportRoomIndex,
|
onExportRoomIndex,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -446,41 +446,6 @@ const SectionHeaderContent = (props) => {
|
|||||||
toastr.success(t("Translations:LinkCopySuccess"));
|
toastr.success(t("Translations:LinkCopySuccess"));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onExportRoomIndex = async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
|
|
||||||
const result = await onClickExportRoomIndex(selectedFolder?.id);
|
|
||||||
if (!result) return;
|
|
||||||
|
|
||||||
const urlWithProxy = combineUrl(
|
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
|
||||||
result.fileUrl,
|
|
||||||
);
|
|
||||||
|
|
||||||
const toastMessage = (
|
|
||||||
<>
|
|
||||||
<Link
|
|
||||||
color="#5299E0"
|
|
||||||
fontSize="12px"
|
|
||||||
target="_blank"
|
|
||||||
href={urlWithProxy}
|
|
||||||
>
|
|
||||||
{result.fileName}
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
<Text as="span" fontSize="12px">
|
|
||||||
{t("Files:FileExportedToMyDocuments")}
|
|
||||||
</Text>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
|
|
||||||
toastr.success(toastMessage);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteRoomInArchive = () => {
|
const onDeleteRoomInArchive = () => {
|
||||||
setSelection([selectedFolder]);
|
setSelection([selectedFolder]);
|
||||||
deleteRooms(t);
|
deleteRooms(t);
|
||||||
@ -674,7 +639,7 @@ const SectionHeaderContent = (props) => {
|
|||||||
key: "export-room-index",
|
key: "export-room-index",
|
||||||
label: t("Files:ExportRoomIndex"),
|
label: t("Files:ExportRoomIndex"),
|
||||||
icon: DownloadReactSvgUrl,
|
icon: DownloadReactSvgUrl,
|
||||||
onClick: onExportRoomIndex,
|
onClick: () => onExportRoomIndex(t, selectedFolder?.id),
|
||||||
disabled: !isVDRRoomType || !selectedFolder.indexing,
|
disabled: !isVDRRoomType || !selectedFolder.indexing,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1227,7 +1192,7 @@ export default inject(
|
|||||||
onCreateAndCopySharedLink,
|
onCreateAndCopySharedLink,
|
||||||
getFolderModel,
|
getFolderModel,
|
||||||
onCreateRoom,
|
onCreateRoom,
|
||||||
onClickExportRoomIndex,
|
onExportRoomIndex,
|
||||||
} = contextOptionsStore;
|
} = contextOptionsStore;
|
||||||
|
|
||||||
const canRestoreAll = isArchiveFolder && roomsForRestore.length > 0;
|
const canRestoreAll = isArchiveFolder && roomsForRestore.length > 0;
|
||||||
@ -1355,7 +1320,7 @@ export default inject(
|
|||||||
onShowInfoPanel,
|
onShowInfoPanel,
|
||||||
onClickArchive,
|
onClickArchive,
|
||||||
onCopyLink,
|
onCopyLink,
|
||||||
onClickExportRoomIndex,
|
onExportRoomIndex,
|
||||||
|
|
||||||
isEmptyArchive,
|
isEmptyArchive,
|
||||||
canRestoreAll,
|
canRestoreAll,
|
||||||
|
@ -89,13 +89,19 @@ import saveAs from "file-saver";
|
|||||||
import { isMobile, isIOS, isTablet } from "react-device-detect";
|
import { isMobile, isIOS, isTablet } from "react-device-detect";
|
||||||
import config from "PACKAGE_FILE";
|
import config from "PACKAGE_FILE";
|
||||||
import { toastr } from "@docspace/shared/components/toast";
|
import { toastr } from "@docspace/shared/components/toast";
|
||||||
|
import { Link } from "@docspace/shared/components/link";
|
||||||
|
import { Text } from "@docspace/shared/components/text";
|
||||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||||
import { isDesktop } from "@docspace/shared/utils";
|
import { isDesktop } from "@docspace/shared/utils";
|
||||||
import { getDefaultAccessUser } from "@docspace/shared/utils/getDefaultAccessUser";
|
import { getDefaultAccessUser } from "@docspace/shared/utils/getDefaultAccessUser";
|
||||||
import { copyShareLink } from "@docspace/shared/utils/copy";
|
import { copyShareLink } from "@docspace/shared/utils/copy";
|
||||||
|
|
||||||
import { connectedCloudsTypeTitleTranslation } from "@docspace/client/src/helpers/filesUtils";
|
import { connectedCloudsTypeTitleTranslation } from "@docspace/client/src/helpers/filesUtils";
|
||||||
import { getOAuthToken } from "@docspace/shared/utils/common";
|
import {
|
||||||
|
getOAuthToken,
|
||||||
|
hideLoader,
|
||||||
|
showLoader,
|
||||||
|
} from "@docspace/shared/utils/common";
|
||||||
import api from "@docspace/shared/api";
|
import api from "@docspace/shared/api";
|
||||||
import {
|
import {
|
||||||
RoomsType,
|
RoomsType,
|
||||||
@ -922,8 +928,26 @@ class ContextOptionsStore {
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickExportRoomIndex = async (roomId) => {
|
showSuccessExportRoomIndexToast = (t, fileName, fileUrl) => {
|
||||||
|
const toastMessage = (
|
||||||
|
<>
|
||||||
|
<Link color="#5299E0" fontSize="12px" target="_blank" href={fileUrl}>
|
||||||
|
{fileName}
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
<Text as="span" fontSize="12px">
|
||||||
|
{t("Files:FileExportedToMyDocuments")}
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
toastr.success(toastMessage);
|
||||||
|
};
|
||||||
|
|
||||||
|
onExportRoomIndex = async (t, roomId) => {
|
||||||
try {
|
try {
|
||||||
|
showLoader();
|
||||||
|
|
||||||
let res = await api.rooms.exportRoomIndex(roomId);
|
let res = await api.rooms.exportRoomIndex(roomId);
|
||||||
|
|
||||||
if (!res.isCompleted) {
|
if (!res.isCompleted) {
|
||||||
@ -936,13 +960,21 @@ class ContextOptionsStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.status === ExportRoomIndexTaskStatus.Completed) {
|
if (res.status === ExportRoomIndexTaskStatus.Completed) {
|
||||||
return {
|
const urlWithProxy = combineUrl(
|
||||||
fileName: res.resultFileName,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
fileUrl: res.resultFileUrl,
|
res.resultFileUrl,
|
||||||
};
|
);
|
||||||
|
|
||||||
|
this.showSuccessExportRoomIndexToast(
|
||||||
|
t,
|
||||||
|
res.resultFileName,
|
||||||
|
urlWithProxy,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toastr.error(e);
|
toastr.error(e);
|
||||||
|
} finally {
|
||||||
|
hideLoader();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1288,6 +1320,7 @@ class ContextOptionsStore {
|
|||||||
item.roomType === RoomsType.PublicRoom ||
|
item.roomType === RoomsType.PublicRoom ||
|
||||||
item.roomType === RoomsType.FormRoom ||
|
item.roomType === RoomsType.FormRoom ||
|
||||||
item.roomType === RoomsType.CustomRoom;
|
item.roomType === RoomsType.CustomRoom;
|
||||||
|
const isVDRRoomType = item.roomType === RoomsType.VirtualDataRoom;
|
||||||
|
|
||||||
if (item.isRoom && withOpen) {
|
if (item.isRoom && withOpen) {
|
||||||
withOpen =
|
withOpen =
|
||||||
@ -1480,6 +1513,14 @@ class ContextOptionsStore {
|
|||||||
},
|
},
|
||||||
...pinOptions,
|
...pinOptions,
|
||||||
...muteOptions,
|
...muteOptions,
|
||||||
|
{
|
||||||
|
id: "option_export-room-index",
|
||||||
|
key: "export-room-index",
|
||||||
|
label: t("Files:ExportRoomIndex"),
|
||||||
|
icon: DownloadReactSvgUrl,
|
||||||
|
onClick: () => this.onExportRoomIndex(t, item.id),
|
||||||
|
disabled: !isVDRRoomType || !item.indexing,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "option_owner-change",
|
id: "option_owner-change",
|
||||||
key: "owner-change",
|
key: "owner-change",
|
||||||
|
@ -2352,6 +2352,7 @@ class FilesStore {
|
|||||||
"unpin-room",
|
"unpin-room",
|
||||||
"mute-room",
|
"mute-room",
|
||||||
"unmute-room",
|
"unmute-room",
|
||||||
|
"export-room-index",
|
||||||
"separator1",
|
"separator1",
|
||||||
"download",
|
"download",
|
||||||
"archive-room",
|
"archive-room",
|
||||||
|
Loading…
Reference in New Issue
Block a user