From 23466068f868b631aca5e1b9c4ecf5c846541fd2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 30 Sep 2020 22:04:28 -0700 Subject: Implement groups management --- modern/src/settings/GroupPage.js | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 modern/src/settings/GroupPage.js (limited to 'modern/src/settings/GroupPage.js') diff --git a/modern/src/settings/GroupPage.js b/modern/src/settings/GroupPage.js new file mode 100644 index 00000000..0dc61e50 --- /dev/null +++ b/modern/src/settings/GroupPage.js @@ -0,0 +1,93 @@ +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; -- cgit v1.2.3