|
|
@ -158,19 +158,6 @@ const formInput = ref({ |
|
|
|
], |
|
|
|
], |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: this s paylaod for URL only |
|
|
|
|
|
|
|
// const notification = ref({ |
|
|
|
|
|
|
|
// method: 'GET', |
|
|
|
|
|
|
|
// path: '', |
|
|
|
|
|
|
|
// body: '', |
|
|
|
|
|
|
|
// params: [], |
|
|
|
|
|
|
|
// auth: '', |
|
|
|
|
|
|
|
// headers: [], |
|
|
|
|
|
|
|
// response: {}, |
|
|
|
|
|
|
|
// perf: {}, |
|
|
|
|
|
|
|
// meta: {}, |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const eventList = ref([ |
|
|
|
const eventList = ref([ |
|
|
|
// {text: ["Before", "Insert"], value: ['before', 'insert']}, |
|
|
|
// {text: ["Before", "Insert"], value: ['before', 'insert']}, |
|
|
|
{ text: ['After', 'Insert'], value: ['after', 'insert'] }, |
|
|
|
{ text: ['After', 'Insert'], value: ['after', 'insert'] }, |
|
|
@ -266,7 +253,13 @@ function filterOption(input: string, option: Option) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setHook(newHook: any) { |
|
|
|
function setHook(newHook: any) { |
|
|
|
Object.assign(hook, { ...newHook, api: { ...newHook.notification.payload } }) |
|
|
|
Object.assign(hook, { |
|
|
|
|
|
|
|
...newHook, |
|
|
|
|
|
|
|
notification: { |
|
|
|
|
|
|
|
...newHook.notification, |
|
|
|
|
|
|
|
payload: newHook.notification.payload, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function onEventChange() { |
|
|
|
async function onEventChange() { |
|
|
@ -276,6 +269,7 @@ async function onEventChange() { |
|
|
|
...hook, |
|
|
|
...hook, |
|
|
|
notification: { |
|
|
|
notification: { |
|
|
|
type, |
|
|
|
type, |
|
|
|
|
|
|
|
payload, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -323,6 +317,7 @@ async function loadPluginList() { |
|
|
|
o[p.title] = p |
|
|
|
o[p.title] = p |
|
|
|
return o |
|
|
|
return o |
|
|
|
}, {}) |
|
|
|
}, {}) |
|
|
|
|
|
|
|
|
|
|
|
if (hook.event && hook.operation) { |
|
|
|
if (hook.event && hook.operation) { |
|
|
|
hook.eventOperation = `${hook.event} ${hook.operation}` |
|
|
|
hook.eventOperation = `${hook.event} ${hook.operation}` |
|
|
|
} |
|
|
|
} |
|
|
@ -344,25 +339,27 @@ async function saveHooks() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
let res |
|
|
|
let res |
|
|
|
if (hook.id) { |
|
|
|
if (hook.id) { |
|
|
|
res = await $api.dbTableWebhook.update(hook.id, { |
|
|
|
// TODO: fix me |
|
|
|
...hook, |
|
|
|
// res = await $api.dbTableWebhook.update(hook.id, { |
|
|
|
notification: { |
|
|
|
// ...hook, |
|
|
|
...hook.notification, |
|
|
|
// notification: { |
|
|
|
payload: hook.notification.payload, |
|
|
|
// ...hook.notification, |
|
|
|
}, |
|
|
|
// payload: hook.notification.payload, |
|
|
|
}) |
|
|
|
// }, |
|
|
|
|
|
|
|
// }) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
res = await $api.dbTableWebhook.create(meta?.value.id as string, { |
|
|
|
// TODO: fix me |
|
|
|
...hook, |
|
|
|
// res = await $api.dbTableWebhook.create(meta?.value.id as string, { |
|
|
|
notification: { |
|
|
|
// ...hook, |
|
|
|
...hook.notification, |
|
|
|
// notification: { |
|
|
|
payload: hook.notification.payload, |
|
|
|
// ...hook.notification, |
|
|
|
}, |
|
|
|
// payload: hook.notification.payload, |
|
|
|
}) |
|
|
|
// }, |
|
|
|
|
|
|
|
// }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!hook.id && res) { |
|
|
|
if (!hook.id && res) { |
|
|
|
hook.id = res.id |
|
|
|
// hook.id = res.id |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: wait for filter implementation |
|
|
|
// TODO: wait for filter implementation |
|
|
|