diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-03 16:22:21 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-03 16:22:21 -0700 |
commit | b418d001a498b5a5108bb13983b4f3aba6c60dbc (patch) | |
tree | 464dd5e4fc3f13a6209c05df4d3db3cbbe8e85d6 /modern/src/settings/GroupPage.js | |
parent | 5d17af8102f17d41610acb9ff34aabbff871cda1 (diff) | |
download | trackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.tar.gz trackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.tar.bz2 trackermap-web-b418d001a498b5a5108bb13983b4f3aba6c60dbc.zip |
Support feature disabling
Diffstat (limited to 'modern/src/settings/GroupPage.js')
-rw-r--r-- | modern/src/settings/GroupPage.js | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/modern/src/settings/GroupPage.js b/modern/src/settings/GroupPage.js index b817ba7e..c4c0fa5c 100644 --- a/modern/src/settings/GroupPage.js +++ b/modern/src/settings/GroupPage.js @@ -15,6 +15,7 @@ import SettingsMenu from './components/SettingsMenu'; import useCommonDeviceAttributes from '../common/attributes/useCommonDeviceAttributes'; import useGroupAttributes from '../common/attributes/useGroupAttributes'; import { prefixString } from '../common/util/stringUtils'; +import useFeatures from '../common/util/useFeatures'; const useStyles = makeStyles((theme) => ({ details: { @@ -32,6 +33,8 @@ const GroupPage = () => { const commonDeviceAttributes = useCommonDeviceAttributes(t); const groupAttributes = useGroupAttributes(t); + const features = useFeatures(); + const [item, setItem] = useState(); const validate = () => item && item.name; @@ -115,23 +118,27 @@ const GroupPage = () => { titleGetter={(it) => t(prefixString('event', it.type))} label={t('sharedNotifications')} /> - <LinkField - endpointAll="/api/drivers" - endpointLinked={`/api/drivers?groupId=${item.id}`} - baseId={item.id} - keyBase="groupId" - keyLink="driverId" - label={t('sharedDrivers')} - /> - <LinkField - endpointAll="/api/attributes/computed" - endpointLinked={`/api/attributes/computed?groupId=${item.id}`} - baseId={item.id} - keyBase="groupId" - keyLink="attributeId" - titleGetter={(it) => it.description} - label={t('sharedComputedAttributes')} - /> + {!features.disableDrivers && ( + <LinkField + endpointAll="/api/drivers" + endpointLinked={`/api/drivers?groupId=${item.id}`} + baseId={item.id} + keyBase="groupId" + keyLink="driverId" + label={t('sharedDrivers')} + /> + )} + {!features.disableComputedAttributes && ( + <LinkField + endpointAll="/api/attributes/computed" + endpointLinked={`/api/attributes/computed?groupId=${item.id}`} + baseId={item.id} + keyBase="groupId" + keyLink="attributeId" + titleGetter={(it) => it.description} + label={t('sharedComputedAttributes')} + /> + )} <LinkField endpointAll="/api/commands" endpointLinked={`/api/commands?groupId=${item.id}`} @@ -141,14 +148,16 @@ const GroupPage = () => { titleGetter={(it) => it.description} label={t('sharedSavedCommands')} /> - <LinkField - endpointAll="/api/maintenance" - endpointLinked={`/api/maintenance?groupId=${item.id}`} - baseId={item.id} - keyBase="groupId" - keyLink="maintenanceId" - label={t('sharedMaintenance')} - /> + {!features.disableMaintenance && ( + <LinkField + endpointAll="/api/maintenance" + endpointLinked={`/api/maintenance?groupId=${item.id}`} + baseId={item.id} + keyBase="groupId" + keyLink="maintenanceId" + label={t('sharedMaintenance')} + /> + )} </AccordionDetails> </Accordion> )} |