aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/common/attributes/useCommonUserAttributes.js4
-rw-r--r--modern/src/common/util/useFeatures.js2
-rw-r--r--modern/src/resources/l10n/en.json1
-rw-r--r--modern/src/settings/DeviceConnectionsPage.jsx20
-rw-r--r--modern/src/settings/GroupConnectionsPage.jsx20
-rw-r--r--modern/src/settings/components/SettingsMenu.jsx14
6 files changed, 37 insertions, 24 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js
index 1f811e56..294ddea8 100644
--- a/modern/src/common/attributes/useCommonUserAttributes.js
+++ b/modern/src/common/attributes/useCommonUserAttributes.js
@@ -81,6 +81,10 @@ export default (t) => useMemo(() => ({
name: t('attributeNotificationTokens'),
type: 'string',
},
+ 'ui.disableSavedCommands': {
+ name: t('attributeUiDisableSavedCommands'),
+ type: 'boolean',
+ },
'ui.disableGroups': {
name: t('attributeUiDisableGroups'),
type: 'boolean',
diff --git a/modern/src/common/util/useFeatures.js b/modern/src/common/util/useFeatures.js
index cafb2c7c..30361589 100644
--- a/modern/src/common/util/useFeatures.js
+++ b/modern/src/common/util/useFeatures.js
@@ -18,6 +18,7 @@ const featureSelector = createSelector(
(state) => state.session.server,
(state) => state.session.user,
(server, user) => {
+ const disableSavedCommands = get(server, user, 'ui.disableSavedCommands');
const disableAttributes = get(server, user, 'ui.disableAttributes');
const disableVehicleFeatures = get(server, user, 'ui.disableVehicleFeatures');
const disableDrivers = disableVehicleFeatures || get(server, user, 'ui.disableDrivers');
@@ -28,6 +29,7 @@ const featureSelector = createSelector(
const disableCalendars = get(server, user, 'ui.disableCalendars');
return {
+ disableSavedCommands,
disableAttributes,
disableDrivers,
disableMaintenance,
diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json
index 39fb219b..a9303f63 100644
--- a/modern/src/resources/l10n/en.json
+++ b/modern/src/resources/l10n/en.json
@@ -147,6 +147,7 @@
"attributeMailSmtpAuth": "Mail: SMTP Auth Enable",
"attributeMailSmtpUsername": "Mail: SMTP Username",
"attributeMailSmtpPassword": "Mail: SMTP Password",
+ "attributeUiDisableSavedCommands": "UI: Disable Saved Commands",
"attributeUiDisableAttributes": "UI: Disable Attributes",
"attributeUiDisableGroups": "UI: Disable Groups",
"attributeUiDisableEvents": "UI: Disable Events",
diff --git a/modern/src/settings/DeviceConnectionsPage.jsx b/modern/src/settings/DeviceConnectionsPage.jsx
index 10d0c3f6..c711d719 100644
--- a/modern/src/settings/DeviceConnectionsPage.jsx
+++ b/modern/src/settings/DeviceConnectionsPage.jsx
@@ -76,15 +76,17 @@ const DeviceConnectionsPage = () => {
label={t('sharedComputedAttributes')}
/>
)}
- <LinkField
- endpointAll="/api/commands"
- endpointLinked={`/api/commands?deviceId=${id}`}
- baseId={id}
- keyBase="deviceId"
- keyLink="commandId"
- titleGetter={(it) => it.description}
- label={t('sharedSavedCommands')}
- />
+ {!features.disableSavedCommands && (
+ <LinkField
+ endpointAll="/api/commands"
+ endpointLinked={`/api/commands?deviceId=${id}`}
+ baseId={id}
+ keyBase="deviceId"
+ keyLink="commandId"
+ titleGetter={(it) => it.description}
+ label={t('sharedSavedCommands')}
+ />
+ )}
{!features.disableMaintenance && (
<LinkField
endpointAll="/api/maintenance"
diff --git a/modern/src/settings/GroupConnectionsPage.jsx b/modern/src/settings/GroupConnectionsPage.jsx
index cd4e743b..980bd9da 100644
--- a/modern/src/settings/GroupConnectionsPage.jsx
+++ b/modern/src/settings/GroupConnectionsPage.jsx
@@ -76,15 +76,17 @@ const GroupConnectionsPage = () => {
label={t('sharedComputedAttributes')}
/>
)}
- <LinkField
- endpointAll="/api/commands"
- endpointLinked={`/api/commands?groupId=${id}`}
- baseId={id}
- keyBase="groupId"
- keyLink="commandId"
- titleGetter={(it) => it.description}
- label={t('sharedSavedCommands')}
- />
+ {!features.disableSavedCommands && (
+ <LinkField
+ endpointAll="/api/commands"
+ endpointLinked={`/api/commands?groupId=${id}`}
+ baseId={id}
+ keyBase="groupId"
+ keyLink="commandId"
+ titleGetter={(it) => it.description}
+ label={t('sharedSavedCommands')}
+ />
+ )}
{!features.disableMaintenance && (
<LinkField
endpointAll="/api/maintenance"
diff --git a/modern/src/settings/components/SettingsMenu.jsx b/modern/src/settings/components/SettingsMenu.jsx
index 6d8c0fd7..7085d47a 100644
--- a/modern/src/settings/components/SettingsMenu.jsx
+++ b/modern/src/settings/components/SettingsMenu.jsx
@@ -119,12 +119,14 @@ const SettingsMenu = () => {
selected={location.pathname.startsWith('/settings/maintenance')}
/>
)}
- <MenuItem
- title={t('sharedSavedCommands')}
- link="/settings/commands"
- icon={<PublishIcon />}
- selected={location.pathname.startsWith('/settings/command')}
- />
+ {!features.disableSavedCommands && (
+ <MenuItem
+ title={t('sharedSavedCommands')}
+ link="/settings/commands"
+ icon={<PublishIcon />}
+ selected={location.pathname.startsWith('/settings/command')}
+ />
+ )}
{supportLink && (
<MenuItem
title={t('settingsSupport')}