diff options
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> )} |