|
|
|
@ -18,9 +18,10 @@ import {
|
|
|
|
|
useNuxtApp, |
|
|
|
|
watch, |
|
|
|
|
} from '#imports' |
|
|
|
|
import { HookType } from 'nocodb-sdk' |
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
hook?: Record<string, any> |
|
|
|
|
hook?: HookType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const props = defineProps<Props>() |
|
|
|
@ -39,11 +40,13 @@ const meta = inject(MetaInj, ref())
|
|
|
|
|
|
|
|
|
|
const useForm = Form.useForm |
|
|
|
|
|
|
|
|
|
const hook = reactive<Record<string, any>>({ |
|
|
|
|
const hook = reactive< |
|
|
|
|
Omit<HookType, 'notification'> & { notification: Record<string, any>; eventOperation: string; condition: boolean } |
|
|
|
|
>({ |
|
|
|
|
id: '', |
|
|
|
|
title: '', |
|
|
|
|
event: '', |
|
|
|
|
operation: '', |
|
|
|
|
event: undefined, |
|
|
|
|
operation: undefined, |
|
|
|
|
eventOperation: '', |
|
|
|
|
notification: { |
|
|
|
|
type: 'URL', |
|
|
|
@ -256,12 +259,13 @@ function onNotTypeChange(reset = false) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setHook(newHook: any) { |
|
|
|
|
function setHook(newHook: HookType) { |
|
|
|
|
const notification = newHook.notification as Record<string, any> |
|
|
|
|
Object.assign(hook, { |
|
|
|
|
...newHook, |
|
|
|
|
notification: { |
|
|
|
|
...newHook.notification, |
|
|
|
|
payload: newHook.notification.payload, |
|
|
|
|
...notification, |
|
|
|
|
payload: notification.payload, |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -400,8 +404,8 @@ watch(
|
|
|
|
|
if (!hook.eventOperation) return |
|
|
|
|
|
|
|
|
|
const [event, operation] = hook.eventOperation.split(' ') |
|
|
|
|
hook.event = event |
|
|
|
|
hook.operation = operation |
|
|
|
|
hook.event = event as HookType['event'] |
|
|
|
|
hook.operation = operation as HookType['operation'] |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|