mirror of
https://github.com/traccar/traccar-web.git
synced 2025-01-09 04:37:33 +08:00
Option to disable saved commands
This commit is contained in:
parent
7016950dac
commit
f0614dc939
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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')}
|
||||
|
Loading…
Reference in New Issue
Block a user