aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-02-20 14:33:36 -0800
committerAnton Tananaev <anton@traccar.org>2023-02-20 14:33:36 -0800
commitef5058c6960157652ea660423625fd6841fb5a3a (patch)
tree06ca4ec6d43ecfe380f5fea3e316d79dd7de38de /modern/src
parente043691a1f4e61509b9192ad9d169ea65f6933ea (diff)
downloadtrackermap-web-ef5058c6960157652ea660423625fd6841fb5a3a.tar.gz
trackermap-web-ef5058c6960157652ea660423625fd6841fb5a3a.tar.bz2
trackermap-web-ef5058c6960157652ea660423625fd6841fb5a3a.zip
Implement command notificator
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/resources/l10n/en.json1
-rw-r--r--modern/src/settings/NotificationPage.js11
2 files changed, 11 insertions, 1 deletions
diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json
index 308d92d8..2400ecf9 100644
--- a/modern/src/resources/l10n/en.json
+++ b/modern/src/resources/l10n/en.json
@@ -485,6 +485,7 @@
"notificationType": "Type of Notification",
"notificationAlways": "All Devices",
"notificationNotificators": "Channels",
+ "notificatorCommand": "Command",
"notificatorWeb": "Web",
"notificatorMail": "Mail",
"notificatorSms": "SMS",
diff --git a/modern/src/settings/NotificationPage.js b/modern/src/settings/NotificationPage.js
index a5a9d8d2..fdefedaf 100644
--- a/modern/src/settings/NotificationPage.js
+++ b/modern/src/settings/NotificationPage.js
@@ -52,7 +52,7 @@ const NotificationPage = () => {
}));
});
- const validate = () => item && item.type && item.notificators;
+ const validate = () => item && item.type && item.notificators && (!item.notificators?.includes('command') || item.commandId);
return (
<EditItemView
@@ -100,6 +100,15 @@ const NotificationPage = () => {
titleGetter={(it) => t(prefixString('notificator', it.type))}
label={t('notificationNotificators')}
/>
+ {item.notificators?.includes('command') && (
+ <SelectField
+ value={item.commandId || 0}
+ onChange={(event) => setItem({ ...item, commandId: Number(event.target.value) })}
+ endpoint="/api/commands"
+ titleGetter={(it) => it.description}
+ label={t('sharedSavedCommand')}
+ />
+ )}
<Button
variant="outlined"
color="primary"