Merge branch 'feature/workspaces' of https://github.com/ONLYOFFICE/AppServer into feature/workspaces

This commit is contained in:
Nikita Gopienko 2021-03-22 20:58:06 +03:00
commit fd704ab12a
12 changed files with 129 additions and 44 deletions

View File

@ -13,6 +13,6 @@
"timeout": "30000"
},
"proxy": {
"url": "/appserver"
"url": ""
}
}

View File

@ -6,6 +6,9 @@ import { isMobile } from "react-device-detect";
import { inject, observer } from "mobx-react";
import { withRouter } from "react-router";
import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
import config from "../../../../package.json";
const StyledThirdParty = styled.div`
margin-top: 42px;
@ -103,11 +106,13 @@ const PureThirdPartyListContainer = ({
history,
}) => {
const redirectAction = () => {
const thirdPartyUrl = "/products/files/settings/thirdParty";
if (history.location.pathname !== thirdPartyUrl) {
const thirdPartyUrl = "/settings/thirdParty";
if (history.location.pathname.indexOf(thirdPartyUrl) === -1) {
setSelectedNode(["thirdParty"]);
setSelectedFolder(null);
return history.push(thirdPartyUrl);
return history.push(
combineUrl(AppServerConfig.proxyURL, config.homepage, thirdPartyUrl)
);
}
};

View File

@ -9,6 +9,9 @@ import SettingsIcon from "../../../../../../../public/images/settings.react.svg"
import ExpanderDownIcon from "../../../../../../../public/images/expander-down.react.svg";
import ExpanderRightIcon from "../../../../../../../public/images/expander-right.react.svg";
import commonIconsStyles from "@appserver/components/utils/common-icons-style";
import config from "../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
const StyledTreeMenu = styled(TreeMenu)`
margin-top: 18px !important;
@ -115,12 +118,24 @@ const PureTreeSettings = ({
setSelectedNode(["common"]);
if (!expandedSetting || expandedSetting[0] !== "settings")
setExpandSettingsTree(section);
return history.push("/products/files/settings/common");
return history.push(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
"/settings/common"
)
);
}
if (selectedTreeNode[0] !== path) {
setSelectedNode(section);
return history.push(`/products/files/settings/${path}`);
return history.push(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/settings/${path}`
)
);
}
};

View File

@ -11,6 +11,8 @@ import ThirdPartyList from "./ThirdPartyList";
import { inject, observer } from "mobx-react";
import { withRouter } from "react-router-dom";
import config from "../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
class ArticleBodyContent extends React.Component {
constructor(props) {
@ -51,6 +53,7 @@ class ArticleBodyContent extends React.Component {
const newFilter = filter.clone();
newFilter.page = 0;
newFilter.startIndex = 0;
newFilter.folder = data[0];
const selectedFolderTitle =
(e.node && e.node.props && e.node.props.title) || null;
@ -59,14 +62,16 @@ class ArticleBodyContent extends React.Component {
? setDocumentTitle(selectedFolderTitle)
: setDocumentTitle();
if (window.location.pathname.indexOf("/files/filter") > 0) {
if (window.location.pathname.indexOf("/filter") > 0) {
fetchFiles(data[0], newFilter)
.catch((err) => toastr.error(err))
.finally(() => setIsLoading(false));
} else {
newFilter.startIndex = 0;
const urlFilter = newFilter.toUrlParams();
history.push(`${homepage}/filter?${urlFilter}`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`)
);
}
}
};

View File

@ -6,10 +6,12 @@ import DropDownItem from "@appserver/components/drop-down-item";
import { withTranslation } from "react-i18next";
import { isMobile } from "react-device-detect";
import Loaders from "@appserver/common/components/Loaders";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import { encryptionUploadDialog } from "../../../helpers/desktop";
import { inject, observer } from "mobx-react";
import config from "../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
class PureArticleMainButtonContent extends React.Component {
onCreate = (e) => {
// this.goToHomePage();
@ -39,7 +41,9 @@ class PureArticleMainButtonContent extends React.Component {
goToHomePage = () => {
const { homepage, history, filter } = this.props;
const urlFilter = filter.toUrlParams();
history.push(`${homepage}/filter?${urlFilter}`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`)
);
};
onFileChange = (e) => {

View File

@ -12,7 +12,11 @@ import {
convertFile,
getFileConversationProgress,
} from "@appserver/common/api/files";
import { FileAction, ShareAccessRights } from "@appserver/common/constants";
import {
AppServerConfig,
FileAction,
ShareAccessRights,
} from "@appserver/common/constants";
import toastr from "studio/toastr";
import FavoriteIcon from "../../../../../../../public/images/favorite.react.svg";
import FileActionsConvertEditDocIcon from "../../../../../../../public/images/file.actions.convert.edit.doc.react.svg";
@ -27,6 +31,7 @@ import EditingWrapperComponent from "../EditingWrapperComponent";
import { isMobile } from "react-device-detect";
import { observer, inject } from "mobx-react";
import config from "../../../../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
const sideColor = "#A3A9AE";
const StyledCheckIcon = styled(CheckIcon)`
@ -187,7 +192,14 @@ class FilesRowContent extends React.PureComponent {
let tab =
!isDesktop && item.fileExst
? window.open("/products/files/doceditor", "_blank")
? window.open(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
"/products/files/doceditor"
),
"_blank"
)
: null;
!item.fileExst
@ -381,7 +393,9 @@ class FilesRowContent extends React.PureComponent {
fetchFileVersions(item.id + "");
setIsVerHistoryPanel(true);
} else {
history.push(`${homepage}/${item.id}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${item.id}/history`)
);
}
};

View File

@ -10,9 +10,10 @@ import Row from "@appserver/components/row";
import FilesRowContent from "./FilesRowContent";
import { withRouter } from "react-router-dom";
import toastr from "studio/toastr";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import copy from "copy-to-clipboard";
import config from "../../../../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
const StyledSimpleFilesRow = styled(Row)`
margin-top: -2px;
@ -190,7 +191,9 @@ const SimpleFilesRow = (props) => {
fetchFileVersions(id + "");
setIsVerHistoryPanel(true);
} else {
history.push(`${homepage}/${id}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${id}/history`)
);
}
};

View File

@ -6,7 +6,7 @@ import Badge from "@appserver/components/badge";
import Link from "@appserver/components/link";
import Text from "@appserver/components/text";
import { markAsRead } from "@appserver/common/api/files";
import { FileAction } from "@appserver/common/constants";
import { FileAction, AppServerConfig } from "@appserver/common/constants";
import toastr from "studio/toastr";
import { getTitleWithoutExst } from "../../../../../helpers/files-helpers";
import { NewFilesPanel } from "../../../../panels";
@ -17,6 +17,7 @@ import { inject, observer } from "mobx-react";
import CheckIcon from "../../../../../../public/images/check.react.svg";
import CrossIcon from "../../../../../../../../../public/images/cross.react.svg";
import config from "../../../../../../package.json";
import { combineUrl } from "@appserver/common/utils";
const SimpleFilesTileContent = styled(TileContent)`
.rowMainContainer {
@ -282,7 +283,9 @@ class FilesTileContent extends React.PureComponent {
const { homepage, history } = this.props;
const fileId = e.currentTarget.dataset.id;
history.push(`${homepage}/${fileId}/history`);
history.push(
combineUrl(AppServerConfig.proxyURL, homepage, `/${fileId}/history`)
);
};
onBadgeClick = () => {

View File

@ -21,7 +21,9 @@ import {
StyledFooter,
} from "../StyledPanels";
import { inject, observer } from "mobx-react";
import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
import config from "../../../../package.json";
class NewFilesPanelComponent extends React.Component {
constructor(props) {
super(props);
@ -122,7 +124,16 @@ class NewFilesPanelComponent extends React.Component {
return addFileToRecentlyViewed(id)
.then(() => console.log("Pushed to recently viewed"))
.catch((e) => console.error(e))
.finally(window.open(`./doceditor?fileId=${id}`, "_blank"));
.finally(
window.open(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
),
"_blank"
)
);
}
if (isMedia) {

View File

@ -6,6 +6,7 @@ import {
FilterType,
FileType,
FileAction,
AppServerConfig,
} from "@appserver/common/constants";
import history from "@appserver/common/history";
import FileActionStore from "./FileActionStore";
@ -14,6 +15,7 @@ import formatsStore from "./FormatsStore";
import treeFoldersStore from "./TreeFoldersStore";
import { createTreeFolders } from "../helpers/files-helpers";
import config from "../../package.json";
import { combineUrl } from "@appserver/common/utils";
const { FilesFilter } = api;
@ -187,7 +189,13 @@ class FilesStore {
setFilterUrl = (filter) => {
const urlFilter = filter.toUrlParams();
history.push(`${config.homepage}/filter?${urlFilter}`);
history.push(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/filter?${urlFilter}`
)
);
};
fetchFiles = (folderId, filter, clearFilter = true) => {
@ -938,7 +946,14 @@ class FilesStore {
if (providerKey) {
tab
? (tab.location = url)
: window.open(`./doceditor?fileId=${id}`, "_blank");
: window.open(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
),
"_blank"
);
} else {
return this.addFileToRecentlyViewed(id)
.then(() => console.log("Pushed to recently viewed"))
@ -946,7 +961,14 @@ class FilesStore {
.finally(
tab
? (tab.location = url)
: window.open(`./doceditor?fileId=${id}`, "_blank")
: window.open(
combineUrl(
AppServerConfig.proxyURL,
config.homepage,
`/doceditor?fileId=${id}`
),
"_blank"
)
);
}
};

View File

@ -57,23 +57,6 @@ const PAYMENTS_URL = combineUrl(PROXY_HOMEPAGE_URL, "/payments");
const SETTINGS_URL = combineUrl(PROXY_HOMEPAGE_URL, "/settings");
const ERROR_401_URL = combineUrl(PROXY_HOMEPAGE_URL, "/error401");
if (!window.AppServer) {
window.AppServer = {};
}
window.AppServer.studio = {
HOME_URLS,
WIZARD_URL,
ABOUT_URL,
LOGIN_URLS,
CONFIRM_URL,
COMING_SOON_URLS,
THIRD_PARTY_RESPONSE_URL,
PAYMENTS_URL,
SETTINGS_URL,
ERROR_401_URL,
};
const Payments = React.lazy(() => import("./components/pages/Payments"));
const Error404 = React.lazy(() => import("studio/Error404"));
const Error401 = React.lazy(() => import("studio/Error401"));
@ -175,10 +158,28 @@ const ThirdPartyResponseRoute = (props) => (
);
const Shell = ({ items = [], page = "home", ...rest }) => {
const { isLoaded, loadBaseInfo, isThirdPartyResponse, modules } = rest;
const { isLoaded, loadBaseInfo, modules } = rest;
useEffect(() => {
try {
if (!window.AppServer) {
window.AppServer = {};
}
//TEMP object, will be removed!!!
window.AppServer.studio = {
HOME_URLS,
WIZARD_URL,
ABOUT_URL,
LOGIN_URLS,
CONFIRM_URL,
COMING_SOON_URLS,
THIRD_PARTY_RESPONSE_URL,
PAYMENTS_URL,
SETTINGS_URL,
ERROR_401_URL,
};
loadBaseInfo();
} catch (err) {
toastr.error(err);
@ -231,6 +232,8 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
);
});
//console.log("Shell ", history);
return (
<Layout>
<Router history={history}>
@ -272,7 +275,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
const ShellWrapper = inject(({ auth }) => {
const { init, isLoaded } = auth;
const pathname = window.location.pathname.toLowerCase();
const isThirdPartyResponse = pathname.indexOf("thirdparty") !== -1;
//const isThirdPartyResponse = pathname.indexOf("thirdparty") !== -1;
return {
loadBaseInfo: () => {
@ -280,7 +283,7 @@ const ShellWrapper = inject(({ auth }) => {
auth.settingsStore.setModuleInfo(config.homepage, "home");
auth.setProductVersion(config.version);
},
isThirdPartyResponse,
//isThirdPartyResponse,
isLoaded,
modules: auth.moduleStore.modules,
};

View File

@ -20,7 +20,6 @@ import { createPasswordHash, tryRedirectTo } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
import i18n from "./i18n";
import { I18nextProvider, useTranslation } from "react-i18next";
import throttle from "lodash/throttle";
const LoginContainer = styled.div`
display: flex;
@ -153,6 +152,7 @@ const Form = (props) => {
match,
organizationName,
greetingTitle,
history,
} = props;
const { error, confirmedEmail } = match.params;
@ -247,7 +247,7 @@ const Form = (props) => {
isDesktop && checkPwd();
login(userName, hash)
.then(() => tryRedirectTo(defaultPage))
.then(() => history.push(defaultPage))
.catch((error) => {
setErrorText(error);
setIdentifierValid(!error);