Merge branch 'develop' into feature/whitelabel

This commit is contained in:
Viktor Fomin 2022-10-26 22:37:16 +05:00
commit bdf764a645
24 changed files with 158 additions and 24 deletions

View File

@ -82,7 +82,7 @@
"DNSSettings": "DNS Settings",
"DNSSettingsDescription": "DNS Settings is a way to set an alternative URL for your portal.",
"DNSSettingsMobile": "Send your request to our support team, and our specialists will help you with the settings.",
"DNSSettingsTooltip": "DNS Settings allow you to set an alternative URL address for your ONLYOFFICE portal. Send your request to our support team, and our specialists will help you with the settings.<2>{{learnMore}}</2>",
"DNSSettingsTooltip": "DNS Settings allow you to set an alternative URL address for your {{ organizationName }} portal. Send your request to our support team, and our specialists will help you with the settings.<2>{{learnMore}}</2>",
"DocSpaceMenu": "DocSpace menu",
"DocumentsAdministratorsCan": "Documents administrators can link Dropbox, Box, and other accounts to Common Documents and set up access rights in this section",
"DownloadCopy": "Download the copy",

View File

@ -70,9 +70,14 @@ const Dialog = ({
onCancel && onCancel(e);
}, []);
const onCloseAction = useCallback((e) => {
onClose && onClose(e);
}, []);
const onCloseAction = useCallback(
(e) => {
if (!isDisabled) {
onClose && onClose(e);
}
},
[isDisabled]
);
return (
<ModalDialog
@ -110,6 +115,7 @@ const Dialog = ({
size="normal"
scale
primary
isLoading={isDisabled}
isDisabled={isDisabled}
onClick={onSaveAction}
/>

View File

@ -121,6 +121,15 @@ class ChangeEmailDialogComponent extends React.Component {
}
};
onClose = () => {
const { onClose } = this.props;
const { isRequestRunning } = this.state;
if (!isRequestRunning) {
onClose();
}
};
render() {
console.log("ChangeEmailDialog render");
const { t, tReady, visible, onClose, isTabletView } = this.props;
@ -130,7 +139,7 @@ class ChangeEmailDialogComponent extends React.Component {
<ModalDialogContainer
isLoading={!tReady}
visible={visible}
onClose={onClose}
onClose={this.onClose}
displayType="modal"
>
<ModalDialog.Header>{t("EmailChangeTitle")}</ModalDialog.Header>
@ -175,7 +184,7 @@ class ChangeEmailDialogComponent extends React.Component {
size="normal"
scale
onClick={onClose}
isLoading={isRequestRunning}
isDisabled={isRequestRunning}
/>
</ModalDialog.Footer>
</ModalDialogContainer>

View File

@ -28,6 +28,12 @@ const ChangeNameDialog = (props) => {
const [lastName, setLastName] = useState(profile.lastName);
const [isSaving, setIsSaving] = useState(false);
const onCloseAction = () => {
if (!isSaving) {
onClose();
}
};
const onSaveClick = async () => {
const newProfile = profile;
newProfile.firstName = firstName;
@ -51,7 +57,7 @@ const ChangeNameDialog = (props) => {
<ModalDialogContainer
isLoading={!ready}
visible={visible}
onClose={onClose}
onClose={onCloseAction}
displayType="modal"
>
<ModalDialog.Header>
@ -69,6 +75,7 @@ const ChangeNameDialog = (props) => {
value={firstName}
onChange={(e) => setFirstName(e.target.value)}
placeholder={t("ProfileAction:FirstName")}
isDisabled={isSaving}
/>
</FieldContainer>
@ -82,6 +89,7 @@ const ChangeNameDialog = (props) => {
value={lastName}
onChange={(e) => setLastName(e.target.value)}
placeholder={t("Common:LastName")}
isDisabled={isSaving}
/>
</FieldContainer>
</ModalDialog.Body>

View File

@ -46,6 +46,15 @@ class ChangePasswordDialogComponent extends React.Component {
removeEventListener("keydown", this.keyPress, false);
}
onClose = () => {
const { onClose } = this.props;
const { isRequestRunning } = this.state;
if (!isRequestRunning) {
onClose();
}
};
render() {
// console.log("ChangePasswordDialog render");
const { t, tReady, visible, email, onClose, theme } = this.props;
@ -55,7 +64,7 @@ class ChangePasswordDialogComponent extends React.Component {
<ModalDialog
isLoading={!tReady}
visible={visible}
onClose={onClose}
onClose={this.onClose}
displayType="modal"
>
<ModalDialog.Header>{t("PasswordChangeTitle")}</ModalDialog.Header>
@ -96,7 +105,7 @@ class ChangePasswordDialogComponent extends React.Component {
size="normal"
scale
onClick={onClose}
isLoading={isRequestRunning}
isDisabled={isRequestRunning}
/>
</ModalDialog.Footer>
</ModalDialog>

View File

@ -49,6 +49,7 @@ const ChangePortalOwnerDialog = ({
};
const onTogglePeopleSelector = () => {
if (isLoading) return;
setSelectedUser(null);
setSelectorVisible((val) => !val);
};
@ -71,10 +72,12 @@ const ChangePortalOwnerDialog = ({
};
const onCloseAction = () => {
if (isLoading) return;
onClose && onClose();
};
const onClearSelectedItem = () => {
if (isLoading) return;
setSelectedUser(null);
};
@ -209,6 +212,7 @@ const ChangePortalOwnerDialog = ({
size="normal"
scale
onClick={onCloseAction}
isDisabled={isLoading}
/>
</div>
</StyledFooterWrapper>

View File

@ -43,6 +43,14 @@ const CreateRoomDialog = ({
const [isScrollLocked, setIsScrollLocked] = useState(false);
const [isOauthWindowOpen, setIsOauthWindowOpen] = useState(false);
const isMountRef = React.useRef(true);
React.useEffect(() => {
return () => {
isMountRef.current = false;
};
});
const startRoomParams = {
type: undefined,
title: "",
@ -80,14 +88,19 @@ const CreateRoomDialog = ({
const onCreateRoom = async () => {
await onCreate({ ...roomParams });
setRoomParams(startRoomParams);
if (isMountRef.current) {
setRoomParams(startRoomParams);
}
};
const goBack = () => {
if (isLoading) return;
setRoomParams({ ...startRoomParams });
};
const onCloseAndDisconnectThirdparty = async () => {
if (isLoading) return;
if (!!roomParams.storageLocation.thirdpartyAccount) {
setIsLoading(true);
await deleteThirdParty(
@ -128,6 +141,7 @@ const CreateRoomDialog = ({
setRoomParams={setRoomParams}
setRoomType={setRoomType}
setIsScrollLocked={setIsScrollLocked}
isDisabled={isLoading}
/>
)}
</ModalDialog.Body>
@ -148,6 +162,7 @@ const CreateRoomDialog = ({
label={t("Common:CancelButton")}
size="normal"
scale
isDisabled={isLoading}
onClick={onCloseAndDisconnectThirdparty}
/>
</ModalDialog.Footer>

View File

@ -44,12 +44,18 @@ const EditRoomDialog = ({
});
}, [fetchedImage]);
const onCloseAction = () => {
if (isLoading) return;
onClose && onClose();
};
return (
<ModalDialog
displayType="aside"
withBodyScroll
visible={visible}
onClose={onClose}
onClose={onCloseAction}
isScrollLocked={isScrollLocked}
withFooterBorder
>
@ -66,6 +72,7 @@ const EditRoomDialog = ({
setRoomType={setRoomType}
setIsScrollLocked={setIsScrollLocked}
isEdit
isDisabled={isLoading}
/>
</ModalDialog.Body>
@ -85,6 +92,7 @@ const EditRoomDialog = ({
size="normal"
scale
onClick={onClose}
isDisabled={isLoading}
/>
</ModalDialog.Footer>
</ModalDialog>

View File

@ -58,9 +58,11 @@ const StyledDropzone = styled.div`
StyledDropzone.defaultProps = { theme: Base };
const Dropzone = ({ t, setUploadedFile }) => {
const Dropzone = ({ t, setUploadedFile, isDisabled }) => {
const { acceptedFiles, getRootProps, getInputProps } = useDropzone({
maxFiles: 1,
noClick: isDisabled,
noKeyboard: isDisabled,
// maxSize: 1000000,
accept: ["image/png", "image/jpeg"],
});

View File

@ -106,23 +106,37 @@ const IconCropper = ({
uploadedFile,
setUploadedFile,
setPreviewIcon,
isDisabled,
}) => {
let editorRef = null;
const setEditorRef = (editor) => (editorRef = editor);
const handlePositionChange = (position) =>
const handlePositionChange = (position) => {
if (isDisabled) return;
onChangeIcon({ ...icon, x: position.x, y: position.y });
};
const handleSliderChange = (e, newZoom = null) => {
if (isDisabled) return;
const handleSliderChange = (e, newZoom = null) =>
onChangeIcon({ ...icon, zoom: newZoom ? newZoom : +e.target.value });
};
const handleZoomInClick = () => {
if (isDisabled) return;
const handleZoomInClick = () =>
handleSliderChange({}, icon.zoom <= 4.5 ? icon.zoom + 0.5 : 5);
};
const handleZoomOutClick = () => {
if (isDisabled) return;
const handleZoomOutClick = () =>
handleSliderChange({}, icon.zoom >= 1.5 ? icon.zoom - 0.5 : 1);
const handleDeleteImage = () => setUploadedFile(null);
};
const handleDeleteImage = () => {
if (isDisabled) return;
setUploadedFile(null);
};
const handleImageChange = throttle(() => {
if (editorRef) {
@ -181,6 +195,7 @@ const IconCropper = ({
iconName={"/static/images/zoom-minus.react.svg"}
isFill={true}
isClickable={false}
isDisabled={isDisabled}
/>
<Slider
className="icon_cropper-zoom-container-slider"
@ -189,6 +204,7 @@ const IconCropper = ({
onChange={handleSliderChange}
step={0.01}
value={icon.zoom}
isDisabled={isDisabled}
/>
<IconButton
className="icon_cropper-zoom-container-button"
@ -197,6 +213,7 @@ const IconCropper = ({
iconName={"/static/images/zoom-plus.react.svg"}
isFill={true}
isClickable={false}
isDisabled={isDisabled}
/>
</div>
</StyledIconCropper>

View File

@ -24,6 +24,7 @@ const IconEditor = ({
currentRoomTypeData,
icon,
onChangeIcon,
isDisabled,
}) => {
const [previewIcon, setPreviewIcon] = useState(null);
@ -41,6 +42,7 @@ const IconEditor = ({
uploadedFile={icon.uploadedFile}
setUploadedFile={setUploadedFile}
setPreviewIcon={setPreviewIcon}
isDisabled={isDisabled}
/>
<PreviewTile
@ -49,10 +51,15 @@ const IconEditor = ({
previewIcon={previewIcon}
tags={tags.map((tag) => tag.name)}
defaultTagLabel={t(currentRoomTypeData.defaultTag)}
isDisabled={isDisabled}
/>
</div>
)}
<Dropzone t={t} setUploadedFile={setUploadedFile} />
<Dropzone
t={t}
setUploadedFile={setUploadedFile}
isDisabled={isDisabled}
/>
</StyledIconEditor>
);
};

View File

@ -23,6 +23,7 @@ const InputParam = ({
onChange,
onFocus,
onBlur,
isDisabled,
}) => {
return (
<StyledInputParam>
@ -42,6 +43,7 @@ const InputParam = ({
scale
placeholder={placeholder}
tabIndex={2}
isDisabled={isDisabled}
/>
</StyledInputParam>
);

View File

@ -22,6 +22,7 @@ const PermanentSettings = ({
isThirdparty,
storageLocation,
isPrivate,
isDisabled,
}) => {
const createThirdpartyPath = () => {
const path = storageLocation.parentId.split("|");

View File

@ -17,10 +17,12 @@ const RoomTypeDropdown = ({
currentRoom,
setRoomType,
setIsScrollLocked,
isDisabled,
}) => {
const [isOpen, setIsOpen] = useState(false);
const toggleDropdown = () => {
if (isDisabled) return;
if (isOpen) {
setIsScrollLocked(false);
setIsOpen(false);
@ -31,6 +33,7 @@ const RoomTypeDropdown = ({
};
const chooseRoomType = (roomType) => {
if (isDisabled) return;
setRoomType(roomType);
toggleDropdown();
};

View File

@ -31,6 +31,7 @@ const SetRoomParams = ({
tagHandler,
setIsScrollLocked,
isEdit,
isDisabled,
}) => {
const onChangeName = (e) =>
setRoomParams({ ...roomParams, title: e.target.value });
@ -57,6 +58,7 @@ const SetRoomParams = ({
currentRoom={currentRoomTypeData}
setRoomType={setRoomType}
setIsScrollLocked={setIsScrollLocked}
isDisabled={isDisabled}
/>
)}
@ -67,6 +69,7 @@ const SetRoomParams = ({
isThirdparty={roomParams.isThirdparty}
storageLocation={roomParams.storageLocation}
isPrivate={roomParams.isPrivate}
isDisabled={isDisabled}
/>
)}
@ -76,6 +79,7 @@ const SetRoomParams = ({
placeholder={t("NamePlaceholder")}
value={roomParams.title}
onChange={onChangeName}
isDisabled={isDisabled}
/>
<TagInput
@ -83,6 +87,7 @@ const SetRoomParams = ({
tagHandler={tagHandler}
currentRoomTypeData={currentRoomTypeData}
setIsScrollLocked={setIsScrollLocked}
isDisabled={isDisabled}
/>
{/* {!isEdit && (
@ -101,6 +106,7 @@ const SetRoomParams = ({
onChangeStorageLocation={onChangeStorageLocation}
setIsScrollLocked={setIsScrollLocked}
setIsOauthWindowOpen={setIsOauthWindowOpen}
isDisabled={isDisabled}
/>
)}
@ -111,6 +117,7 @@ const SetRoomParams = ({
currentRoomTypeData={currentRoomTypeData}
icon={roomParams.icon}
onChangeIcon={onChangeIcon}
isDisabled={isDisabled}
/>
</StyledSetRoomParams>
);

View File

@ -12,6 +12,7 @@ const TagDropdown = ({
tagInputValue,
setTagInputValue,
createTagLabel,
isDisabled,
}) => {
const dropdownRef = useRef(null);

View File

@ -21,9 +21,14 @@ const StyledTagList = styled.div`
}
`;
const TagList = ({ defaultTagLabel, tagHandler }) => {
const TagList = ({ defaultTagLabel, tagHandler, isDisabled }) => {
const { tags } = tagHandler;
const onDeleteAction = (id) => {
if (isDisabled) return;
tagHandler.deleteTag(id);
};
return (
<StyledTagList className="set_room_params-tag_input-tag_list">
{tags.length ? (
@ -35,7 +40,7 @@ const TagList = ({ defaultTagLabel, tagHandler }) => {
label={tag.name}
isNewTag
onDelete={() => {
tagHandler.deleteTag(tag.id);
onDeleteAction(tag.id);
}}
/>
))

View File

@ -29,6 +29,7 @@ const TagInput = ({
tagHandler,
currentRoomTypeData,
setIsScrollLocked,
isDisabled,
}) => {
const [tagInput, setTagInput] = useState("");
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
@ -36,6 +37,7 @@ const TagInput = ({
const onTagInputChange = (e) => setTagInput(e.target.value);
const openDropdown = () => {
if (isDisabled) return;
setIsScrollLocked(true);
setIsDropdownOpen(true);
};
@ -55,6 +57,7 @@ const TagInput = ({
onChange={onTagInputChange}
onFocus={openDropdown}
onBlur={closeDropdown}
isDisabled={isDisabled}
/>
<TagDropdown
@ -68,6 +71,7 @@ const TagInput = ({
<TagList
tagHandler={tagHandler}
defaultTagLabel={t(currentRoomTypeData.defaultTag)}
isDisabled={isDisabled}
/>
</StyledTagInput>
);

View File

@ -98,11 +98,15 @@ const FolderInput = ({
roomTitle,
thirdpartyAccount,
onChangeStorageFolderId,
isDisabled,
}) => {
const [treeNode, setTreeNode] = useState(null);
const [isDialogOpen, setIsDialogOpen] = useState(false);
const onOpen = () => setIsDialogOpen(true);
const onOpen = () => {
if (isDisabled) return;
setIsDialogOpen(true);
};
const onClose = () => setIsDialogOpen(false);
const [path, setPath] = useState("");

View File

@ -116,6 +116,8 @@ const ThirdPartyComboBox = ({
setIsScrollLocked,
setIsOauthWindowOpen,
isDisabled,
}) => {
const dropdownRef = useRef(null);
@ -130,6 +132,7 @@ const ThirdPartyComboBox = ({
const [dropdownDirection, setDropdownDirection] = useState("bottom");
const toggleIsOpen = () => {
if (isDisabled) return;
if (isOpen) setIsScrollLocked(false);
else {
setIsScrollLocked(true);
@ -233,7 +236,9 @@ const ThirdPartyComboBox = ({
<Button
isDisabled={
!storageLocation?.provider || !!storageLocation?.thirdpartyAccount
!storageLocation?.provider ||
!!storageLocation?.thirdpartyAccount ||
isDisabled
}
className="set_room_params-thirdparty-connect"
size="small"

View File

@ -36,8 +36,11 @@ const ThirdPartyStorage = ({
openConnectWindow,
setConnectItem,
getOAuthToken,
isDisabled,
}) => {
const onChangeIsThirdparty = () => {
if (isDisabled) return;
if (connectItems.length) {
onChangeStorageLocation({
...storageLocation,
@ -110,6 +113,7 @@ const ThirdPartyStorage = ({
getOAuthToken={getOAuthToken}
setIsScrollLocked={setIsScrollLocked}
setIsOauthWindowOpen={setIsOauthWindowOpen}
isDisabled={isDisabled}
/>
)}
@ -119,6 +123,7 @@ const ThirdPartyStorage = ({
roomTitle={roomTitle}
thirdpartyAccount={storageLocation.thirdpartyAccount}
onChangeStorageFolderId={onChangeStorageFolderId}
isDisabled={isDisabled}
/>
)}

View File

@ -13,6 +13,7 @@ import withContent from "../../../../../HOCs/withContent";
import withBadges from "../../../../../HOCs/withBadges";
import { Base } from "@docspace/components/themes";
import { RoomsTypeTranslations } from "@docspace/common/constants";
import { desktop } from "@docspace/components/utils/device";
const SimpleFilesRowContent = styled(RowContent)`
.row-main-container-wrapper {
@ -20,6 +21,10 @@ const SimpleFilesRowContent = styled(RowContent)`
max-width: min-content;
min-width: inherit;
margin-right: 0px;
@media ${desktop} {
margin-top: 0px;
}
}
.row_update-text {

View File

@ -60,7 +60,10 @@ const StyledContainer = styled.div`
.header-container {
min-height: 33px;
height: 60px;
@media ${tablet} {
height: 60px;
}
}
`;

View File

@ -645,6 +645,10 @@ class FilesActionStore {
try {
await this.deleteItemOperation(isFile, itemId, translations, isRoom);
const id = Array.isArray(itemId) ? itemId : [itemId];
clearActiveOperations(isFile && id, !isFile && id);
} catch (err) {
clearActiveOperations(isFile && [itemId], !isFile && [itemId]);
setSecondaryProgressBarData({