2020-10-08 11:38:25 +00:00
|
|
|
import React, { ReactNode } from "react";
|
2020-09-25 17:11:25 +00:00
|
|
|
import { Page } from "@patternfly/react-core";
|
|
|
|
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
|
|
|
|
|
2020-08-27 12:09:36 +00:00
|
|
|
import { Header } from "./PageHeader";
|
|
|
|
import { PageNav } from "./PageNav";
|
2020-09-02 07:51:42 +00:00
|
|
|
import { Help } from "./components/help-enabler/HelpHeader";
|
2020-09-25 17:11:25 +00:00
|
|
|
|
2020-10-06 08:25:38 +00:00
|
|
|
import { RealmContextProvider } from "./context/realm-context/RealmContext";
|
|
|
|
import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
|
2020-10-08 11:38:25 +00:00
|
|
|
import { ServerInfoProvider } from "./context/server-info/ServerInfoProvider";
|
2020-10-06 19:25:05 +00:00
|
|
|
import { AlertProvider } from "./components/alert/Alerts";
|
2020-10-08 11:38:25 +00:00
|
|
|
|
2020-10-01 14:25:29 +00:00
|
|
|
import { routes } from "./route-config";
|
|
|
|
import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs";
|
2020-10-08 11:38:25 +00:00
|
|
|
const AppContexts = ({ children }: { children: ReactNode }) => (
|
|
|
|
<WhoAmIContextProvider>
|
|
|
|
<RealmContextProvider>
|
|
|
|
<Help>
|
|
|
|
<AlertProvider>
|
|
|
|
<ServerInfoProvider>{children}</ServerInfoProvider>
|
|
|
|
</AlertProvider>
|
|
|
|
</Help>
|
|
|
|
</RealmContextProvider>
|
|
|
|
</WhoAmIContextProvider>
|
|
|
|
);
|
2020-08-27 12:09:36 +00:00
|
|
|
|
2020-08-08 13:52:23 +00:00
|
|
|
export const App = () => {
|
2020-08-04 12:59:41 +00:00
|
|
|
return (
|
2020-10-08 11:38:25 +00:00
|
|
|
<AppContexts>
|
|
|
|
<Router>
|
|
|
|
<Page
|
|
|
|
header={<Header />}
|
|
|
|
isManagedSidebar
|
|
|
|
sidebar={<PageNav />}
|
|
|
|
breadcrumb={<PageBreadCrumbs />}
|
|
|
|
>
|
|
|
|
<Switch>
|
|
|
|
{routes(() => {}).map((route, i) => (
|
|
|
|
<Route key={i} {...route} exact />
|
|
|
|
))}
|
|
|
|
</Switch>
|
|
|
|
</Page>
|
|
|
|
</Router>
|
|
|
|
</AppContexts>
|
2020-08-04 12:59:41 +00:00
|
|
|
);
|
|
|
|
};
|