Add placeholder system section, for status page and reset feature.
This commit is contained in:
parent
9ee9596b72
commit
d9ad598e0f
@ -7,13 +7,13 @@ import AuthenticationWrapper from './authentication/AuthenticationWrapper';
|
|||||||
import AuthenticatedRoute from './authentication/AuthenticatedRoute';
|
import AuthenticatedRoute from './authentication/AuthenticatedRoute';
|
||||||
import UnauthenticatedRoute from './authentication/UnauthenticatedRoute';
|
import UnauthenticatedRoute from './authentication/UnauthenticatedRoute';
|
||||||
|
|
||||||
import OTAConfiguration from './containers/OTAConfiguration';
|
|
||||||
import SignInPage from './containers/SignInPage';
|
import SignInPage from './containers/SignInPage';
|
||||||
|
|
||||||
import WiFiConnection from './sections/WiFiConnection';
|
import WiFiConnection from './sections/WiFiConnection';
|
||||||
import AccessPoint from './sections/AccessPoint';
|
import AccessPoint from './sections/AccessPoint';
|
||||||
import NetworkTime from './sections/NetworkTime';
|
import NetworkTime from './sections/NetworkTime';
|
||||||
import Security from './sections/Security';
|
import Security from './sections/Security';
|
||||||
|
import System from './sections/System';
|
||||||
|
|
||||||
class AppRouting extends Component {
|
class AppRouting extends Component {
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class AppRouting extends Component {
|
|||||||
<AuthenticatedRoute exact path="/wifi/*" component={WiFiConnection} />
|
<AuthenticatedRoute exact path="/wifi/*" component={WiFiConnection} />
|
||||||
<AuthenticatedRoute exact path="/ap/*" component={AccessPoint} />
|
<AuthenticatedRoute exact path="/ap/*" component={AccessPoint} />
|
||||||
<AuthenticatedRoute exact path="/ntp/*" component={NetworkTime} />
|
<AuthenticatedRoute exact path="/ntp/*" component={NetworkTime} />
|
||||||
<AuthenticatedRoute exact path="/ota-configuration" component={OTAConfiguration} />
|
<AuthenticatedRoute exact path="/system/*" component={System} />
|
||||||
<AuthenticatedRoute exact path="/security/*" component={Security} />
|
<AuthenticatedRoute exact path="/security/*" component={Security} />
|
||||||
<Redirect to="/" />
|
<Redirect to="/" />
|
||||||
</Switch>
|
</Switch>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, withRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import { withStyles } from '@material-ui/core/styles';
|
import { withStyles } from '@material-ui/core/styles';
|
||||||
import Drawer from '@material-ui/core/Drawer';
|
import Drawer from '@material-ui/core/Drawer';
|
||||||
@ -13,23 +13,19 @@ import Divider from '@material-ui/core/Divider';
|
|||||||
import Grow from '@material-ui/core/Grow';
|
import Grow from '@material-ui/core/Grow';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
import MenuList from '@material-ui/core/MenuList';
|
import MenuList from '@material-ui/core/MenuList';
|
||||||
|
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
|
||||||
import Popper from '@material-ui/core/Popper';
|
import Popper from '@material-ui/core/Popper';
|
||||||
import MenuIcon from '@material-ui/icons/Menu';
|
import MenuIcon from '@material-ui/icons/Menu';
|
||||||
import WifiIcon from '@material-ui/icons/Wifi';
|
import WifiIcon from '@material-ui/icons/Wifi';
|
||||||
import SystemUpdateIcon from '@material-ui/icons/SystemUpdate';
|
import SettingsIcon from '@material-ui/icons/Settings';
|
||||||
import AccessTimeIcon from '@material-ui/icons/AccessTime';
|
import AccessTimeIcon from '@material-ui/icons/AccessTime';
|
||||||
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
||||||
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
|
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
|
||||||
import LockIcon from '@material-ui/icons/Lock';
|
import LockIcon from '@material-ui/icons/Lock';
|
||||||
|
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener';
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener';
|
||||||
|
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from '@material-ui/core/Paper';
|
||||||
|
|
||||||
import { APP_NAME } from '../constants/App';
|
import { APP_NAME } from '../constants/App';
|
||||||
@ -102,7 +98,7 @@ class MenuAppBar extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const { classes, theme, children, sectionTitle, authenticationContext } = this.props;
|
const { classes, theme, children, sectionTitle, authenticationContext } = this.props;
|
||||||
const { mobileOpen, authMenuOpen } = this.state;
|
const { mobileOpen, authMenuOpen } = this.state;
|
||||||
|
const path = this.props.match.url;
|
||||||
const drawer = (
|
const drawer = (
|
||||||
<div>
|
<div>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
@ -113,31 +109,31 @@ class MenuAppBar extends React.Component {
|
|||||||
</Toolbar>
|
</Toolbar>
|
||||||
<Divider />
|
<Divider />
|
||||||
<List>
|
<List>
|
||||||
<ListItem button component={Link} to='/wifi/'>
|
<ListItem button component={Link} to='/wifi/' selected={path.startsWith('/wifi/')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<WifiIcon />
|
<WifiIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="WiFi Connection" />
|
<ListItemText primary="WiFi Connection" />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem button component={Link} to='/ap/'>
|
<ListItem button component={Link} to='/ap/' selected={path.startsWith('/ap/')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<SettingsInputAntennaIcon />
|
<SettingsInputAntennaIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="Access Point" />
|
<ListItemText primary="Access Point" />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem button component={Link} to='/ntp/'>
|
<ListItem button component={Link} to='/ntp/' selected={path.startsWith('/ntp/')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<AccessTimeIcon />
|
<AccessTimeIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="Network Time" />
|
<ListItemText primary="Network Time" />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem button component={Link} to='/ota-configuration'>
|
<ListItem button component={Link} to='/system/' selected={path.startsWith('/system/')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<SystemUpdateIcon />
|
<SettingsIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary="OTA Updates" />
|
<ListItemText primary="System" />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem button component={Link} to='/security/'>
|
<ListItem button component={Link} to='/security/' selected={path.startsWith('/security/')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<LockIcon />
|
<LockIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
@ -241,4 +237,8 @@ MenuAppBar.propTypes = {
|
|||||||
sectionTitle: PropTypes.string.isRequired,
|
sectionTitle: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withAuthenticationContext(withStyles(styles, { withTheme: true })(MenuAppBar));
|
export default withAuthenticationContext(
|
||||||
|
withRouter(
|
||||||
|
withStyles(styles, { withTheme: true })(MenuAppBar)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
@ -79,7 +79,8 @@ class NTPStatus extends Component {
|
|||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<SwapVerticalCircleIcon />
|
<SwapVerticalCircleIcon />
|
||||||
</Avatar></ListItemAvatar>
|
</Avatar>
|
||||||
|
</ListItemAvatar>
|
||||||
<ListItemText primary="Last Sync" secondary={data.last_sync > 0 ? unixTimeToTimeAndDate(data.last_sync) : "never"} />
|
<ListItemText primary="Last Sync" secondary={data.last_sync > 0 ? unixTimeToTimeAndDate(data.last_sync) : "never"} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
@ -98,7 +99,8 @@ class NTPStatus extends Component {
|
|||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<TimerIcon />
|
<TimerIcon />
|
||||||
</Avatar></ListItemAvatar>
|
</Avatar>
|
||||||
|
</ListItemAvatar>
|
||||||
<ListItemText primary="Sync Interval" secondary={moment.duration(data.interval, 'seconds').humanize()} />
|
<ListItemText primary="Sync Interval" secondary={moment.duration(data.interval, 'seconds').humanize()} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
@ -106,7 +108,8 @@ class NTPStatus extends Component {
|
|||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<AvTimerIcon />
|
<AvTimerIcon />
|
||||||
</Avatar></ListItemAvatar>
|
</Avatar>
|
||||||
|
</ListItemAvatar>
|
||||||
<ListItemText primary="Uptime" secondary={moment.duration(data.uptime, 'seconds').humanize()} />
|
<ListItemText primary="Uptime" secondary={moment.duration(data.uptime, 'seconds').humanize()} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider variant="inset" component="li" />
|
<Divider variant="inset" component="li" />
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import React, { Component } from 'react';
|
|
||||||
import MenuAppBar from '../components/MenuAppBar';
|
|
||||||
import OTASettings from './OTASettings';
|
|
||||||
|
|
||||||
class OTAConfiguration extends Component {
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<MenuAppBar sectionTitle="OTA Configuration">
|
|
||||||
<OTASettings />
|
|
||||||
</MenuAppBar>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default OTAConfiguration
|
|
34
interface/src/sections/System.js
Normal file
34
interface/src/sections/System.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Redirect, Switch } from 'react-router-dom'
|
||||||
|
|
||||||
|
import Tabs from '@material-ui/core/Tabs';
|
||||||
|
import Tab from '@material-ui/core/Tab';
|
||||||
|
|
||||||
|
import AuthenticatedRoute from '../authentication/AuthenticatedRoute';
|
||||||
|
import MenuAppBar from '../components/MenuAppBar';
|
||||||
|
import OTASettings from '../containers/OTASettings';
|
||||||
|
|
||||||
|
class System extends Component {
|
||||||
|
|
||||||
|
handleTabChange = (event, path) => {
|
||||||
|
this.props.history.push(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<MenuAppBar sectionTitle="System">
|
||||||
|
<Tabs value={this.props.match.url} onChange={this.handleTabChange} indicatorColor="primary" textColor="primary" variant="fullWidth">
|
||||||
|
<Tab value="/system/status" label="System Status" />
|
||||||
|
<Tab value="/system/ota" label="OTA Updates" />
|
||||||
|
</Tabs>
|
||||||
|
<Switch>
|
||||||
|
<AuthenticatedRoute exact={true} path="/system/status" component={OTASettings} />
|
||||||
|
<AuthenticatedRoute exact={true} path="/system/ota" component={OTASettings} />
|
||||||
|
<Redirect to="/system/status" />
|
||||||
|
</Switch>
|
||||||
|
</MenuAppBar>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default System
|
Loading…
Reference in New Issue
Block a user