diff --git a/interface/.env b/interface/.env index 54f3b9d..a312b2a 100644 --- a/interface/.env +++ b/interface/.env @@ -1 +1,5 @@ -REACT_APP_NAME=ESP8266 React +# This is the name of your project. It appears on the sign-in page and in the menu bar. +REACT_APP_PROJECT_NAME=ESP8266 React + +# This is the url path your project will be exposed under. +REACT_APP_PROJECT_PATH=project diff --git a/interface/.env.development b/interface/.env.development index a5bcdb0..ce8e236 100644 --- a/interface/.env.development +++ b/interface/.env.development @@ -1 +1 @@ -REACT_APP_ENDPOINT_ROOT=http://192.168.0.11/rest/ +REACT_APP_ENDPOINT_ROOT=http://192.168.0.19/rest/ diff --git a/interface/src/AppRouting.js b/interface/src/AppRouting.js index 10670f1..2a85b10 100644 --- a/interface/src/AppRouting.js +++ b/interface/src/AppRouting.js @@ -2,18 +2,18 @@ import React, { Component } from 'react'; import { Redirect, Switch } from 'react-router'; +import { PROJECT_PATH } from './constants/Env'; import * as Authentication from './authentication/Authentication'; import AuthenticationWrapper from './authentication/AuthenticationWrapper'; import AuthenticatedRoute from './authentication/AuthenticatedRoute'; import UnauthenticatedRoute from './authentication/UnauthenticatedRoute'; - import SignInPage from './containers/SignInPage'; - import WiFiConnection from './sections/WiFiConnection'; import AccessPoint from './sections/AccessPoint'; import NetworkTime from './sections/NetworkTime'; import Security from './sections/Security'; import System from './sections/System'; +import ProjectRouting from './project/ProjectRouting'; class AppRouting extends Component { @@ -31,6 +31,7 @@ class AppRouting extends Component { + diff --git a/interface/src/authentication/Authentication.js b/interface/src/authentication/Authentication.js index eb3acdc..4d4d5d1 100644 --- a/interface/src/authentication/Authentication.js +++ b/interface/src/authentication/Authentication.js @@ -1,4 +1,5 @@ import history from '../history'; +import { PROJECT_PATH } from '../constants/Env'; export const ACCESS_TOKEN = 'access_token'; export const LOGIN_PATHNAME = 'loginPathname'; @@ -21,7 +22,7 @@ export function fetchLoginRedirect() { const loginSearch = localStorage.getItem(LOGIN_SEARCH); clearLoginRedirect(); return { - pathname: loginPathname || "/wifi/", + pathname: loginPathname || `/${PROJECT_PATH}/`, search: (loginPathname && loginSearch) || undefined }; } diff --git a/interface/src/components/MenuAppBar.js b/interface/src/components/MenuAppBar.js index f3f0f15..30b5288 100644 --- a/interface/src/components/MenuAppBar.js +++ b/interface/src/components/MenuAppBar.js @@ -30,7 +30,8 @@ import CardContent from '@material-ui/core/CardContent'; import CardActions from '@material-ui/core/CardActions'; import Avatar from '@material-ui/core/Avatar'; -import { APP_NAME } from '../constants/App'; +import ProjectMenu from '../project/ProjectMenu'; +import { PROJECT_NAME } from '../constants/Env'; import { withAuthenticationContext } from '../authentication/Context.js'; const drawerWidth = 290; @@ -65,8 +66,7 @@ const styles = theme => ({ width: drawerWidth, }, content: { - flexGrow: 1, - padding: theme.spacing(), + flexGrow: 1 }, authMenu: { zIndex: theme.zIndex.tooltip, @@ -112,11 +112,13 @@ class MenuAppBar extends React.Component {
- {APP_NAME} + {PROJECT_NAME} + + diff --git a/interface/src/components/SectionContent.js b/interface/src/components/SectionContent.js index 71e82c0..f5a48ee 100644 --- a/interface/src/components/SectionContent.js +++ b/interface/src/components/SectionContent.js @@ -8,15 +8,15 @@ import Typography from '@material-ui/core/Typography'; const styles = theme => ({ content: { padding: theme.spacing(2), - margin: theme.spacing(2), + margin: theme.spacing(3), } }); function SectionContent(props) { - const { children, classes, title } = props; + const { children, classes, title, titleGutter } = props; return ( - + {title} {children} @@ -30,7 +30,8 @@ SectionContent.propTypes = { PropTypes.arrayOf(PropTypes.node), PropTypes.node ]).isRequired, - title: PropTypes.string.isRequired + title: PropTypes.string.isRequired, + titleGutter: PropTypes.bool }; export default withStyles(styles)(SectionContent); diff --git a/interface/src/constants/App.js b/interface/src/constants/App.js deleted file mode 100644 index da2a94d..0000000 --- a/interface/src/constants/App.js +++ /dev/null @@ -1 +0,0 @@ -export const APP_NAME = process.env.REACT_APP_NAME; diff --git a/interface/src/constants/Env.js b/interface/src/constants/Env.js new file mode 100644 index 0000000..d0b5ff5 --- /dev/null +++ b/interface/src/constants/Env.js @@ -0,0 +1,2 @@ +export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME; +export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH; diff --git a/interface/src/containers/APStatus.js b/interface/src/containers/APStatus.js index 95d3d64..afd019c 100644 --- a/interface/src/containers/APStatus.js +++ b/interface/src/containers/APStatus.js @@ -96,9 +96,7 @@ class APStatus extends Component { return (
- - {this.createListItems(data, classes)} - + {this.createListItems(data, classes)}