import React, { useState } from 'react'; import TextField from '@material-ui/core/TextField'; import t from '../common/localization'; import EditItemView from '../EditItemView'; import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, Select } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import EditAttributesView from '../attributes/EditAttributesView'; import { useEffectAsync } from '../reactHelper'; import deviceAttributes from '../attributes/deviceAttributes'; const useStyles = makeStyles(() => ({ details: { flexDirection: 'column', }, })); const GroupPage = () => { const classes = useStyles(); const [item, setItem] = useState(); const [groups, setGroups] = useState(); useEffectAsync(async () => { const response = await fetch('/api/groups'); if (response.ok) { setGroups(await response.json()); } }, []); return ( {item && <> }> {t('sharedRequired')} setItem({...item, name: event.target.value})} label={t('sharedName')} variant="filled" /> }> {t('sharedExtra')} {groups && {t('groupParent')} } }> {t('sharedAttributes')} setItem({...item, attributes})} definitions={deviceAttributes} /> } ); } export default GroupPage;