Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

  1. import React, { Component } from 'react';
  2. import { Redirect, Switch, RouteComponentProps } from 'react-router-dom'
  3. import { Tabs, Tab } from '@material-ui/core';
  4. import { AuthenticatedContextProps, AuthenticatedRoute } from '../authentication';
  5. import { MenuAppBar } from '../components';
  6. import ManageUsersController from './ManageUsersController';
  7. import SecuritySettingsController from './SecuritySettingsController';
  8. type SecurityProps = AuthenticatedContextProps & RouteComponentProps;
  9. class Security extends Component<SecurityProps> {
  10. handleTabChange = (event: React.ChangeEvent<{}>, path: string) => {
  11. this.props.history.push(path);
  12. };
  13. render() {
  14. return (
  15. <MenuAppBar sectionTitle="Security">
  16. <Tabs value={this.props.match.url} onChange={this.handleTabChange} variant="fullWidth">
  17. <Tab value="/security/users" label="Manage Users" />
  18. <Tab value="/security/settings" label="Security Settings" />
  19. </Tabs>
  20. <Switch>
  21. <AuthenticatedRoute exact path="/security/users" component={ManageUsersController} />
  22. <AuthenticatedRoute exact path="/security/settings" component={SecuritySettingsController} />
  23. <Redirect to="/security/users" />
  24. </Switch>
  25. </MenuAppBar>
  26. )
  27. }
  28. }
  29. export default Security;