import React, { Component, Fragment } from 'react'; import { withStyles } from 'material-ui/styles'; import Button from 'material-ui/Button'; import { LinearProgress } from 'material-ui/Progress'; import Typography from 'material-ui/Typography'; import List, { ListItem, ListItemText } from 'material-ui/List'; import Avatar from 'material-ui/Avatar'; import Divider from 'material-ui/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 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 }, fetching: { margin: theme.spacing.unit * 4, textAlign: "center" }, button: { marginRight: theme.spacing.unit * 2, marginTop: theme.spacing.unit * 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, fullDetails, classes){ return ( IP ); } renderAPStatus(data, fullDetails, classes){ return (
{this.createListItems(data, fullDetails, classes)}
); } render() { const { data, fetched, errorMessage, classes, fullDetails } = this.props; return ( { !fetched ?
Loading...
: data ? this.renderAPStatus(data, fullDetails, classes) :
{errorMessage}
}
) } } export default restComponent(AP_STATUS_ENDPOINT, withStyles(styles)(APStatus));