From 967f56e3c91bd04b2a2b2280769826a2e23ad26c Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 28 Jul 2022 00:11:47 +0800 Subject: [PATCH] feat(gui-v2): dynamic validators --- .../nc-gui-v2/components/webhook/Editor.vue | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/packages/nc-gui-v2/components/webhook/Editor.vue b/packages/nc-gui-v2/components/webhook/Editor.vue index 623385bff8..1cc1e38bbe 100644 --- a/packages/nc-gui-v2/components/webhook/Editor.vue +++ b/packages/nc-gui-v2/components/webhook/Editor.vue @@ -217,38 +217,17 @@ const validators = computed(() => { 'notification.payload.subject': [fieldRequiredValidator], 'notification.payload.body': [fieldRequiredValidator], }), - ...(hook.notification.type === 'Slack' && { + ...((hook.notification.type === 'Slack' || + hook.notification.type === 'Microsoft Teams' || + hook.notification.type === 'Discord' || + hook.notification.type === 'Mattermost') && { 'notification.payload.channels': [fieldRequiredValidator], 'notification.payload.body': [fieldRequiredValidator], }), - ...(hook.notification.type === 'Slack' && - { - // TODO: - }), - ...(hook.notification.type === 'Microsoft Teams' && - { - // TODO: - }), - ...(hook.notification.type === 'Discord' && - { - // TODO: - }), - ...(hook.notification.type === 'Mattermost' && - { - // TODO: - }), - ...(hook.notification.type === 'URL' && - { - // TODO: - }), - ...(hook.notification.type === 'Twilio' && - { - // TODO: - }), - ...(hook.notification.type === 'Whatsapp Twilio' && - { - // TODO: - }), + ...((hook.notification.type === 'Twilio' || hook.notification.type === 'Whatsapp Twilio') && { + 'notification.payload.body': [fieldRequiredValidator], + 'notification.payload.to': [fieldRequiredValidator], + }), } }) const { resetFields, validate, validateInfos } = useForm(hook, validators)