import React, { Component, Fragment } from 'react'; import { withStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import LinearProgress from '@material-ui/core/LinearProgress'; import Typography from '@material-ui/core/Typography'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemAvatar from '@material-ui/core/ListItemAvatar'; import ListItemText from '@material-ui/core/ListItemText'; import Avatar from '@material-ui/core/Avatar'; import Divider from '@material-ui/core/Divider'; import DevicesIcon from '@material-ui/icons/Devices'; import MemoryIcon from '@material-ui/icons/Memory'; import ShowChartIcon from '@material-ui/icons/ShowChart'; import SdStorageIcon from '@material-ui/icons/SdStorage'; import DataUsageIcon from '@material-ui/icons/DataUsage'; import { SYSTEM_STATUS_ENDPOINT } from '../constants/Endpoints'; import { restComponent } from '../components/RestComponent'; import SectionContent from '../components/SectionContent'; const styles = theme => ({ fetching: { margin: theme.spacing(4), textAlign: "center" }, button: { marginRight: theme.spacing(2), marginTop: theme.spacing(2), } }); class SystemStatus extends Component { componentDidMount() { this.props.loadData(); } createListItems(data, classes) { return ( ); } renderNTPStatus(data, classes) { return (
{this.createListItems(data, classes)}
); } render() { const { data, fetched, errorMessage, classes } = this.props; return ( { !fetched ?
Loading...
: data ? this.renderNTPStatus(data, classes) :
{errorMessage}
}
) } } export default restComponent(SYSTEM_STATUS_ENDPOINT, withStyles(styles)(SystemStatus));