2 * ============LICENSE_START========================================================================
\r
3 * ONAP : ccsdk feature sdnr wt odlux
\r
4 * =================================================================================================
\r
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
\r
6 * =================================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
\r
8 * in compliance with the License. You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
\r
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
\r
14 * or implied. See the License for the specific language governing permissions and limitations under
\r
16 * ============LICENSE_END==========================================================================
\r
18 import * as React from 'react';
\r
19 import { HashRouter as Router, Route, Redirect, Switch } from 'react-router-dom';
\r
21 import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles';
\r
22 import { faHome, faAddressBook, faSignInAlt, faCog } from '@fortawesome/free-solid-svg-icons';
\r
24 import { SnackbarProvider } from 'notistack';
\r
25 import { ConfirmProvider } from 'material-ui-confirm';
\r
27 import AppFrame from '../components/routing/appFrame';
\r
28 import TitleBar from '../components/titleBar';
\r
29 import Menu from '../components/navigationMenu';
\r
30 import ErrorDisplay from '../components/errorDisplay';
\r
31 import SnackDisplay from '../components/material-ui/snackDisplay';
\r
33 import Home from '../views/home';
\r
34 import Login from '../views/login';
\r
35 import About from '../views/about';
\r
36 import Test from '../views/test';
\r
37 import UserSettings from '../views/settings';
\r
39 import applicationService from '../services/applicationManager';
\r
42 const styles = (theme: Theme) => createStyles({
\r
48 position: 'relative',
\r
54 flexDirection: "column",
\r
55 backgroundColor: theme.palette.background.default,
\r
56 padding: theme.spacing(3),
\r
57 minWidth: 0, // So the Typography noWrap works
\r
59 toolbar: theme.mixins.toolbar as any
\r
64 type FrameProps = WithStyles<typeof styles>;
\r
66 class FrameComponent extends React.Component<FrameProps>{
\r
69 const registrations = applicationService.applications;
\r
70 const { classes } = this.props;
\r
73 <SnackbarProvider maxSnack={3}>
\r
75 <div className={classes.root}>
\r
80 <main className={classes.content}>
\r
82 <div className={classes.toolbar} /> //needed for margins, don't remove!
\r
85 <Route exact path="/" component={() => (
\r
86 <AppFrame title={"Home"} icon={faHome} >
\r
90 <Route path="/about" component={() => (
\r
91 <AppFrame title={"About"} icon={faAddressBook} >
\r
95 <Route path="/settings" component={() => (
\r
96 <AppFrame title={"Settings"} icon={faCog} >
\r
100 {process.env.NODE_ENV === "development" ? <Route path="/test" component={() => (
\r
101 <AppFrame title={"Test"} icon={faAddressBook} >
\r
105 <Route path="/login" component={() => (
\r
106 <AppFrame title={"Login"} icon={faSignInAlt} >
\r
110 { Object.keys(registrations).map(p => {
\r
111 const application = registrations[p];
\r
112 return (<Route key={application.name} path={application.path || `/${application.name}`} component={() => (
\r
113 <AppFrame title={application.title || (typeof application.menuEntry === 'string' && application.menuEntry) || application.name} icon={application.icon} appId={application.name} >
\r
114 <application.rootComponent />
\r
118 <Redirect to="/" />
\r
123 </SnackbarProvider>
\r
124 </ConfirmProvider>
\r
129 export const Frame = withStyles(styles)(FrameComponent);
\r
130 export default Frame;
\r