import React, { Component, Fragment } from 'react'; import { withStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemText from '@material-ui/core/ListItemText'; import ListItemAvatar from '@material-ui/core/ListItemAvatar'; import Avatar from '@material-ui/core/Avatar'; import Divider from '@material-ui/core/Divider'; import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna'; import DeviceHubIcon from '@material-ui/icons/DeviceHub'; import ComputerIcon from '@material-ui/icons/Computer'; import { restComponent } from '../components/RestComponent'; import LoadingNotification from '../components/LoadingNotification'; import SectionContent from '../components/SectionContent' import * as Highlight from '../constants/Highlight'; import { AP_STATUS_ENDPOINT } from '../constants/Endpoints'; const styles = theme => ({ ["apStatus_" + Highlight.SUCCESS]: { backgroundColor: theme.palette.highlight_success }, ["apStatus_" + Highlight.IDLE]: { backgroundColor: theme.palette.highlight_idle }, button: { marginRight: theme.spacing(2), marginTop: theme.spacing(2), } }); class APStatus extends Component { componentDidMount() { this.props.loadData(); } apStatusHighlight(data) { return data.active ? Highlight.SUCCESS : Highlight.IDLE; } apStatus(data) { return data.active ? "Active" : "Inactive"; } createListItems(data, classes) { return ( IP ); } renderAPStatus(data, classes) { return (
{this.createListItems(data, classes)}
); } render() { const { fetched, errorMessage, data, loadData, classes } = this.props; return ( this.renderAPStatus(data, classes) } /> ) } } export default restComponent(AP_STATUS_ENDPOINT, withStyles(styles)(APStatus));