import { Box, Grid, IconButton, Paper, Typography } from '@material-ui/core';
import { blueGrey } from '@material-ui/core/colors';
import { Power, PowerOff, Refresh } from '@material-ui/icons/';
import { withStyles } from '@material-ui/styles';
import React from 'react';
import DeviceService from '../../common/DeviceService';
import DevicesContext from '../../contexts/DevicesContext';
import DeviceComponent from './DeviceComponent';
const styles = theme => ({
root: {
padding: '64px',
backgroundColor: theme.palette.primary.dark,
},
paper: {
backgroundColor: blueGrey[50],
height: '60px',
},
typo: {
fontSize: theme.typography.pxToRem(20),
fontWeight: theme.typography.fontWeightRegular,
},
});
class Devices extends React.Component {
constructor(props) {
super(props);
}
static contextType = DevicesContext;
componentDidMount() {
}
renderButtons() {
var service = new DeviceService();
const renderOnOff = () => {
return (
service.onlineall()}>
service.offlineall()}>
);
}
return (
{this.props.isAdmin ? renderOnOff() : null}
this.context.updateAllDevices()}>
);
}
render() {
const { classes } = this.props;
const Devices = this.context.devices.map((device, index) => (
));
return (
All Devices
{this.renderButtons()}
{Devices}
);
}
}
export default withStyles(styles)(Devices);