Web:Client:Fixed function availability.

This commit is contained in:
gazizova-vlada 2023-09-22 15:48:09 +03:00
parent a1d2c7565b
commit 9965519c89
2 changed files with 21 additions and 14 deletions

View File

@ -52,6 +52,7 @@ import { getContextMenuItems } from "SRC_DIR/helpers/plugins";
import { connectedCloudsTypeTitleTranslation } from "@docspace/client/src/helpers/filesUtils"; import { connectedCloudsTypeTitleTranslation } from "@docspace/client/src/helpers/filesUtils";
import { getOAuthToken } from "@docspace/common/utils"; import { getOAuthToken } from "@docspace/common/utils";
import api from "@docspace/common/api"; import api from "@docspace/common/api";
import { FolderType } from "@docspace/common/constants";
const LOADER_TIMER = 500; const LOADER_TIMER = 500;
let loadingTime; let loadingTime;
@ -1200,8 +1201,8 @@ class ContextOptionsStore {
key: "create-room", key: "create-room",
label: "Create room", label: "Create room",
icon: DownloadReactSvgUrl, icon: DownloadReactSvgUrl,
onClick: () => this.onClickCreateRoom(item, t), onClick: this.onClickCreateRoom,
disabled: false, disabled: this.selectedFolderStore.rootFolderType !== FolderType.USER,
}, },
{ {
id: "option_download", id: "option_download",

View File

@ -1580,6 +1580,10 @@ class FilesActionStore {
const canDelete = selection.every((s) => s.security?.Delete); const canDelete = selection.every((s) => s.security?.Delete);
return !allFilesIsEditing && canDelete && hasSelection; return !allFilesIsEditing && canDelete && hasSelection;
case "create-room":
const canCreateRoom = rootFolderType === FolderType.USER;
return canCreateRoom;
} }
}; };
@ -1715,6 +1719,12 @@ class FilesActionStore {
this.processCreatingRoomFromData = processCreatingRoomFromData; this.processCreatingRoomFromData = processCreatingRoomFromData;
}; };
onClickCreateRoom = () => {
this.setProcessCreatingRoomFromData(true);
const event = new Event(Events.ROOM_CREATE);
window.dispatchEvent(event);
};
getOption = (option, t) => { getOption = (option, t) => {
const { const {
setSharingPanelVisible, setSharingPanelVisible,
@ -1746,18 +1756,14 @@ class FilesActionStore {
}; };
case "create-room": case "create-room":
// if (!this.isAvailableOption("download")) return null; if (!this.isAvailableOption("create-room")) return null;
// else else
return { return {
id: "menu-create-room", id: "menu-create-room",
label: "Create room", label: "Create room",
onClick: () => { onClick: this.onClickCreateRoom,
this.setProcessCreatingRoomFromData(true); iconUrl: DownloadReactSvgUrl,
const event = new Event(Events.ROOM_CREATE); };
window.dispatchEvent(event);
},
iconUrl: DownloadReactSvgUrl,
};
case "download": case "download":
if (!this.isAvailableOption("download")) return null; if (!this.isAvailableOption("download")) return null;