2020-02-09 10:21:13 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Redirect, Switch, RouteComponentProps } from 'react-router-dom'
|
|
|
|
|
|
|
|
import { Tabs, Tab } from '@material-ui/core';
|
|
|
|
|
|
|
|
import { withAuthenticatedContext, AuthenticatedContextProps, AuthenticatedRoute } from '../authentication';
|
|
|
|
import { MenuAppBar } from '../components';
|
|
|
|
|
|
|
|
import SystemStatusController from './SystemStatusController';
|
|
|
|
import OTASettingsController from './OTASettingsController';
|
|
|
|
|
|
|
|
type SystemProps = AuthenticatedContextProps & RouteComponentProps;
|
|
|
|
|
|
|
|
class System extends Component<SystemProps> {
|
|
|
|
|
|
|
|
handleTabChange = (event: React.ChangeEvent<{}>, path: string) => {
|
|
|
|
this.props.history.push(path);
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { authenticatedContext } = this.props;
|
|
|
|
return (
|
|
|
|
<MenuAppBar sectionTitle="System">
|
|
|
|
<Tabs value={this.props.match.url} onChange={this.handleTabChange} variant="fullWidth">
|
|
|
|
<Tab value="/system/status" label="System Status" />
|
|
|
|
<Tab value="/system/ota" label="OTA Settings" disabled={!authenticatedContext.me.admin} />
|
|
|
|
</Tabs>
|
|
|
|
<Switch>
|
2020-02-19 00:04:57 +00:00
|
|
|
<AuthenticatedRoute exact path="/system/status" component={SystemStatusController} />
|
|
|
|
<AuthenticatedRoute exact path="/system/ota" component={OTASettingsController} />
|
2020-02-09 10:21:13 +00:00
|
|
|
<Redirect to="/system/status" />
|
|
|
|
</Switch>
|
|
|
|
</MenuAppBar>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withAuthenticatedContext(System);
|