π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
feat: UI for webhook logs
mertmitf512c637c55a
diff --git a/packages/nc-gui/components/webhook/CallLog/Details.vue b/packages/nc-gui/components/webhook/CallLog/Details.vueindex 853f0ad5e1..802403e06d 100644--- a/packages/nc-gui/components/webhook/CallLog/Details.vue+++ b/packages/nc-gui/components/webhook/CallLog/Details.vue@@ -51,7 +51,7 @@ const hookType = (item: HookLogType) => {</div><div class="log-details">- <div class="log-detail-item">+ <div v-if="item.execution_time" class="log-detail-item"><span class="label">Execution Time</span><span class="value">{{ item.execution_time }} ms</span></div>diff --git a/packages/nc-gui/components/webhook/CallLog/List.vue b/packages/nc-gui/components/webhook/CallLog/List.vueindex 909e44f055..7febd3482f 100644--- a/packages/nc-gui/components/webhook/CallLog/List.vue+++ b/packages/nc-gui/components/webhook/CallLog/List.vue@@ -40,7 +40,7 @@ const emit = defineEmits<Emit>()</h4><span class="text-nc-content-gray-subtle2 text-small1"><template v-if="log.error"> Error occurred {{ log.error_code ?? '' }}</template>- <template v-else> Executed in {{ log.execution_time }} ms </template>+ <template v-else-if="log.execution_time"> Executed in {{ log.execution_time }} ms </template></span></div></div>diff --git a/packages/nc-gui/components/webhook/CallLog/ReqResDetailCard.vue b/packages/nc-gui/components/webhook/CallLog/ReqResDetailCard.vueindex a23001cb58..bbc572f60b 100644--- a/packages/nc-gui/components/webhook/CallLog/ReqResDetailCard.vue+++ b/packages/nc-gui/components/webhook/CallLog/ReqResDetailCard.vue@@ -33,8 +33,30 @@ const formattedPayload = computed(() => {<div class="detail-title font-weight-bold">{{ title }}</div><div class="content"><div v-if="headers" class="detail-headers">- <span class="text-gray-500 font-weight-bold text-small1">Header</span>- <div class="log-details">+ <span v-if="!headers['nc-script-id']" class="text-gray-500 font-weight-bold text-small1">Header</span>+ <div v-if="headers['nc-script-id']" class="log-details">+ <div class="log-detail-item">+ <NcTooltip class="text-small1 min-w-40" show-on-truncate-only>+ <template #title>Script ID</template>+ <span class="label script"> Script ID </span>+ </NcTooltip>+ <NcTooltip class="text-small1 max-w-[calc(100%_-_160px)] truncate" show-on-truncate-only>+ <template #title>{{ headers['nc-script-id'] }}</template>+ <span class="value"> {{ headers['nc-script-id'] }}</span>+ </NcTooltip>+ </div>+ <div class="log-detail-item">+ <NcTooltip class="text-small1 min-w-40" show-on-truncate-only>+ <template #title>Script Title</template>+ <span class="label script"> Script Title </span>+ </NcTooltip>+ <NcTooltip class="text-small1 max-w-[calc(100%_-_160px)] truncate" show-on-truncate-only>+ <template #title>{{ headers['nc-script-title'] }}</template>+ <span class="value"> {{ headers['nc-script-title'] }}</span>+ </NcTooltip>+ </div>+ </div>+ <div v-else class="log-details"><div v-for="(value, key) in headers" :key="key" class="log-detail-item"><NcTooltip class="text-small1 min-w-40" show-on-truncate-only><template #title>{{ key }}</template>@@ -131,7 +153,7 @@ const formattedPayload = computed(() => {@apply flex flex-col gap-1 mt-2;.log-detail-item {@apply flex flex-row w-full;- .label {+ .label:not(.script) {@apply min-w-40 font-weight-600 text-gray-700 text-small1 lowercase;}diff --git a/packages/nocodb/src/utils/webhook-invoker.ts b/packages/nocodb/src/utils/webhook-invoker.tsindex 39ea032013..742809e78e 100644--- a/packages/nocodb/src/utils/webhook-invoker.ts+++ b/packages/nocodb/src/utils/webhook-invoker.ts@@ -535,6 +535,31 @@ export class WebhookInvoker {);}+ reqPayload = this.populateAxiosReq({+ apiMeta: {+ ...notification?.payload,+ headers: [+ {+ name: 'nc-script-id',+ value: script.id,+ enabled: true,+ },+ {+ name: 'nc-script-title',+ value: script.title,+ enabled: true,+ },+ ],+ body: '{{ json event }}',+ },+ user,+ hook: hookPayload,+ model,+ view,+ prevData,+ newData,+ });+await addJob?.(JobTypes.ExecuteAction, {context,scriptId: notification?.payload?.scriptId,@@ -545,7 +570,9 @@ export class WebhookInvoker {operation: hookPayload.operation as any,fk_hook_id: hook.id,type: notification.type,- payload: JSON.stringify(notification?.payload),+ payload: JSON.stringify(+ this.extractReqPayloadForLog(reqPayload),+ ),triggered_by: user?.email,conditions: JSON.stringify(filters),},