diff options
author | Anton Tananaev <anton@traccar.org> | 2022-11-04 08:55:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-11-04 08:55:52 -0700 |
commit | 5a8f6cd8351109689517d0a8cb218e3a02293aaf (patch) | |
tree | b1d5775f833651c4f3175589821fb3c61339d4ab /modern/src | |
parent | 5cdecaad490a4455b3d0693770857426c5a00a2c (diff) | |
download | trackermap-web-5a8f6cd8351109689517d0a8cb218e3a02293aaf.tar.gz trackermap-web-5a8f6cd8351109689517d0a8cb218e3a02293aaf.tar.bz2 trackermap-web-5a8f6cd8351109689517d0a8cb218e3a02293aaf.zip |
Limit command types
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/settings/CommandSendPage.js | 2 | ||||
-rw-r--r-- | modern/src/settings/components/BaseCommandView.js | 4 | ||||
-rw-r--r-- | modern/src/settings/components/SettingsMenu.js | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/settings/CommandSendPage.js b/modern/src/settings/CommandSendPage.js index d853f995..4afc6992 100644 --- a/modern/src/settings/CommandSendPage.js +++ b/modern/src/settings/CommandSendPage.js @@ -101,7 +101,7 @@ const CommandSendPage = () => { label={t('sharedSavedCommand')} /> {!limitCommands && !savedId && ( - <BaseCommandView item={item} setItem={setItem} /> + <BaseCommandView deviceId={deviceId} item={item} setItem={setItem} /> )} </AccordionDetails> </Accordion> diff --git a/modern/src/settings/components/BaseCommandView.js b/modern/src/settings/components/BaseCommandView.js index ca81a854..1ba6a37c 100644 --- a/modern/src/settings/components/BaseCommandView.js +++ b/modern/src/settings/components/BaseCommandView.js @@ -7,7 +7,7 @@ import SelectField from '../../common/components/SelectField'; import { prefixString } from '../../common/util/stringUtils'; import useCommandAttributes from '../../common/attributes/useCommandAttributes'; -const BaseCommandView = ({ item, setItem }) => { +const BaseCommandView = ({ deviceId, item, setItem }) => { const t = useTranslation(); const availableAttributes = useCommandAttributes(t); @@ -27,7 +27,7 @@ const BaseCommandView = ({ item, setItem }) => { <SelectField value={item.type || ''} onChange={(e) => setItem({ ...item, type: e.target.value, attributes: {} })} - endpoint="/api/commands/types" + endpoint={deviceId ? `/api/commands/types?${new URLSearchParams({ deviceId }).toString()}` : '/api/commands/types'} keyGetter={(it) => it.type} titleGetter={(it) => t(prefixString('command', it.type))} label={t('sharedType')} diff --git a/modern/src/settings/components/SettingsMenu.js b/modern/src/settings/components/SettingsMenu.js index c6aac4b5..c732fc9f 100644 --- a/modern/src/settings/components/SettingsMenu.js +++ b/modern/src/settings/components/SettingsMenu.js @@ -123,7 +123,7 @@ const SettingsMenu = () => { title={t('sharedSavedCommands')} link="/settings/commands" icon={<PublishIcon />} - selected={location.pathname.startsWith('/settings/command')} + selected={location.pathname.startsWith('/settings/command') && !location.pathname.startsWith('/settings/command-send')} /> </> )} |