diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-06 14:15:23 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-06 14:15:23 -0700 |
commit | 3812292cc4413efff1358eb34cc5bccab9d1cbae (patch) | |
tree | 8aa26184ec58a7f231869d427a28f8e999fa2093 /modern/src/DevicePage.js | |
parent | 1b513d2cbf4dde335f9a2822beaaeeb171816c8d (diff) | |
download | trackermap-web-3812292cc4413efff1358eb34cc5bccab9d1cbae.tar.gz trackermap-web-3812292cc4413efff1358eb34cc5bccab9d1cbae.tar.bz2 trackermap-web-3812292cc4413efff1358eb34cc5bccab9d1cbae.zip |
Handle unit attributes
Diffstat (limited to 'modern/src/DevicePage.js')
-rw-r--r-- | modern/src/DevicePage.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/modern/src/DevicePage.js b/modern/src/DevicePage.js index e4b853e7..560bbd20 100644 --- a/modern/src/DevicePage.js +++ b/modern/src/DevicePage.js @@ -13,6 +13,7 @@ import LinkField from './form/LinkField'; import { prefixString } from './common/stringUtils'; import { useTranslation } from './LocalizationProvider'; import useDeviceAttributes from './attributes/useDeviceAttributes'; +import { useAdministrator } from './common/permissions'; const useStyles = makeStyles(() => ({ details: { @@ -24,6 +25,8 @@ const DevicePage = () => { const classes = useStyles(); const t = useTranslation(); + const admin = useAdministrator(); + const deviceAttributes = useDeviceAttributes(t); const [item, setItem] = useState(); @@ -105,10 +108,12 @@ const DevicePage = () => { label={t('deviceCategory')} variant="filled" /> - <FormControlLabel - control={<Checkbox checked={item.disabled} onChange={(event) => setItem({ ...item, disabled: event.target.checked })} />} - label={t('sharedDisabled')} - /> + {admin && ( + <FormControlLabel + control={<Checkbox checked={item.disabled} onChange={(event) => setItem({ ...item, disabled: event.target.checked })} />} + label={t('sharedDisabled')} + /> + )} </AccordionDetails> </Accordion> <Accordion> |