Merge branch 'feature/new-profile' of github.com:ONLYOFFICE/DocSpace into feature/new-profile
This commit is contained in:
commit
eb3cbfc927
@ -8,16 +8,19 @@ import Box from "@docspace/components/box";
|
||||
const EmptyFolderContainer = ({
|
||||
t,
|
||||
onCreate,
|
||||
filter,
|
||||
fetchFiles,
|
||||
fetchRooms,
|
||||
setIsLoading,
|
||||
parentId,
|
||||
linkStyles,
|
||||
isRooms,
|
||||
}) => {
|
||||
const onBackToParentFolder = () => {
|
||||
const newFilter = filter.clone();
|
||||
setIsLoading(true);
|
||||
fetchFiles(parentId, newFilter).finally(() => setIsLoading(false));
|
||||
|
||||
isRooms
|
||||
? fetchRooms(parentId).finally(() => setIsLoading(false))
|
||||
: fetchFiles(parentId).finally(() => setIsLoading(false));
|
||||
};
|
||||
|
||||
const buttons = (
|
||||
@ -85,12 +88,21 @@ const EmptyFolderContainer = ({
|
||||
};
|
||||
|
||||
export default inject(({ filesStore, selectedFolderStore }) => {
|
||||
const { filter, fetchFiles } = filesStore;
|
||||
const { fetchFiles, fetchRooms } = filesStore;
|
||||
const { navigationPath, parentId } = selectedFolderStore;
|
||||
|
||||
let isRootRoom, isRoom, id;
|
||||
if (navigationPath.length) {
|
||||
isRootRoom = navigationPath.at(-1).isRootRoom;
|
||||
isRoom = navigationPath.at(-1).isRoom;
|
||||
id = navigationPath.at(-1).id;
|
||||
}
|
||||
|
||||
return {
|
||||
filter,
|
||||
fetchFiles,
|
||||
fetchRooms,
|
||||
setIsLoading: filesStore.setIsLoading,
|
||||
parentId: selectedFolderStore.parentId,
|
||||
parentId: id ?? parentId,
|
||||
isRooms: isRoom || isRootRoom,
|
||||
};
|
||||
})(withTranslation(["Files", "Translations"])(observer(EmptyFolderContainer)));
|
||||
|
@ -26,6 +26,7 @@ const FilesListBody = ({
|
||||
page,
|
||||
folderSelection,
|
||||
getIcon,
|
||||
maxHeight = 384,
|
||||
}) => {
|
||||
const { t } = useTranslation(["SelectFile", "Common"]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@ -177,7 +178,7 @@ const FilesListBody = ({
|
||||
{({ onItemsRendered, ref }) => (
|
||||
<List
|
||||
theme={theme}
|
||||
height={384}
|
||||
height={maxHeight}
|
||||
itemCount={itemCount}
|
||||
itemSize={48}
|
||||
onItemsRendered={onItemsRendered}
|
||||
|
@ -117,6 +117,7 @@ class FilesListWrapper extends React.Component {
|
||||
folderSelection = false,
|
||||
fileId,
|
||||
folderId,
|
||||
maxHeight,
|
||||
} = this.props;
|
||||
const { hasNextPage, isNextPageLoading, files, page } = this.state;
|
||||
|
||||
@ -133,6 +134,7 @@ class FilesListWrapper extends React.Component {
|
||||
folderSelection={folderSelection}
|
||||
fileId={fileId}
|
||||
page={page}
|
||||
maxHeight={maxHeight}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ const SelectionPanelBody = ({
|
||||
folderSelection={folderSelection}
|
||||
newFilter={newFilter}
|
||||
fileId={fileId}
|
||||
maxHeight={!header ? 384 : 310}
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
|
@ -21,6 +21,8 @@ const commonStyles = css`
|
||||
const StyledModalDialog = styled(ModalDialog)`
|
||||
#modal-dialog {
|
||||
max-height: 560px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.select-panel-modal-header {
|
||||
@ -56,9 +58,9 @@ const StyledBody = styled.div`
|
||||
display: grid;
|
||||
grid-template-rows: max-content auto;
|
||||
}
|
||||
.selection-panel_files-list-body {
|
||||
/* .selection-panel_files-list-body {
|
||||
height: 384px;
|
||||
}
|
||||
} */
|
||||
.selection-panel_tree-body {
|
||||
grid-area: tree;
|
||||
height: 100%;
|
||||
|
@ -102,7 +102,7 @@ export const getDataSaveAs = async (params) => {
|
||||
const data = await request({
|
||||
baseURL: combineUrl(AppServerConfig.proxyURL, config.homepage),
|
||||
method: "get",
|
||||
url: `/httphandlers/filehandler.ashx?${params}`,
|
||||
url: `/products/files/httphandlers/filehandler.ashx?${params}`,
|
||||
responseType: "text",
|
||||
});
|
||||
|
||||
|
@ -679,9 +679,6 @@ class FilesStore {
|
||||
api.files
|
||||
.getFolder(folderId, filterData)
|
||||
.then(async (data) => {
|
||||
const isRecycleBinFolder =
|
||||
data.current.rootFolderType === FolderType.TRASH;
|
||||
|
||||
filterData.total = data.total;
|
||||
|
||||
if (data.total > 0) {
|
||||
@ -699,9 +696,6 @@ class FilesStore {
|
||||
}
|
||||
}
|
||||
|
||||
const isPrivacyFolder =
|
||||
data.current.rootFolderType === FolderType.Privacy;
|
||||
|
||||
runInAction(() => {
|
||||
this.categoryType = getCategoryTypeByFolderType(
|
||||
data.current.rootFolderType,
|
||||
@ -711,6 +705,9 @@ class FilesStore {
|
||||
|
||||
this.setFilesFilter(filterData); //TODO: FILTER
|
||||
|
||||
const isPrivacyFolder =
|
||||
data.current.rootFolderType === FolderType.Privacy;
|
||||
|
||||
runInAction(() => {
|
||||
this.setFolders(isPrivacyFolder && isMobile ? [] : data.folders);
|
||||
this.setFiles(isPrivacyFolder && isMobile ? [] : data.files);
|
||||
@ -724,10 +721,22 @@ class FilesStore {
|
||||
|
||||
const navigationPath = await Promise.all(
|
||||
data.pathParts.map(async (folder) => {
|
||||
const { Rooms, Archive } = FolderType;
|
||||
|
||||
let folderId = folder;
|
||||
|
||||
if (
|
||||
data.current.providerKey &&
|
||||
data.current.rootFolderType === Rooms &&
|
||||
this.treeFoldersStore.sharedRoomId
|
||||
) {
|
||||
folderId = this.treeFoldersStore.sharedRoomId;
|
||||
}
|
||||
|
||||
const folderInfo =
|
||||
data.current.id === folder
|
||||
data.current.id === folderId
|
||||
? data.current
|
||||
: await api.files.getFolderInfo(folder);
|
||||
: await api.files.getFolderInfo(folderId);
|
||||
|
||||
const {
|
||||
id,
|
||||
@ -737,14 +746,12 @@ class FilesStore {
|
||||
rootFolderType,
|
||||
} = folderInfo;
|
||||
|
||||
const { Rooms, Archive } = FolderType;
|
||||
|
||||
const isRootRoom =
|
||||
rootFolderId === id &&
|
||||
(rootFolderType === Rooms || rootFolderType === Archive);
|
||||
|
||||
return {
|
||||
id: folder,
|
||||
id: folderId,
|
||||
title,
|
||||
isRoom: !!roomType,
|
||||
isRootRoom,
|
||||
|
@ -493,8 +493,7 @@ function Editor({
|
||||
config.editorConfig.createUrl = combineUrl(
|
||||
window.location.origin,
|
||||
AppServerConfig.proxyURL,
|
||||
"products/files/",
|
||||
`/httphandlers/filehandler.ashx?action=create&doctype=text&title=${encodeURIComponent(
|
||||
`/products/files/httphandlers/filehandler.ashx?action=create&doctype=text&title=${encodeURIComponent(
|
||||
defaultFileName
|
||||
)}`
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import DynamicComponent from "./DynamicComponent";
|
||||
import { STUDIO_REMOTE_ENTRY_URL, STUDIO_SCOPE } from "../helpers/constants";
|
||||
import { CLIENT_REMOTE_ENTRY_URL, CLIENT_SCOPE } from "../helpers/constants";
|
||||
|
||||
const SelectFileDialog = ({
|
||||
isVisible,
|
||||
@ -17,8 +17,8 @@ const SelectFileDialog = ({
|
||||
<DynamicComponent
|
||||
{...rest}
|
||||
system={{
|
||||
scope: STUDIO_SCOPE,
|
||||
url: STUDIO_REMOTE_ENTRY_URL,
|
||||
scope: CLIENT_SCOPE,
|
||||
url: CLIENT_REMOTE_ENTRY_URL,
|
||||
module: "./SelectFileDialog",
|
||||
}}
|
||||
resetTreeFolders
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import DynamicComponent from "./DynamicComponent";
|
||||
import { STUDIO_REMOTE_ENTRY_URL, STUDIO_SCOPE } from "../helpers/constants";
|
||||
import { CLIENT_REMOTE_ENTRY_URL, CLIENT_SCOPE } from "../helpers/constants";
|
||||
import Text from "@docspace/components/text";
|
||||
import TextInput from "@docspace/components/text-input";
|
||||
import Checkbox from "@docspace/components/checkbox";
|
||||
@ -21,33 +21,23 @@ const SelectFolderDialog = ({
|
||||
}) => {
|
||||
const { t } = useTranslation(["Editor", "Common"]);
|
||||
|
||||
return (
|
||||
(mfReady && isVisible && successAuth && (
|
||||
<DynamicComponent
|
||||
system={{
|
||||
scope: STUDIO_SCOPE,
|
||||
url: STUDIO_REMOTE_ENTRY_URL,
|
||||
module: "./SelectFolderDialog",
|
||||
}}
|
||||
needProxy
|
||||
folderId={folderId}
|
||||
isPanelVisible={isVisible}
|
||||
onClose={onCloseFolderDialog}
|
||||
foldersType="exceptSortedByTags"
|
||||
onSave={onClickSaveSelectFolder}
|
||||
isDisableButton={!titleSelectorFolder.trim()}
|
||||
header={
|
||||
<StyledSelectFolder>
|
||||
<Text className="editor-select-folder_text">{t("FileName")}</Text>
|
||||
<TextInput
|
||||
className="editor-select-folder_text-input"
|
||||
scale
|
||||
onChange={onChangeInput}
|
||||
value={titleSelectorFolder}
|
||||
/>
|
||||
</StyledSelectFolder>
|
||||
}
|
||||
{...(extension !== "fb2" && {
|
||||
const headerProps = {
|
||||
header: (
|
||||
<StyledSelectFolder>
|
||||
<Text className="editor-select-folder_text">{t("FileName")}</Text>
|
||||
<TextInput
|
||||
className="editor-select-folder_text-input"
|
||||
scale
|
||||
onChange={onChangeInput}
|
||||
value={titleSelectorFolder}
|
||||
/>
|
||||
</StyledSelectFolder>
|
||||
),
|
||||
};
|
||||
|
||||
const footerProps =
|
||||
extension !== "fb2"
|
||||
? {
|
||||
footer: (
|
||||
<StyledSelectFolder>
|
||||
<Checkbox
|
||||
@ -58,7 +48,26 @@ const SelectFolderDialog = ({
|
||||
/>
|
||||
</StyledSelectFolder>
|
||||
),
|
||||
})}
|
||||
}
|
||||
: {};
|
||||
|
||||
return (
|
||||
(mfReady && isVisible && successAuth && (
|
||||
<DynamicComponent
|
||||
system={{
|
||||
scope: CLIENT_SCOPE,
|
||||
url: CLIENT_REMOTE_ENTRY_URL,
|
||||
module: "./SelectFolderDialog",
|
||||
}}
|
||||
needProxy
|
||||
folderId={folderId}
|
||||
isPanelVisible={isVisible}
|
||||
onClose={onCloseFolderDialog}
|
||||
foldersType="exceptSortedByTags"
|
||||
onSave={onClickSaveSelectFolder}
|
||||
isDisableButton={!titleSelectorFolder.trim()}
|
||||
{...headerProps}
|
||||
{...footerProps}
|
||||
/>
|
||||
)) ||
|
||||
null
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import DynamicComponent from "./DynamicComponent";
|
||||
import { STUDIO_REMOTE_ENTRY_URL, STUDIO_SCOPE } from "../helpers/constants";
|
||||
import { CLIENT_REMOTE_ENTRY_URL, CLIENT_SCOPE } from "../helpers/constants";
|
||||
|
||||
const SharingDialog = ({
|
||||
isVisible,
|
||||
@ -15,8 +15,8 @@ const SharingDialog = ({
|
||||
<DynamicComponent
|
||||
className="dynamic-sharing-dialog"
|
||||
system={{
|
||||
scope: STUDIO_SCOPE,
|
||||
url: STUDIO_REMOTE_ENTRY_URL,
|
||||
scope: CLIENT_SCOPE,
|
||||
url: CLIENT_REMOTE_ENTRY_URL,
|
||||
module: "./SharingDialog",
|
||||
name: "SharingDialog",
|
||||
}}
|
||||
|
@ -1,2 +1,2 @@
|
||||
export const STUDIO_SCOPE = "client";
|
||||
export const STUDIO_REMOTE_ENTRY_URL = "/remoteEntry.js";
|
||||
export const CLIENT_SCOPE = "client";
|
||||
export const CLIENT_REMOTE_ENTRY_URL = "/remoteEntry.js";
|
||||
|
@ -3,15 +3,15 @@ import {
|
||||
loadComponent,
|
||||
useDynamicScript,
|
||||
} from "../components/DynamicComponent";
|
||||
import { STUDIO_SCOPE, STUDIO_REMOTE_ENTRY_URL } from "../helpers/constants";
|
||||
import { CLIENT_SCOPE, CLIENT_REMOTE_ENTRY_URL } from "../helpers/constants";
|
||||
|
||||
function useMfScripts() {
|
||||
const [isInitialized, setIsInitialized] = React.useState(false);
|
||||
const [isError, setIsError] = React.useState(false);
|
||||
|
||||
const { ready: studioReady, failed: studioFailed } = useDynamicScript({
|
||||
id: STUDIO_SCOPE,
|
||||
url: STUDIO_REMOTE_ENTRY_URL,
|
||||
id: CLIENT_SCOPE,
|
||||
url: CLIENT_REMOTE_ENTRY_URL,
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
@ -27,11 +27,11 @@ function useMfScripts() {
|
||||
|
||||
const initMfScripts = async () => {
|
||||
const SharingDialog = await loadComponent(
|
||||
STUDIO_SCOPE,
|
||||
CLIENT_SCOPE,
|
||||
"./SharingDialog"
|
||||
)();
|
||||
const filesUtils = await loadComponent(STUDIO_SCOPE, "./utils")();
|
||||
const authStore = await loadComponent(STUDIO_SCOPE, "./store")();
|
||||
const filesUtils = await loadComponent(CLIENT_SCOPE, "./utils")();
|
||||
const authStore = await loadComponent(CLIENT_SCOPE, "./store")();
|
||||
|
||||
window.filesUtils = filesUtils;
|
||||
window.SharingDialog = SharingDialog.default;
|
||||
|
Loading…
Reference in New Issue
Block a user