Web: Settings: Add URL proxy

This commit is contained in:
Alexey Safronov 2021-03-22 18:24:03 +03:00
parent d7981f3f53
commit ce86b6014b
5 changed files with 82 additions and 52 deletions

View File

@ -2,12 +2,17 @@ import React, { lazy, Suspense } from "react";
import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
import Loader from "@appserver/components/loader";
import { combineUrl } from "@appserver/common/utils";
import AppServerConfig from "@appserver/common/constants/AppServerConfig";
const ThirdPartyServices = lazy(() => import("./thirdPartyServicesSettings"));
const Integration = ({ match }) => {
const basePath = "/settings/integration";
const PROXY_BASE_URL = combineUrl(
AppServerConfig.proxyURL,
"/settings/integration"
);
const Integration = ({ match }) => {
return (
<Suspense
fallback={<Loader className="pageLoader" type="rombs" size="40px" />}
@ -16,8 +21,8 @@ const Integration = ({ match }) => {
<Route
exact
path={[
`${basePath}/third-party-services`,
"/integration",
combineUrl(PROXY_BASE_URL, "/third-party-services"),
combineUrl(AppServerConfig.proxyURL, "/integration"),
match.path,
]}
component={ThirdPartyServices}

View File

@ -14,9 +14,12 @@ import { combineUrl } from "@appserver/common/utils";
import { AppServerConfig } from "@appserver/common/constants";
const MainContainer = styled.div`
padding-bottom: 16px;
width: 100%;
.settings_tabs {
padding-bottom: 16px;
}
.page_loader {
position: fixed;
left: 50%;
@ -95,7 +98,9 @@ class PureAccessRights extends Component {
return (
<MainContainer>
<TabContainer
<OwnerSettings />
{/* <TabContainer
classNem="settings_tabs"
selectedItem={selectedTab}
isDisabled={isLoading}
onSelect={this.onSelectPage}
@ -105,18 +110,19 @@ class PureAccessRights extends Component {
title: t("OwnerSettings"),
content: <OwnerSettings />,
},
// {
// key: "1",
// title: t("AdminsSettings"),
// content: <AdminsSettings />,
// },
// {
// key: "2",
// title: "Portals settings",
// content: <ModulesSettings />
// }
{
key: "1",
title: t("AdminsSettings"),
content: <AdminsSettings />,
dis
},
{
key: "2",
title: "Portals settings",
content: <ModulesSettings />
}
]}
/>
/> */}
</MainContainer>
);
}

View File

@ -1,34 +1,47 @@
import React, { lazy, Suspense } from "react";
import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
import { combineUrl } from "@appserver/common/utils";
import AppServerConfig from "@appserver/common/constants/AppServerConfig";
const AccessRightsSettings = lazy(() => import("./accessRights"));
const Security = () => {
const basePath = "/settings/security";
const PROXY_BASE_URL = combineUrl(
AppServerConfig.proxyURL,
"/settings/security"
);
const ACCESS_RIGHTS_URLS = [
combineUrl(PROXY_BASE_URL, "/accessrights"),
combineUrl(PROXY_BASE_URL, "/accessrights/owner"),
];
const ADMINS_URLS = [
combineUrl(PROXY_BASE_URL, "/accessrights/admins"),
PROXY_BASE_URL,
];
const MODULES_URLS = [
combineUrl(PROXY_BASE_URL, "/accessrights/modules"),
PROXY_BASE_URL,
];
const Security = () => {
return (
<Suspense fallback={null}>
<Switch>
<Route
exact
path={[
`${basePath}/accessrights`,
basePath,
`${basePath}/accessrights/owner`,
]}
path={ACCESS_RIGHTS_URLS}
component={AccessRightsSettings}
selectedTab={0}
/>
<Route
exact
path={[`${basePath}/accessrights/admins`, basePath]}
path={ADMINS_URLS}
component={AccessRightsSettings}
selectedTab={1}
/>
{/* <Route
exact
path={[`${basePath}/accessrights/modules`, basePath]}
path={MODULES_URLS}
component={AccessRightsSettings}
selectedTab={2}
/> */}

View File

@ -33,7 +33,7 @@ const OwnerContainer = styled.div`
}
`;
const HeaderContainer = styled.div`
margin: 40px 0 16px 0;
margin: 0 0 16px 0;
`;
const BodyContainer = styled.div`

View File

@ -2,6 +2,8 @@ import React, { lazy, Suspense } from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import { withRouter } from "react-router";
import Layout from "./Layout";
import { combineUrl } from "@appserver/common/utils";
import AppServerConfig from "@appserver/common/constants/AppServerConfig";
const SecuritySettings = lazy(() => import("./categories/security"));
const CustomizationSettings = lazy(() =>
@ -16,47 +18,51 @@ const ThirdPartyServices = lazy(() =>
);
//const WhiteLabel = lazy(() => import("./categories/common/whitelabel"));
const PROXY_BASE_URL = combineUrl(AppServerConfig.proxyURL, "/settings");
const CUSTOMIZATION_URLS = [
combineUrl(PROXY_BASE_URL, "/common/customization"),
combineUrl(PROXY_BASE_URL, "/common"),
PROXY_BASE_URL,
];
const LTZ_URL = combineUrl(
PROXY_BASE_URL,
"/common/customization/language-and-time-zone"
);
const CUSTOM_TITLE_URL = combineUrl(
PROXY_BASE_URL,
"/common/customization/custom-titles"
);
//const WHITELABEL_URL = combineUrl(PROXY_BASE_URL, "/common/whitelabel");
const SECURITY_URL = combineUrl(PROXY_BASE_URL, "/security");
const THIRD_PARTY_URL = combineUrl(
PROXY_BASE_URL,
"/integration/third-party-services"
);
const ERROR_404_URL = combineUrl(AppServerConfig.proxyURL, "/error/404");
const Settings = () => {
const basePath = "/settings";
return (
<Layout key="1">
<Suspense fallback={null}>
<Switch>
<Route
exact
path={[
`${basePath}/common/customization`,
`${basePath}/common`,
basePath,
]}
path={CUSTOMIZATION_URLS}
component={CustomizationSettings}
/>
<Route
exact
path={[`${basePath}/common/customization/language-and-time-zone`]}
component={LanguageAndTimeZoneSettings}
/>
<Route
exact
path={[`${basePath}/common/customization/custom-titles`]}
component={CustomTitles}
/>
<Route exact path={LTZ_URL} component={LanguageAndTimeZoneSettings} />
<Route exact path={CUSTOM_TITLE_URL} component={CustomTitles} />
{/* <Route
exact
path={`${basePath}/common/whitelabel`}
path={WHITELABEL_URL}
component={WhiteLabel}
/> */}
<Route path={`${basePath}/security`} component={SecuritySettings} />
<Route
exact
path={`${basePath}/integration/third-party-services`}
component={ThirdPartyServices}
/>
<Route path={SECURITY_URL} component={SecuritySettings} />
<Route exact path={THIRD_PARTY_URL} component={ThirdPartyServices} />
<Redirect
to={{
pathname: "/error/404",
pathname: ERROR_404_URL,
}}
/>
</Switch>