Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0' into feature/editor-history
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaLopaeva committed Dec 10, 2021
2 parents 2afce47 + 7c15232 commit 00ab712
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 102 deletions.
2 changes: 1 addition & 1 deletion products/ASC.Files/Client/public/locales/en/Home.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
"UploadToFolder": "Upload to folder",
"ViewList": "List",
"ViewTiles": "Tiles",
"NewMasterForm": "New master form",
"NewMasterForm": "New form template",
"ViewTiles": "Tiles"
}
94 changes: 53 additions & 41 deletions products/ASC.Files/Client/src/HOCs/withContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export default function withContent(WrappedContent) {
constructor(props) {
super(props);

const { item, fileActionId, fileActionExt } = props;
const { item, fileActionId, fileActionExt, fileActionTemplateId } = props;
let titleWithoutExt = getTitleWithoutExst(item);
if (fileActionId === -1 && item.id === fileActionId) {
if (
fileActionId === -1 &&
item.id === fileActionId &&
fileActionTemplateId === null
) {
titleWithoutExt = getDefaultFileName(fileActionExt);
}

Expand Down Expand Up @@ -119,16 +123,17 @@ export default function withContent(WrappedContent) {
createItem = (e, open) => {
const {
createFile,
item,
setIsLoading,
createFolder,
fileActionTemplateId,
isDesktop,
isLoading,
openDocEditor,
isPrivacy,
isDesktop,
item,
openDocEditor,
replaceFileStream,
t,
setEncryptionAccess,
createFolder,
setIsLoading,
t,
} = this.props;
const { itemTitle } = this.state;

Expand Down Expand Up @@ -162,7 +167,11 @@ export default function withContent(WrappedContent) {
.finally(() => {
return setIsLoading(false);
})
: createFile(item.parentId, `${itemTitle}.${item.fileExst}`)
: createFile(
item.parentId,
`${itemTitle}.${item.fileExst}`,
fileActionTemplateId
)
.then((file) => {
if (isPrivacy) {
return setEncryptionAccess(file).then((encryptedFile) => {
Expand Down Expand Up @@ -230,25 +239,26 @@ export default function withContent(WrappedContent) {
render() {
const { itemTitle } = this.state;
const {
item,
fileActionId,
element,
fileActionExt,
viewer,
t,
fileActionId,
isDesktop,
isTrashFolder,
item,
onFilesClick,
t,
viewAs,
element,
isDesktop,
viewer,
} = this.props;
const {
id,
fileExst,
updated,
createdBy,
access,
createdBy,
fileExst,
fileStatus,
href,
icon,
id,
updated,
} = item;

const titleWithoutExt = getTitleWithoutExst(item);
Expand All @@ -275,15 +285,15 @@ export default function withContent(WrappedContent) {
: { onClick: onFilesClick };

if (!isDesktop && !isTrashFolder) {
linkStyles.href = item.href;
linkStyles.href = href;
}

const newItems = item.new || fileStatus === 2;
const showNew = !!newItems;
const elementIcon = element ? (
element
) : (
<ItemIcon id={item.id} icon={item.icon} fileExst={item.fileExst} />
<ItemIcon id={id} icon={icon} fileExst={fileExst} />
);

return isEdit ? (
Expand Down Expand Up @@ -319,51 +329,53 @@ export default function withContent(WrappedContent) {
({ filesActionsStore, filesStore, treeFoldersStore, auth }, {}) => {
const { editCompleteAction } = filesActionsStore;
const {
setIsLoading,
createFile,
createFolder,
isLoading,
openDocEditor,
updateFile,
renameFolder,
createFile,
createFolder,
setIsLoading,
updateFile,
viewAs,
} = filesStore;
const { isRecycleBinFolder, isPrivacyFolder } = treeFoldersStore;

const {
type: fileActionType,
extension: fileActionExt,
id: fileActionId,
templateId: fileActionTemplateId,
type: fileActionType,
} = filesStore.fileActionStore;
const { replaceFileStream, setEncryptionAccess } = auth;
const {
culture,
isDesktopClient,
folderFormValidation,
isDesktopClient,
} = auth.settingsStore;

return {
setIsLoading,
createFile,
createFolder,
culture,
editCompleteAction,
fileActionExt,
fileActionId,
fileActionTemplateId,
fileActionType,
folderFormValidation,
homepage: config.homepage,
isDesktop: isDesktopClient,
isLoading,
isPrivacy: isPrivacyFolder,
isTrashFolder: isRecycleBinFolder,
openDocEditor,
updateFile,
renameFolder,
fileActionId,
editCompleteAction,
fileActionType,
createFile,
isPrivacy: isPrivacyFolder,
isDesktop: isDesktopClient,
replaceFileStream,
setEncryptionAccess,
createFolder,
fileActionExt,
culture,
homepage: config.homepage,
viewer: auth.userStore.user,
setIsLoading,
updateFile,
viewAs,
folderFormValidation,
viewer: auth.userStore.user,
};
}
)(observer(WithContent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const Panels = (props) => {
headerName={t("Translations:CreateMasterFormFromFile")}
titleFilesList={t("SelectFile:SelectDOCXFormat")}
creationButtonPrimary
withSubfolders={false}
/>
),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SelectFileDialogModalView extends React.Component {
isAvailable: true,
};
this.folderList = "";
this.noTreeSwitcher = false;
}

componentDidMount() {
Expand All @@ -46,7 +47,10 @@ class SelectFileDialogModalView extends React.Component {
case "exceptSortedByTags":
try {
const foldersTree = await getFoldersTree();
this.folderList = SelectFolderDialog.convertFolders(
[
this.folderList,
this.noTreeSwitcher,
] = SelectFolderDialog.convertFolders(
foldersTree,
exceptSortedByTagsFolders
);
Expand All @@ -60,10 +64,10 @@ class SelectFileDialogModalView extends React.Component {
case "exceptTrashFolder":
try {
const foldersTree = await getFoldersTree();
this.folderList = SelectFolderDialog.convertFolders(
foldersTree,
exceptTrashFolder
);
[
this.folderList,
this.noTreeSwitcher,
] = SelectFolderDialog.convertFolders(foldersTree, exceptTrashFolder);
this.onSetSelectedFolder();
} catch (err) {
console.error(err);
Expand All @@ -74,7 +78,10 @@ class SelectFileDialogModalView extends React.Component {
case "exceptPrivacyTrashFolders":
try {
const foldersTree = await getFoldersTree();
this.folderList = SelectFolderDialog.convertFolders(
[
this.folderList,
this.noTreeSwitcher,
] = SelectFolderDialog.convertFolders(
foldersTree,
exceptPrivacyTrashFolders
);
Expand Down Expand Up @@ -199,6 +206,7 @@ class SelectFileDialogModalView extends React.Component {
<StyledSelectFilePanel
isHeaderChildren={isHeaderChildren}
displayType="modal"
noTreeSwitcher={this.noTreeSwitcher}
>
<div className="modal-dialog_body">
<div className="modal-dialog_tree-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const SelectFolderDialogAsideView = ({
canCreate,
isLoading,
primaryButtonName,
noTreeSwitcher,
}) => {
return (
<StyledAsidePanel visible={isPanelVisible}>
Expand Down Expand Up @@ -62,7 +63,7 @@ const SelectFolderDialogAsideView = ({
displayType={DISPLAY_TYPE}
showButtons={showButtons}
isFooter={!!footer}
folderListLength={folderList?.length}
noTreeSwitcher={noTreeSwitcher}
>
<div className="select-folder-dialog_aside_body">
<div>{header} </div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const SelectFolderDialogModalView = ({
canCreate,
isLoading,
primaryButtonName,
noTreeSwitcher,
}) => {
return (
<StyledAsidePanel visible={isPanelVisible}>
Expand All @@ -44,7 +45,7 @@ const SelectFolderDialogModalView = ({
<ModalDialog.Body>
<StyledSelectFolderPanel
isNeedArrowIcon={isNeedArrowIcon}
folderListLength={folderList?.length}
noTreeSwitcher={noTreeSwitcher}
>
<div className="select-folder-modal-dialog-header">{header} </div>
<FolderTreeBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class SelectFolderModalDialog extends React.Component {
};
this.throttledResize = throttle(this.setDisplayType, 300);
this.folderTitle = "";
this.noTreeSwitcher = false;
}

componentDidMount() {
Expand Down Expand Up @@ -115,7 +116,7 @@ class SelectFolderModalDialog extends React.Component {
case "exceptSortedByTags":
try {
const foldersTree = await getFoldersTree();
folderList = SelectFolderDialog.convertFolders(
[folderList, this.noTreeSwitcher] = SelectFolderDialog.convertFolders(
foldersTree,
exceptSortedByTagsFolders
);
Expand All @@ -128,7 +129,7 @@ class SelectFolderModalDialog extends React.Component {
case "exceptTrashFolder":
try {
const foldersTree = await getFoldersTree();
folderList = SelectFolderDialog.convertFolders(
[folderList, this.noTreeSwitcher] = SelectFolderDialog.convertFolders(
foldersTree,
exceptTrashFolder
);
Expand All @@ -141,7 +142,7 @@ class SelectFolderModalDialog extends React.Component {
case "exceptPrivacyTrashFolders":
try {
const foldersTree = await getFoldersTree();
folderList = SelectFolderDialog.convertFolders(
[folderList, this.noTreeSwitcher] = SelectFolderDialog.convertFolders(
foldersTree,
exceptPrivacyTrashFolders
);
Expand Down Expand Up @@ -511,6 +512,7 @@ class SelectFolderModalDialog extends React.Component {
canCreate={canCreate}
isLoading={isLoading}
primaryButtonName={this.buttonName}
noTreeSwitcher={this.noTreeSwitcher}
/>
) : (
<SelectFolderDialogModalView
Expand All @@ -534,6 +536,7 @@ class SelectFolderModalDialog extends React.Component {
isLoadingData={isLoadingData}
isLoading={isLoading}
primaryButtonName={this.buttonName}
noTreeSwitcher={this.noTreeSwitcher}
/>
);
}
Expand Down Expand Up @@ -666,11 +669,25 @@ class SelectFolderDialog extends React.Component {
static convertFolders = (folders, arrayOfExceptions) => {
let newArray = [];

let noSubfoldersCount = 0;
let needHideSwitcher = false;
for (let i = 0; i < folders.length; i++) {
!arrayOfExceptions.includes(folders[i].rootFolderType) &&
if (!arrayOfExceptions.includes(folders[i].rootFolderType)) {
newArray.push(folders[i]);

if (
folders[i].foldersCount === 0 ||
folders[i].rootFolderType === FolderType.Privacy
) {
noSubfoldersCount += 1;
}
}
}

if (newArray.length === noSubfoldersCount) {
needHideSwitcher = true;
}
return newArray;
return [newArray, needHideSwitcher];
};
render() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class SharingPanelComponent extends React.Component {
/>
<Aside className="header_aside-panel" visible={visible}>
<StyledContent isDisabled={isLoading}>
<StyledHeaderContent>
<StyledHeaderContent className="sharing_panel-header-container">
{uploadPanelVisible && (
<IconButton
size="16"
Expand Down
Loading

0 comments on commit 00ab712

Please sign in to comment.