From ef5058c6960157652ea660423625fd6841fb5a3a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 20 Feb 2023 14:33:36 -0800 Subject: Implement command notificator --- modern/src/resources/l10n/en.json | 1 + modern/src/settings/NotificationPage.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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 ( { titleGetter={(it) => t(prefixString('notificator', it.type))} label={t('notificationNotificators')} /> + {item.notificators?.includes('command') && ( + setItem({ ...item, commandId: Number(event.target.value) })} + endpoint="/api/commands" + titleGetter={(it) => it.description} + label={t('sharedSavedCommand')} + /> + )}