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 } 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
38 import applicationService from '../services/applicationManager';
\r
41 const styles = (theme: Theme) => createStyles({
\r
47 position: 'relative',
\r
53 flexDirection: "column",
\r
54 backgroundColor: theme.palette.background.default,
\r
55 padding: theme.spacing(3),
\r
56 minWidth: 0, // So the Typography noWrap works
\r
58 toolbar: theme.mixins.toolbar as any
\r
61 type FrameProps = WithStyles<typeof styles>;
\r
63 class FrameComponent extends React.Component<FrameProps>{
\r
66 const registrations = applicationService.applications;
\r
67 const { classes } = this.props;
\r
70 <SnackbarProvider maxSnack={3}>
\r
72 <div className={classes.root}>
\r
77 <main className={classes.content}>
\r
79 <div className={classes.toolbar} /> //needed for margins, don't remove!
\r
82 <Route exact path="/" component={() => (
\r
83 <AppFrame title={"Home"} icon={faHome} >
\r
87 <Route path="/about" component={() => (
\r
88 <AppFrame title={"About"} icon={faAddressBook} >
\r
92 {process.env.NODE_ENV === "development" ? <Route path="/test" component={() => (
\r
93 <AppFrame title={"Test"} icon={faAddressBook} >
\r
97 <Route path="/login" component={() => (
\r
98 <AppFrame title={"Login"} icon={faSignInAlt} >
\r
102 {Object.keys(registrations).map(p => {
\r
103 const application = registrations[p];
\r
104 return (<Route key={application.name} path={application.path || `/${application.name}`} component={() => (
\r
105 <AppFrame title={application.title || (typeof application.menuEntry === 'string' && application.menuEntry) || application.name} icon={application.icon} appId={application.name} >
\r
106 <application.rootComponent />
\r
110 <Redirect to="/" />
\r
115 </SnackbarProvider>
\r
116 </ConfirmProvider>
\r
121 export const Frame = withStyles(styles)(FrameComponent);
\r
122 export default Frame;
\r