|
|
@ -241,6 +241,9 @@ const { validate, validateInfos } = useForm(hook, validators) |
|
|
|
function onNotTypeChange(reset = false) { |
|
|
|
function onNotTypeChange(reset = false) { |
|
|
|
if (reset) { |
|
|
|
if (reset) { |
|
|
|
hook.notification.payload = {} as Record<string, any> |
|
|
|
hook.notification.payload = {} as Record<string, any> |
|
|
|
|
|
|
|
if (['Slack', 'Microsoft Teams', 'Discord', 'Mattermost'].includes(hook.notification.type)) { |
|
|
|
|
|
|
|
hook.notification.payload.channels = [] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (hook.notification.type === 'Slack') { |
|
|
|
if (hook.notification.type === 'Slack') { |
|
|
@ -287,7 +290,7 @@ function setHook(newHook: HookType) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function onEventChange() { |
|
|
|
function onEventChange() { |
|
|
|
const { notification: { payload = {}, type = {} } = {} } = hook |
|
|
|
const { notification: { payload = {}, type = {} } = {} } = hook |
|
|
|
|
|
|
|
|
|
|
|
Object.assign(hook, { |
|
|
|
Object.assign(hook, { |
|
|
@ -300,20 +303,20 @@ async function onEventChange() { |
|
|
|
|
|
|
|
|
|
|
|
hook.notification.payload = payload |
|
|
|
hook.notification.payload = payload |
|
|
|
|
|
|
|
|
|
|
|
let channels: Ref<Record<string, any>[] | null> = ref(null) |
|
|
|
const channels: Ref<Record<string, any>[] | null> = ref(null) |
|
|
|
|
|
|
|
|
|
|
|
switch (hook.notification.type) { |
|
|
|
switch (hook.notification.type) { |
|
|
|
case 'Slack': |
|
|
|
case 'Slack': |
|
|
|
channels = slackChannels |
|
|
|
channels.value = slackChannels.value |
|
|
|
break |
|
|
|
break |
|
|
|
case 'Microsoft Teams': |
|
|
|
case 'Microsoft Teams': |
|
|
|
channels = teamsChannels |
|
|
|
channels.value = teamsChannels.value |
|
|
|
break |
|
|
|
break |
|
|
|
case 'Discord': |
|
|
|
case 'Discord': |
|
|
|
channels = discordChannels |
|
|
|
channels.value = discordChannels.value |
|
|
|
break |
|
|
|
break |
|
|
|
case 'Mattermost': |
|
|
|
case 'Mattermost': |
|
|
|
channels = mattermostChannels |
|
|
|
channels.value = mattermostChannels.value |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|