Merge branch 'bugfix/icons' of github.com:ONLYOFFICE/DocSpace-client into bugfix/icons
This commit is contained in:
commit
8ee9a1caf7
@ -50,7 +50,7 @@ export type setTotalCallback = (value: number) => number;
|
||||
|
||||
export type useSocketHelperProps = {
|
||||
socketHelper: any;
|
||||
socketSubscribersId: Set<string>;
|
||||
socketSubscribers: Set<string>;
|
||||
setItems: (callback: setItemsCallback) => void;
|
||||
setBreadCrumbs: (callback: setBreadCrumbsCallback) => void;
|
||||
setTotal: (callback: setTotalCallback) => void;
|
||||
@ -204,7 +204,7 @@ export type FilesSelectorProps = {
|
||||
includeFolder?: boolean;
|
||||
|
||||
socketHelper: any;
|
||||
socketSubscribersId: Set<string>;
|
||||
socketSubscribers: Set<string>;
|
||||
currentDeviceType: "mobile" | "tablet" | "desktop";
|
||||
|
||||
embedded: boolean;
|
||||
|
@ -182,6 +182,7 @@ export const convertFoldersToItems = (
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
roomType,
|
||||
filesCount,
|
||||
foldersCount,
|
||||
security,
|
||||
@ -190,6 +191,7 @@ export const convertFoldersToItems = (
|
||||
}: {
|
||||
id: number;
|
||||
title: string;
|
||||
roomType: number;
|
||||
filesCount: number;
|
||||
foldersCount: number;
|
||||
security: Security;
|
||||
@ -210,6 +212,7 @@ export const convertFoldersToItems = (
|
||||
parentId,
|
||||
rootFolderType,
|
||||
isFolder: true,
|
||||
roomType,
|
||||
isDisabled: !!filterParam ? false : disabledItems.includes(id),
|
||||
};
|
||||
});
|
||||
@ -333,7 +336,7 @@ export const useFilesHelper = ({
|
||||
isErrorPath = false
|
||||
) => {
|
||||
if (isInit && getRootData) {
|
||||
const folder = await getFolderInfo(folderId);
|
||||
const folder = await getFolderInfo(folderId, true);
|
||||
|
||||
const isArchive = folder.rootFolderType === FolderType.Archive;
|
||||
|
||||
@ -432,6 +435,7 @@ export const useFilesHelper = ({
|
||||
try {
|
||||
await setSettings(id);
|
||||
} catch (e) {
|
||||
sessionStorage.removeItem("filesSelectorPath");
|
||||
if (isThirdParty && rootThirdPartyId) {
|
||||
await setSettings(rootThirdPartyId, true);
|
||||
|
||||
|
@ -11,7 +11,7 @@ import { convertRoomsToItems } from "./useRoomsHelper";
|
||||
|
||||
const useSocketHelper = ({
|
||||
socketHelper,
|
||||
socketSubscribersId,
|
||||
socketSubscribers,
|
||||
setItems,
|
||||
setBreadCrumbs,
|
||||
setTotal,
|
||||
@ -23,9 +23,9 @@ const useSocketHelper = ({
|
||||
const subscribe = (id: number) => {
|
||||
const roomParts = `DIR-${id}`;
|
||||
|
||||
if (socketSubscribersId.has(roomParts)) return (subscribedId.current = id);
|
||||
if (socketSubscribers.has(roomParts)) return (subscribedId.current = id);
|
||||
|
||||
if (subscribedId.current && !socketSubscribersId.has(roomParts)) {
|
||||
if (subscribedId.current && !socketSubscribers.has(roomParts)) {
|
||||
unsubscribe(subscribedId.current, false);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ const useSocketHelper = ({
|
||||
subscribedId.current = null;
|
||||
}
|
||||
|
||||
if (id && !socketSubscribersId.has(`DIR-${id}`)) {
|
||||
if (id && !socketSubscribers.has(`DIR-${id}`)) {
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: {
|
||||
|
@ -91,7 +91,7 @@ const FilesSelector = ({
|
||||
includeFolder,
|
||||
|
||||
socketHelper,
|
||||
socketSubscribersId,
|
||||
socketSubscribers,
|
||||
setMoveToPublicRoomVisible,
|
||||
setInfoPanelIsMobileHidden,
|
||||
currentDeviceType,
|
||||
@ -129,7 +129,7 @@ const FilesSelector = ({
|
||||
|
||||
const { subscribe, unsubscribe } = useSocketHelper({
|
||||
socketHelper,
|
||||
socketSubscribersId,
|
||||
socketSubscribers,
|
||||
setItems,
|
||||
setBreadCrumbs,
|
||||
setTotal,
|
||||
@ -569,12 +569,7 @@ export default inject(
|
||||
}: any,
|
||||
{ isCopy, isRestoreAll, isMove, isPanelVisible, id }: any
|
||||
) => {
|
||||
const {
|
||||
id: selectedId,
|
||||
parentId,
|
||||
rootFolderType,
|
||||
socketSubscribersId,
|
||||
} = selectedFolderStore;
|
||||
const { id: selectedId, parentId, rootFolderType } = selectedFolderStore;
|
||||
|
||||
const { setConflictDialogData, checkFileConflicts, setSelectedItems } =
|
||||
filesActionsStore;
|
||||
@ -614,6 +609,8 @@ export default inject(
|
||||
|
||||
const { theme, socketHelper, currentDeviceType } = auth.settingsStore;
|
||||
|
||||
const socketSubscribesId = socketHelper.socketSubscribers;
|
||||
|
||||
const {
|
||||
selection,
|
||||
bufferSelection,
|
||||
@ -677,7 +674,7 @@ export default inject(
|
||||
setInfoPanelIsMobileHidden,
|
||||
includeFolder,
|
||||
socketHelper,
|
||||
socketSubscribersId,
|
||||
socketSubscribers: socketSubscribesId,
|
||||
setMoveToPublicRoomVisible,
|
||||
currentDeviceType,
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ class DownloadDialogComponent extends React.Component {
|
||||
};
|
||||
|
||||
onSelectFormat = (e) => {
|
||||
const { format, type, fileId } = e.target.dataset;
|
||||
const { format, type, fileId } = e.currentTarget.dataset;
|
||||
const files = this.state[type].files;
|
||||
|
||||
this.setState((prevState) => {
|
||||
|
@ -22,7 +22,7 @@ const LinkBlock = (props) => {
|
||||
|
||||
return (
|
||||
<div className="edit-link_link-block">
|
||||
<Text className="edit-link-text" fontSize="13px" fontWeight={600}>
|
||||
<Text className="edit-link-text" fontSize="16px" fontWeight={600}>
|
||||
{t("LinkName")}
|
||||
</Text>
|
||||
<Text className="edit-link_required-icon" color="#F24724">
|
||||
|
@ -1,8 +1,9 @@
|
||||
import styled, { css } from "styled-components";
|
||||
import Box from "@docspace/components/box";
|
||||
import Scrollbar from "@docspace/components/scrollbar";
|
||||
import ModalDialog from "@docspace/components/modal-dialog";
|
||||
|
||||
const StyledEditLinkPanel = styled.div`
|
||||
const StyledEditLinkPanel = styled(ModalDialog)`
|
||||
.edit-link-panel {
|
||||
.scroll-body {
|
||||
${(props) =>
|
||||
@ -16,19 +17,23 @@ const StyledEditLinkPanel = styled.div`
|
||||
}
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 0px 0px 8px;
|
||||
}
|
||||
|
||||
.field-label-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.edit-link_body {
|
||||
padding: 22px 0px 20px;
|
||||
padding: 4px 0px 0px;
|
||||
|
||||
.edit-link_link-block {
|
||||
padding: 0px 16px 20px 16px;
|
||||
|
||||
.edit-link-text {
|
||||
display: inline-flex;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.edit-link_required-icon {
|
||||
|
@ -1,21 +1,14 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { observer, inject } from "mobx-react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import copy from "copy-to-clipboard";
|
||||
import isEqual from "lodash/isEqual";
|
||||
|
||||
import Heading from "@docspace/components/heading";
|
||||
import Backdrop from "@docspace/components/backdrop";
|
||||
import Aside from "@docspace/components/aside";
|
||||
import Button from "@docspace/components/button";
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
import Portal from "@docspace/components/portal";
|
||||
|
||||
import {
|
||||
StyledEditLinkPanel,
|
||||
StyledScrollbar,
|
||||
StyledButtons,
|
||||
} from "./StyledEditLinkPanel";
|
||||
import ModalDialog from "@docspace/components/modal-dialog";
|
||||
import { StyledEditLinkPanel } from "./StyledEditLinkPanel";
|
||||
|
||||
import LinkBlock from "./LinkBlock";
|
||||
import ToggleBlock from "./ToggleBlock";
|
||||
@ -171,95 +164,87 @@ const EditLinkPanel = (props) => {
|
||||
const isPrimary = link?.sharedTo?.primary;
|
||||
|
||||
const editLinkPanelComponent = (
|
||||
<StyledEditLinkPanel isExpired={isExpired}>
|
||||
<Backdrop
|
||||
onClick={onClosePanel}
|
||||
visible={visible}
|
||||
isAside={true}
|
||||
zIndex={310}
|
||||
/>
|
||||
<Aside
|
||||
className="edit-link-panel"
|
||||
visible={visible}
|
||||
onClose={onClosePanel}
|
||||
zIndex={310}
|
||||
withoutBodyScroll
|
||||
>
|
||||
<div className="edit-link_header">
|
||||
<Heading className="edit-link_heading">
|
||||
{isEdit
|
||||
? isPrimary
|
||||
? t("Files:EditGeneralLink")
|
||||
: isPublic
|
||||
? t("Files:EditAdditionalLink")
|
||||
: t("Files:EditLink")
|
||||
: t("Files:CreateNewLink")}
|
||||
</Heading>
|
||||
<StyledEditLinkPanel
|
||||
isExpired={isExpired}
|
||||
displayType="aside"
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
isLarge
|
||||
zIndex={310}
|
||||
withBodyScroll={true}
|
||||
withFooterBorder={true}
|
||||
>
|
||||
<ModalDialog.Header>
|
||||
{isEdit
|
||||
? isPrimary
|
||||
? t("Files:EditGeneralLink")
|
||||
: isPublic
|
||||
? t("Files:EditAdditionalLink")
|
||||
: t("Files:EditLink")
|
||||
: t("Files:CreateNewLink")}
|
||||
</ModalDialog.Header>
|
||||
<ModalDialog.Body>
|
||||
<div className="edit-link_body">
|
||||
<LinkBlock
|
||||
t={t}
|
||||
isEdit={isEdit}
|
||||
isLoading={isLoading}
|
||||
shareLink={shareLink}
|
||||
linkNameValue={linkNameValue}
|
||||
setLinkNameValue={setLinkNameValue}
|
||||
linkValue={linkValue}
|
||||
setLinkValue={setLinkValue}
|
||||
/>
|
||||
<PasswordAccessBlock
|
||||
t={t}
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:PasswordAccess")}
|
||||
bodyText={t("Files:PasswordLink")}
|
||||
isChecked={passwordAccessIsChecked}
|
||||
isPasswordValid={isPasswordValid}
|
||||
passwordValue={passwordValue}
|
||||
setPasswordValue={setPasswordValue}
|
||||
setIsPasswordValid={setIsPasswordValid}
|
||||
onChange={onPasswordAccessChange}
|
||||
/>
|
||||
<ToggleBlock
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:DisableDownload")}
|
||||
bodyText={t("Files:PreventDownloadFilesAndFolders")}
|
||||
isChecked={denyDownload}
|
||||
onChange={onDenyDownloadChange}
|
||||
/>
|
||||
{!isPrimary && (
|
||||
<LimitTimeBlock
|
||||
isExpired={isExpired}
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:LimitByTimePeriod")}
|
||||
bodyText={expiredLinkText}
|
||||
expirationDate={expirationDate}
|
||||
setExpirationDate={setExpirationDate}
|
||||
setIsExpired={setIsExpired}
|
||||
language={language}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<StyledScrollbar stype="mediumBlack">
|
||||
<div className="edit-link_body">
|
||||
<LinkBlock
|
||||
t={t}
|
||||
isEdit={isEdit}
|
||||
isLoading={isLoading}
|
||||
shareLink={shareLink}
|
||||
linkNameValue={linkNameValue}
|
||||
setLinkNameValue={setLinkNameValue}
|
||||
linkValue={linkValue}
|
||||
setLinkValue={setLinkValue}
|
||||
/>
|
||||
<PasswordAccessBlock
|
||||
t={t}
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:PasswordAccess")}
|
||||
bodyText={t("Files:PasswordLink")}
|
||||
isChecked={passwordAccessIsChecked}
|
||||
isPasswordValid={isPasswordValid}
|
||||
passwordValue={passwordValue}
|
||||
setPasswordValue={setPasswordValue}
|
||||
setIsPasswordValid={setIsPasswordValid}
|
||||
onChange={onPasswordAccessChange}
|
||||
/>
|
||||
<ToggleBlock
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:DisableDownload")}
|
||||
bodyText={t("Files:PreventDownloadFilesAndFolders")}
|
||||
isChecked={denyDownload}
|
||||
onChange={onDenyDownloadChange}
|
||||
/>
|
||||
{!isPrimary && (
|
||||
<LimitTimeBlock
|
||||
isExpired={isExpired}
|
||||
isLoading={isLoading}
|
||||
headerText={t("Files:LimitByTimePeriod")}
|
||||
bodyText={expiredLinkText}
|
||||
expirationDate={expirationDate}
|
||||
setExpirationDate={setExpirationDate}
|
||||
setIsExpired={setIsExpired}
|
||||
language={language}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</StyledScrollbar>
|
||||
|
||||
<StyledButtons>
|
||||
<Button
|
||||
scale
|
||||
primary
|
||||
size="normal"
|
||||
label={isEdit ? t("Common:SaveButton") : t("Common:Create")}
|
||||
isDisabled={isLoading || !linkNameIsValid || isExpired}
|
||||
onClick={onSave}
|
||||
/>
|
||||
<Button
|
||||
scale
|
||||
size="normal"
|
||||
label={t("Common:CancelButton")}
|
||||
isDisabled={isLoading}
|
||||
onClick={onClose}
|
||||
/>
|
||||
</StyledButtons>
|
||||
</Aside>
|
||||
</ModalDialog.Body>
|
||||
<ModalDialog.Footer>
|
||||
<Button
|
||||
scale
|
||||
primary
|
||||
size="normal"
|
||||
label={isEdit ? t("Common:SaveButton") : t("Common:Create")}
|
||||
isDisabled={isLoading || !linkNameIsValid || isExpired}
|
||||
onClick={onSave}
|
||||
/>
|
||||
<Button
|
||||
scale
|
||||
size="normal"
|
||||
label={t("Common:CancelButton")}
|
||||
isDisabled={isLoading}
|
||||
onClick={onClose}
|
||||
/>
|
||||
</ModalDialog.Footer>
|
||||
</StyledEditLinkPanel>
|
||||
);
|
||||
|
||||
|
@ -11,7 +11,7 @@ import CopyReactSvgUrl from "PUBLIC_DIR/images/copy.react.svg?url";
|
||||
import { StyledBody } from "./StyledEmbeddingPanel";
|
||||
import { objectToGetParams } from "@docspace/common/utils";
|
||||
|
||||
const EmbeddingBody = ({ t, link, roomId }) => {
|
||||
const EmbeddingBody = ({ t, link, requestToken, roomId }) => {
|
||||
const [size, setSize] = useState("auto");
|
||||
const [widthValue, setWidthValue] = useState("100%");
|
||||
const [heightValue, setHeightValue] = useState("100%");
|
||||
@ -19,14 +19,17 @@ const EmbeddingBody = ({ t, link, roomId }) => {
|
||||
const config = {
|
||||
width: `${widthValue}`,
|
||||
height: `${heightValue}`,
|
||||
frameId: "ds-frame",
|
||||
frameId: "ds-frame-embedding",
|
||||
mode: "manager",
|
||||
init: true,
|
||||
showHeader: true,
|
||||
showTitle: true,
|
||||
showMenu: false,
|
||||
showFilter: true,
|
||||
rootPath: "/rooms/shared/",
|
||||
rootPath: "/rooms/share",
|
||||
id: roomId,
|
||||
requestToken,
|
||||
withSubfolders: false,
|
||||
};
|
||||
|
||||
const scriptUrl = `${window.location.origin}/static/scripts/api.js`;
|
||||
|
@ -6,13 +6,13 @@ import Aside from "@docspace/components/aside";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { StyledEmbeddingPanel, StyledScrollbar } from "./StyledEmbeddingPanel";
|
||||
import EmbeddingBody from "./EmbeddingBody";
|
||||
import Portal from "@docspace/components/portal";
|
||||
import { DeviceType } from "@docspace/common/constants";
|
||||
|
||||
import Portal from "@docspace/components/portal";
|
||||
const EmbeddingPanelComponent = (props) => {
|
||||
const {
|
||||
t,
|
||||
link,
|
||||
requestToken,
|
||||
roomId,
|
||||
visible,
|
||||
setEmbeddingPanelIsVisible,
|
||||
@ -44,14 +44,24 @@ const EmbeddingPanelComponent = (props) => {
|
||||
isAside={true}
|
||||
zIndex={310}
|
||||
/>
|
||||
<Aside className="embedding-panel" visible={visible} onClose={onClose}>
|
||||
<Aside
|
||||
className="embedding-panel"
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
withoutBodyScroll={true}
|
||||
>
|
||||
<div className="embedding_header">
|
||||
<Heading className="hotkeys_heading">
|
||||
{t("Files:EmbeddingSettings")}
|
||||
</Heading>
|
||||
</div>
|
||||
<StyledScrollbar ref={scrollRef} stype="mediumBlack">
|
||||
<EmbeddingBody t={t} link={link} roomId={roomId} />
|
||||
<EmbeddingBody
|
||||
t={t}
|
||||
link={link}
|
||||
requestToken={requestToken}
|
||||
roomId={roomId}
|
||||
/>
|
||||
</StyledScrollbar>
|
||||
</Aside>
|
||||
</StyledEmbeddingPanel>
|
||||
@ -74,7 +84,7 @@ const EmbeddingPanelComponent = (props) => {
|
||||
: embeddingPanelComponent;
|
||||
};
|
||||
|
||||
export default inject(({ auth, dialogsStore }) => {
|
||||
export default inject(({ dialogsStore, auth }) => {
|
||||
const { embeddingPanelIsVisible, setEmbeddingPanelIsVisible, linkParams } =
|
||||
dialogsStore;
|
||||
const { currentDeviceType } = auth.settingsStore;
|
||||
@ -83,6 +93,7 @@ export default inject(({ auth, dialogsStore }) => {
|
||||
visible: embeddingPanelIsVisible,
|
||||
setEmbeddingPanelIsVisible,
|
||||
link: linkParams?.link?.sharedTo?.shareLink,
|
||||
requestToken: linkParams?.link?.sharedTo?.requestToken,
|
||||
roomId: linkParams?.roomId,
|
||||
currentDeviceType,
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ import RowContent from "@docspace/components/row-content";
|
||||
import Link from "@docspace/components/link";
|
||||
|
||||
import Badges from "../Badges";
|
||||
import { tablet } from "@docspace/components/utils/device";
|
||||
import { tablet, mobile } from "@docspace/components/utils/device";
|
||||
|
||||
const StyledRowContent = styled(RowContent)`
|
||||
@media ${tablet} {
|
||||
@ -44,6 +44,21 @@ const StyledRowContent = styled(RowContent)`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media ${mobile} {
|
||||
.row-main-container-wrapper {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.badges {
|
||||
margin-top: 0px;
|
||||
gap: 8px;
|
||||
|
||||
.paid-badge {
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const UserContent = ({
|
||||
|
@ -754,6 +754,7 @@ class Tile extends React.PureComponent {
|
||||
<StyledOptionButton spacerWidth={contextButtonSpacerWidth}>
|
||||
{renderContext ? (
|
||||
<ContextMenuButton
|
||||
isFill
|
||||
className="expandButton"
|
||||
directionX="right"
|
||||
getData={getOptions}
|
||||
@ -847,6 +848,7 @@ class Tile extends React.PureComponent {
|
||||
<StyledOptionButton spacerWidth={contextButtonSpacerWidth}>
|
||||
{renderContext ? (
|
||||
<ContextMenuButton
|
||||
isFill
|
||||
className="expandButton"
|
||||
directionX={contextMenuDirection}
|
||||
getData={getOptions}
|
||||
@ -927,6 +929,7 @@ class Tile extends React.PureComponent {
|
||||
<StyledOptionButton spacerWidth={contextButtonSpacerWidth}>
|
||||
{renderContext ? (
|
||||
<ContextMenuButton
|
||||
isFill
|
||||
className="expandButton"
|
||||
directionX="left"
|
||||
getData={getOptions}
|
||||
|
@ -51,6 +51,7 @@ const ActiveSessions = ({
|
||||
getSessions,
|
||||
sessions,
|
||||
currentSession,
|
||||
setSessions,
|
||||
}) => {
|
||||
const [modalData, setModalData] = useState({});
|
||||
const [loading, setLoading] = useState(false);
|
||||
@ -267,6 +268,7 @@ export default inject(({ auth, setup }) => {
|
||||
sessions,
|
||||
currentSession,
|
||||
getSessions,
|
||||
setSessions,
|
||||
} = setup;
|
||||
return {
|
||||
locale,
|
||||
@ -282,5 +284,6 @@ export default inject(({ auth, setup }) => {
|
||||
sessions,
|
||||
currentSession,
|
||||
getSessions,
|
||||
setSessions,
|
||||
};
|
||||
})(observer(withTranslation(["Profile", "Common"])(ActiveSessions)));
|
||||
|
@ -174,7 +174,8 @@ class FilesStore {
|
||||
const { socketHelper } = authStore.settingsStore;
|
||||
|
||||
socketHelper.on("s:modify-folder", async (opt) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
|
||||
if (opt && opt.data) {
|
||||
const data = JSON.parse(opt.data);
|
||||
|
||||
@ -183,8 +184,8 @@ class FilesStore {
|
||||
: `DIR-${data.parentId}`;
|
||||
|
||||
if (
|
||||
!socketSubscribersId.has(pathParts) &&
|
||||
!socketSubscribersId.has(`DIR-${data.id}`)
|
||||
!socketSubscribers.has(pathParts) &&
|
||||
!socketSubscribers.has(`DIR-${data.id}`)
|
||||
)
|
||||
return;
|
||||
}
|
||||
@ -224,10 +225,10 @@ class FilesStore {
|
||||
});
|
||||
|
||||
socketHelper.on("refresh-folder", (id) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
const pathParts = `DIR-${id}`;
|
||||
|
||||
if (!socketSubscribersId.has(pathParts)) return;
|
||||
if (!socketSubscribers.has(pathParts)) return;
|
||||
|
||||
if (!id || this.clientLoadingStore.isLoading) return;
|
||||
|
||||
@ -245,10 +246,10 @@ class FilesStore {
|
||||
});
|
||||
|
||||
socketHelper.on("s:markasnew-folder", ({ folderId, count }) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
const pathParts = `DIR-${folderId}`;
|
||||
|
||||
if (!socketSubscribersId.has(pathParts)) return;
|
||||
if (!socketSubscribers.has(pathParts)) return;
|
||||
|
||||
console.log(`[WS] markasnew-folder ${folderId}:${count}`);
|
||||
|
||||
@ -263,10 +264,10 @@ class FilesStore {
|
||||
});
|
||||
|
||||
socketHelper.on("s:markasnew-file", ({ fileId, count }) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
const pathParts = `FILE-${fileId}`;
|
||||
|
||||
if (!socketSubscribersId.has(pathParts)) return;
|
||||
if (!socketSubscribers.has(pathParts)) return;
|
||||
|
||||
console.log(`[WS] markasnew-file ${fileId}:${count}`);
|
||||
|
||||
@ -285,10 +286,10 @@ class FilesStore {
|
||||
|
||||
//WAIT FOR RESPONSES OF EDITING FILE
|
||||
socketHelper.on("s:start-edit-file", (id) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
const pathParts = `FILE-${id}`;
|
||||
|
||||
if (!socketSubscribersId.has(pathParts)) return;
|
||||
if (!socketSubscribers.has(pathParts)) return;
|
||||
|
||||
const foundIndex = this.files.findIndex((x) => x.id === id);
|
||||
if (foundIndex == -1) return;
|
||||
@ -308,10 +309,10 @@ class FilesStore {
|
||||
});
|
||||
|
||||
socketHelper.on("s:stop-edit-file", (id) => {
|
||||
const { socketSubscribersId } = this.selectedFolderStore;
|
||||
const { socketSubscribers } = socketHelper;
|
||||
const pathParts = `FILE-${id}`;
|
||||
|
||||
if (!socketSubscribersId.has(pathParts)) return;
|
||||
if (!socketSubscribers.has(pathParts)) return;
|
||||
|
||||
const foundIndex = this.files.findIndex((x) => x.id === id);
|
||||
if (foundIndex == -1) return;
|
||||
@ -870,14 +871,10 @@ class FilesStore {
|
||||
|
||||
setFiles = (files) => {
|
||||
const { socketHelper } = this.authStore.settingsStore;
|
||||
const { addSocketSubscribersId, deleteSocketSubscribersId } =
|
||||
this.selectedFolderStore;
|
||||
|
||||
if (files.length === 0 && this.files.length === 0) return;
|
||||
|
||||
if (this.files?.length > 0) {
|
||||
this.files.forEach((f) => {
|
||||
deleteSocketSubscribersId(`FILE-${f.id}`);
|
||||
});
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: {
|
||||
@ -890,10 +887,6 @@ class FilesStore {
|
||||
this.files = files;
|
||||
|
||||
if (this.files?.length > 0) {
|
||||
this.files.forEach((f) => {
|
||||
addSocketSubscribersId(`FILE-${f.id}`);
|
||||
});
|
||||
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: {
|
||||
@ -911,16 +904,10 @@ class FilesStore {
|
||||
};
|
||||
|
||||
setFolders = (folders) => {
|
||||
const { addSocketSubscribersId, deleteSocketSubscribersId } =
|
||||
this.selectedFolderStore;
|
||||
const { socketHelper } = this.authStore.settingsStore;
|
||||
if (folders.length === 0 && this.folders.length === 0) return;
|
||||
|
||||
if (this.folders?.length > 0) {
|
||||
this.folders.forEach((f) => {
|
||||
deleteSocketSubscribersId(`DIR-${f.id}`);
|
||||
});
|
||||
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: {
|
||||
@ -933,9 +920,6 @@ class FilesStore {
|
||||
this.folders = folders;
|
||||
|
||||
if (this.folders?.length > 0) {
|
||||
this.folders.forEach((f) => {
|
||||
addSocketSubscribersId(`DIR-${f.id}`);
|
||||
});
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: {
|
||||
@ -2600,7 +2584,6 @@ class FilesStore {
|
||||
|
||||
addItem = (item, isFolder) => {
|
||||
const { socketHelper } = this.authStore.settingsStore;
|
||||
const { addSocketSubscribersId } = this.selectedFolderStore;
|
||||
|
||||
if (isFolder) {
|
||||
const foundIndex = this.folders.findIndex((x) => x.id === item?.id);
|
||||
@ -2610,8 +2593,6 @@ class FilesStore {
|
||||
|
||||
console.log("[WS] subscribe to folder changes", item.id, item.title);
|
||||
|
||||
addSocketSubscribersId(`DIR-${item.id}`);
|
||||
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: {
|
||||
@ -2625,8 +2606,6 @@ class FilesStore {
|
||||
|
||||
console.log("[WS] subscribe to file changes", item.id, item.title);
|
||||
|
||||
addSocketSubscribersId(`FILE-${item.id}`);
|
||||
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: { roomParts: `FILE-${item.id}`, individual: true },
|
||||
|
@ -33,8 +33,6 @@ class SelectedFolderStore {
|
||||
security = null;
|
||||
inRoom = true;
|
||||
|
||||
socketSubscribersId = new Set();
|
||||
|
||||
constructor(settingsStore) {
|
||||
makeAutoObservable(this);
|
||||
this.settingsStore = settingsStore;
|
||||
@ -106,7 +104,6 @@ class SelectedFolderStore {
|
||||
this.rootFolderId = null;
|
||||
this.security = null;
|
||||
this.inRoom = true;
|
||||
this.socketSubscribersId = new Set();
|
||||
};
|
||||
|
||||
setParentId = (parentId) => {
|
||||
@ -154,14 +151,6 @@ class SelectedFolderStore {
|
||||
};
|
||||
};
|
||||
|
||||
addSocketSubscribersId = (path) => {
|
||||
this.socketSubscribersId.add(path);
|
||||
};
|
||||
|
||||
deleteSocketSubscribersId = (path) => {
|
||||
this.socketSubscribersId.delete(path);
|
||||
};
|
||||
|
||||
setSelectedFolder = (selectedFolder) => {
|
||||
const { socketHelper } = this.settingsStore;
|
||||
|
||||
@ -170,8 +159,6 @@ class SelectedFolderStore {
|
||||
command: "unsubscribe",
|
||||
data: { roomParts: `DIR-${this.id}`, individual: true },
|
||||
});
|
||||
|
||||
this.deleteSocketSubscribersId(`DIR-${this.id}`);
|
||||
}
|
||||
|
||||
if (selectedFolder) {
|
||||
@ -179,8 +166,6 @@ class SelectedFolderStore {
|
||||
command: "subscribe",
|
||||
data: { roomParts: `DIR-${selectedFolder.id}`, individual: true },
|
||||
});
|
||||
|
||||
this.addSocketSubscribersId(`DIR-${selectedFolder.id}`);
|
||||
}
|
||||
|
||||
if (!selectedFolder) {
|
||||
|
@ -482,11 +482,15 @@ class SettingsSetupStore {
|
||||
getSessions = () => {
|
||||
if (this.sessionsIsInit) return;
|
||||
this.getAllSessions().then((res) => {
|
||||
this.sessions = res.items;
|
||||
this.setSessions(res.items);
|
||||
this.currentSession = res.loginEvent;
|
||||
this.sessionsIsInit = true;
|
||||
});
|
||||
};
|
||||
|
||||
setSessions = (sessions) => {
|
||||
this.sessions = sessions;
|
||||
};
|
||||
}
|
||||
|
||||
export default SettingsSetupStore;
|
||||
|
@ -29,14 +29,8 @@ class TreeFoldersStore {
|
||||
|
||||
listenTreeFolders = (treeFolders) => {
|
||||
const { socketHelper } = this.authStore.settingsStore;
|
||||
const { addSocketSubscribersId, deleteSocketSubscribersId } =
|
||||
this.selectedFolderStore;
|
||||
|
||||
if (treeFolders.length > 0) {
|
||||
treeFolders.forEach((f) => {
|
||||
deleteSocketSubscribersId(`DIR-${f.id}`);
|
||||
});
|
||||
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: {
|
||||
@ -45,10 +39,6 @@ class TreeFoldersStore {
|
||||
},
|
||||
});
|
||||
|
||||
treeFolders.forEach((f) => {
|
||||
addSocketSubscribersId(`DIR-${f.id}`);
|
||||
});
|
||||
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: {
|
||||
|
@ -6,8 +6,8 @@ export const initSSR = (headers) => {
|
||||
client.initSSR(headers);
|
||||
};
|
||||
|
||||
export const request = (options) => {
|
||||
return client.request(options);
|
||||
export const request = (options, isSelector = false) => {
|
||||
return client.request(options, isSelector);
|
||||
};
|
||||
|
||||
export const setWithCredentialsStatus = (state) => {
|
||||
|
@ -49,13 +49,13 @@ export function getReferenceData(object) {
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getFolderInfo(folderId) {
|
||||
export function getFolderInfo(folderId, isSelector = false) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: `/files/folder/${folderId}`,
|
||||
};
|
||||
|
||||
return request(options);
|
||||
return request(options, isSelector);
|
||||
}
|
||||
|
||||
export function getFolderPath(folderId) {
|
||||
|
@ -193,7 +193,7 @@ const InfoPanel = ({
|
||||
|
||||
return !isVisible ||
|
||||
!canDisplay ||
|
||||
anotherDialogOpen ||
|
||||
(anotherDialogOpen && currentDeviceType !== DeviceType.desktop) ||
|
||||
(currentDeviceType !== DeviceType.desktop && isMobileHidden)
|
||||
? null
|
||||
: currentDeviceType === DeviceType.mobile
|
||||
|
@ -111,7 +111,7 @@ class AxiosClient {
|
||||
}
|
||||
};
|
||||
|
||||
request = (options) => {
|
||||
request = (options, isSelector = false) => {
|
||||
const onSuccess = (response) => {
|
||||
const error = this.getResponseError(response);
|
||||
if (error) throw new Error(error);
|
||||
@ -161,6 +161,7 @@ class AxiosClient {
|
||||
}
|
||||
break;
|
||||
case 403:
|
||||
if (isSelector) return;
|
||||
const pathname = window.location.pathname;
|
||||
const isArchived = pathname.indexOf("/rooms/archived") !== -1;
|
||||
|
||||
|
@ -2,6 +2,7 @@ import io from "socket.io-client";
|
||||
|
||||
let client = null;
|
||||
let callbacks = [];
|
||||
const subscribers = new Set();
|
||||
|
||||
class SocketIOHelper {
|
||||
socketUrl = null;
|
||||
@ -49,9 +50,28 @@ class SocketIOHelper {
|
||||
return this.socketUrl !== null;
|
||||
}
|
||||
|
||||
get socketSubscribers() {
|
||||
return subscribers;
|
||||
}
|
||||
|
||||
emit = ({ command, data, room = null }) => {
|
||||
if (!this.isEnabled) return;
|
||||
|
||||
const ids =
|
||||
typeof data.roomParts === "object" ? data.roomParts : [data.roomParts];
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (command === "subscribe") {
|
||||
if (subscribers.has(id)) return;
|
||||
|
||||
subscribers.add(id);
|
||||
}
|
||||
|
||||
if (command === "unsubscribe") {
|
||||
subscribers.delete(id);
|
||||
}
|
||||
});
|
||||
|
||||
if (!client.connected) {
|
||||
client.on("connect", () => {
|
||||
if (room !== null) {
|
||||
|
@ -13,6 +13,8 @@ const Container = ({
|
||||
scale,
|
||||
zIndex,
|
||||
contentPaddingBottom,
|
||||
asideHeight,
|
||||
keyboardHeight,
|
||||
...props
|
||||
}) => <aside {...props} />;
|
||||
/* eslint-enable react/prop-types */
|
||||
|
@ -67,7 +67,7 @@ class LinkWithDropdown extends React.Component {
|
||||
}
|
||||
|
||||
onClickDropDownItem = (e) => {
|
||||
const { key } = e.target.dataset;
|
||||
const { key } = e.currentTarget.dataset;
|
||||
const item = this.props.data.find((x) => x.key === key);
|
||||
this.setIsOpen(!this.state.isOpen);
|
||||
item && item.onClick && item.onClick(e);
|
||||
|
@ -166,6 +166,7 @@ class Row extends React.Component {
|
||||
)}
|
||||
{renderContext ? (
|
||||
<ContextMenuButton
|
||||
isFill
|
||||
className="expandButton"
|
||||
getData={getOptions}
|
||||
directionX="right"
|
||||
|
@ -62,6 +62,7 @@ const TableRow = (props) => {
|
||||
></ContextMenu>
|
||||
{renderContext ? (
|
||||
<ContextMenuButton
|
||||
isFill
|
||||
className="expandButton"
|
||||
getData={getOptions}
|
||||
directionX="right"
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 30 KiB |
@ -2,6 +2,7 @@
|
||||
const defaultConfig = {
|
||||
src: new URL(document.currentScript.src).origin,
|
||||
rootPath: "/rooms/shared/",
|
||||
requestToken: null,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
name: "frameDocSpace",
|
||||
@ -51,7 +52,7 @@
|
||||
};
|
||||
|
||||
const getConfigFromParams = () => {
|
||||
const src = document.currentScript.src;
|
||||
const src = decodeURIComponent(document.currentScript.src);
|
||||
|
||||
if (!src || !src.length) return null;
|
||||
|
||||
@ -101,10 +102,18 @@
|
||||
case "manager": {
|
||||
if (config.filter) {
|
||||
if (config.id) config.filter.folder = config.id;
|
||||
const filterString = new URLSearchParams(config.filter).toString();
|
||||
|
||||
const params = config.requestToken
|
||||
? { key: config.requestToken, ...config.filter }
|
||||
: config.filter;
|
||||
|
||||
const urlParams = new URLSearchParams(params).toString();
|
||||
|
||||
path = `${config.rootPath}${
|
||||
config.id ? config.id + "/" : ""
|
||||
}filter?${filterString}`;
|
||||
config.requestToken
|
||||
? `?${urlParams}`
|
||||
: `${config.id ? config.id + "/" : ""}filter?${urlParams}`
|
||||
}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user