Browse Source

feat(nc-gui): include LazyWebhookCallLog component

pull/5349/head
Wing-Kam Wong 2 years ago
parent
commit
1ce979f2d8
  1. 500
      packages/nc-gui/components/webhook/Editor.vue

500
packages/nc-gui/components/webhook/Editor.vue

@ -38,6 +38,8 @@ const { appInfo } = $(useGlobal())
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
const hookTabKey = ref('hook-edit')
const useForm = Form.useForm const useForm = Form.useForm
const hook = reactive< const hook = reactive<
@ -461,243 +463,263 @@ onMounted(async () => {
<a-divider /> <a-divider />
<a-form :model="hook" name="create-or-edit-webhook"> <a-tabs v-model:activeKey="hookTabKey" type="card" closeable="false" class="shadow-sm">
<a-form-item> <a-tab-pane key="hook-edit" class="nc-hook-edit" force-render>
<a-row type="flex"> <template #tab>
<a-col :span="24"> <span>
<a-card> <MdiEditOutline />
<a-checkbox Edit
:checked="Boolean(hook.active)" </span>
class="nc-check-box-enable-webhook" </template>
@update:checked="hook.active = $event" <a-form :model="hook" name="create-or-edit-webhook">
> <a-form-item>
{{ $t('activity.enableWebhook') }} <a-row type="flex">
</a-checkbox> <a-col :span="24">
</a-card> <a-card>
</a-col> <a-checkbox
</a-row> :checked="Boolean(hook.active)"
</a-form-item> class="nc-check-box-enable-webhook"
<a-form-item> @update:checked="hook.active = $event"
<a-row type="flex"> >
<a-col :span="24"> {{ $t('activity.enableWebhook') }}
<a-form-item v-bind="validateInfos.title"> </a-checkbox>
<a-input </a-card>
v-model:value="hook.title" </a-col>
size="large" </a-row>
:placeholder="$t('general.title')" </a-form-item>
class="nc-text-field-hook-title" <a-form-item>
/> <a-row type="flex">
</a-form-item> <a-col :span="24">
</a-col> <a-form-item v-bind="validateInfos.title">
</a-row> <a-input
v-model:value="hook.title"
<a-row type="flex" :gutter="[16, 16]"> size="large"
<a-col :span="12"> :placeholder="$t('general.title')"
<a-form-item v-bind="validateInfos.eventOperation"> class="nc-text-field-hook-title"
<a-select />
v-model:value="hook.eventOperation" </a-form-item>
size="large" </a-col>
:placeholder="$t('general.event')" </a-row>
class="nc-text-field-hook-event"
dropdown-class-name="nc-dropdown-webhook-event" <a-row type="flex" :gutter="[16, 16]">
> <a-col :span="12">
<a-select-option v-for="(event, i) in eventList" :key="i" :value="event.value.join(' ')"> <a-form-item v-bind="validateInfos.eventOperation">
{{ event.text.join(' ') }} <a-select
</a-select-option> v-model:value="hook.eventOperation"
</a-select> size="large"
</a-form-item> :placeholder="$t('general.event')"
</a-col> class="nc-text-field-hook-event"
dropdown-class-name="nc-dropdown-webhook-event"
<a-col :span="12"> >
<a-form-item v-bind="validateInfos['notification.type']"> <a-select-option v-for="(event, i) in eventList" :key="i" :value="event.value.join(' ')">
<a-select {{ event.text.join(' ') }}
v-model:value="hook.notification.type" </a-select-option>
size="large" </a-select>
class="nc-select-hook-notification-type" </a-form-item>
:placeholder="$t('general.notification')" </a-col>
dropdown-class-name="nc-dropdown-webhook-notification"
@change="onNotTypeChange(true)" <a-col :span="12">
> <a-form-item v-bind="validateInfos['notification.type']">
<a-select-option v-for="(notificationOption, i) in notificationList" :key="i" :value="notificationOption.type"> <a-select
<div class="flex items-center"> v-model:value="hook.notification.type"
<MdiLink v-if="notificationOption.type === 'URL'" class="mr-2" /> size="large"
class="nc-select-hook-notification-type"
<MdiEmail v-if="notificationOption.type === 'Email'" class="mr-2" /> :placeholder="$t('general.notification')"
dropdown-class-name="nc-dropdown-webhook-notification"
<MdiSlack v-if="notificationOption.type === 'Slack'" class="mr-2" /> @change="onNotTypeChange(true)"
>
<MdiMicrosoftTeams v-if="notificationOption.type === 'Microsoft Teams'" class="mr-2" /> <a-select-option v-for="(notificationOption, i) in notificationList" :key="i" :value="notificationOption.type">
<div class="flex items-center">
<MdiDiscord v-if="notificationOption.type === 'Discord'" class="mr-2" /> <MdiLink v-if="notificationOption.type === 'URL'" class="mr-2" />
<MdiChat v-if="notificationOption.type === 'Mattermost'" class="mr-2" /> <MdiEmail v-if="notificationOption.type === 'Email'" class="mr-2" />
<MdiWhatsapp v-if="notificationOption.type === 'Whatsapp Twilio'" class="mr-2" /> <MdiSlack v-if="notificationOption.type === 'Slack'" class="mr-2" />
<MdiCellphoneMessage v-if="notificationOption.type === 'Twilio'" class="mr-2" /> <MdiMicrosoftTeams v-if="notificationOption.type === 'Microsoft Teams'" class="mr-2" />
{{ notificationOption.type }} <MdiDiscord v-if="notificationOption.type === 'Discord'" class="mr-2" />
</div>
</a-select-option> <MdiChat v-if="notificationOption.type === 'Mattermost'" class="mr-2" />
</a-select>
</a-form-item> <MdiWhatsapp v-if="notificationOption.type === 'Whatsapp Twilio'" class="mr-2" />
</a-col>
</a-row> <MdiCellphoneMessage v-if="notificationOption.type === 'Twilio'" class="mr-2" />
<a-row v-if="hook.notification.type === 'URL'" class="mb-5" type="flex" :gutter="[16, 0]"> {{ notificationOption.type }}
<a-col :span="6"> </div>
<a-select </a-select-option>
v-model:value="hook.notification.payload.method" </a-select>
size="large" </a-form-item>
class="nc-select-hook-url-method" </a-col>
dropdown-class-name="nc-dropdown-hook-notification-url-method" </a-row>
>
<a-select-option v-for="(method, i) in methodList" :key="i" :value="method.title"> <a-row v-if="hook.notification.type === 'URL'" class="mb-5" type="flex" :gutter="[16, 0]">
{{ method.title }} <a-col :span="6">
</a-select-option> <a-select
</a-select> v-model:value="hook.notification.payload.method"
</a-col> size="large"
class="nc-select-hook-url-method"
<a-col :span="18"> dropdown-class-name="nc-dropdown-hook-notification-url-method"
<a-form-item v-bind="validateInfos['notification.payload.path']"> >
<a-input <a-select-option v-for="(method, i) in methodList" :key="i" :value="method.title">
v-model:value="hook.notification.payload.path" {{ method.title }}
size="large" </a-select-option>
placeholder="http://example.com" </a-select>
class="nc-text-field-hook-url-path" </a-col>
/>
</a-form-item> <a-col :span="18">
</a-col> <a-form-item v-bind="validateInfos['notification.payload.path']">
<a-input
<a-col :span="24"> v-model:value="hook.notification.payload.path"
<a-tabs v-model:activeKey="urlTabKey" type="card" closeable="false" class="shadow-sm"> size="large"
<a-tab-pane key="params" tab="Params" force-render> placeholder="http://example.com"
<LazyApiClientParams v-model="hook.notification.payload.parameters" /> class="nc-text-field-hook-url-path"
</a-tab-pane> />
</a-form-item>
<a-tab-pane key="headers" tab="Headers" class="nc-tab-headers"> </a-col>
<LazyApiClientHeaders v-model="hook.notification.payload.headers" />
</a-tab-pane> <a-col :span="24">
<a-tabs v-model:activeKey="urlTabKey" type="card" closeable="false" class="shadow-sm">
<!-- No in use at this moment --> <a-tab-pane key="params" tab="Params" force-render>
<!-- <a-tab-pane key="auth" tab="Auth"> --> <LazyApiClientParams v-model="hook.notification.payload.parameters" />
<!-- <LazyMonacoEditor v-model="hook.notification.payload.auth" class="min-h-60 max-h-80" /> --> </a-tab-pane>
<!-- <span class="text-gray-500 prose-sm p-2"> --> <a-tab-pane key="headers" tab="Headers" class="nc-tab-headers">
<!-- For more about auth option refer --> <LazyApiClientHeaders v-model="hook.notification.payload.headers" />
<!-- <a class="prose-sm" href ="https://github.com/axios/axios#request-config" target="_blank">axios docs</a>. --> </a-tab-pane>
<!-- </span> -->
<!-- </a-tab-pane> --> <!-- No in use at this moment -->
</a-tabs> <!-- <a-tab-pane key="auth" tab="Auth"> -->
</a-col> <!-- <LazyMonacoEditor v-model="hook.notification.payload.auth" class="min-h-60 max-h-80" /> -->
</a-row>
<!-- <span class="text-gray-500 prose-sm p-2"> -->
<a-row v-if="hook.notification.type === 'Slack'" type="flex"> <!-- For more about auth option refer -->
<a-col :span="24"> <!-- <a class="prose-sm" href ="https://github.com/axios/axios#request-config" target="_blank">axios docs</a>. -->
<a-form-item v-bind="validateInfos['notification.channels']"> <!-- </span> -->
<LazyWebhookChannelMultiSelect <!-- </a-tab-pane> -->
v-if="slackChannels.length > 0" </a-tabs>
v-model="hook.notification.payload.channels" </a-col>
:selected-channel-list="hook.notification.payload.channels" </a-row>
:available-channel-list="slackChannels"
placeholder="Select Slack channels" <a-row v-if="hook.notification.type === 'Slack'" type="flex">
/> <a-col :span="24">
</a-form-item> <a-form-item v-bind="validateInfos['notification.channels']">
</a-col> <LazyWebhookChannelMultiSelect
</a-row> v-if="slackChannels.length > 0"
v-model="hook.notification.payload.channels"
<a-row v-if="hook.notification.type === 'Microsoft Teams'" type="flex"> :selected-channel-list="hook.notification.payload.channels"
<a-col :span="24"> :available-channel-list="slackChannels"
<a-form-item v-bind="validateInfos['notification.channels']"> placeholder="Select Slack channels"
<LazyWebhookChannelMultiSelect />
v-if="teamsChannels.length > 0" </a-form-item>
v-model="hook.notification.payload.channels" </a-col>
:selected-channel-list="hook.notification.payload.channels" </a-row>
:available-channel-list="teamsChannels"
placeholder="Select Microsoft Teams channels" <a-row v-if="hook.notification.type === 'Microsoft Teams'" type="flex">
/> <a-col :span="24">
</a-form-item> <a-form-item v-bind="validateInfos['notification.channels']">
</a-col> <LazyWebhookChannelMultiSelect
</a-row> v-if="teamsChannels.length > 0"
v-model="hook.notification.payload.channels"
<a-row v-if="hook.notification.type === 'Discord'" type="flex"> :selected-channel-list="hook.notification.payload.channels"
<a-col :span="24"> :available-channel-list="teamsChannels"
<a-form-item v-bind="validateInfos['notification.channels']"> placeholder="Select Microsoft Teams channels"
<LazyWebhookChannelMultiSelect />
v-if="discordChannels.length > 0" </a-form-item>
v-model="hook.notification.payload.channels" </a-col>
:selected-channel-list="hook.notification.payload.channels" </a-row>
:available-channel-list="discordChannels"
placeholder="Select Discord channels" <a-row v-if="hook.notification.type === 'Discord'" type="flex">
/> <a-col :span="24">
</a-form-item> <a-form-item v-bind="validateInfos['notification.channels']">
</a-col> <LazyWebhookChannelMultiSelect
</a-row> v-if="discordChannels.length > 0"
v-model="hook.notification.payload.channels"
<a-row v-if="hook.notification.type === 'Mattermost'" type="flex"> :selected-channel-list="hook.notification.payload.channels"
<a-col :span="24"> :available-channel-list="discordChannels"
<a-form-item v-bind="validateInfos['notification.channels']"> placeholder="Select Discord channels"
<LazyWebhookChannelMultiSelect />
v-if="mattermostChannels.length > 0" </a-form-item>
v-model="hook.notification.payload.channels" </a-col>
:selected-channel-list="hook.notification.payload.channels" </a-row>
:available-channel-list="mattermostChannels"
placeholder="Select Mattermost channels" <a-row v-if="hook.notification.type === 'Mattermost'" type="flex">
/> <a-col :span="24">
</a-form-item> <a-form-item v-bind="validateInfos['notification.channels']">
</a-col> <LazyWebhookChannelMultiSelect
</a-row> v-if="mattermostChannels.length > 0"
v-model="hook.notification.payload.channels"
<a-row v-if="formInput[hook.notification.type] && hook.notification.payload" type="flex"> :selected-channel-list="hook.notification.payload.channels"
<a-col v-for="(input, i) in formInput[hook.notification.type]" :key="i" :span="24"> :available-channel-list="mattermostChannels"
<a-form-item v-if="input.type === 'LongText'" v-bind="validateInfos[`notification.payload.${input.key}`]"> placeholder="Select Mattermost channels"
<a-textarea v-model:value="hook.notification.payload[input.key]" :placeholder="input.label" size="large" /> />
</a-form-item> </a-form-item>
</a-col>
<a-form-item v-else v-bind="validateInfos[`notification.payload.${input.key}`]"> </a-row>
<a-input v-model:value="hook.notification.payload[input.key]" :placeholder="input.label" size="large" />
</a-form-item> <a-row v-if="formInput[hook.notification.type] && hook.notification.payload" type="flex">
</a-col> <a-col v-for="(input, i) in formInput[hook.notification.type]" :key="i" :span="24">
</a-row> <a-form-item v-if="input.type === 'LongText'" v-bind="validateInfos[`notification.payload.${input.key}`]">
<a-textarea v-model:value="hook.notification.payload[input.key]" :placeholder="input.label" size="large" />
<a-row class="mb-5" type="flex"> </a-form-item>
<a-col :span="24">
<a-card> <a-form-item v-else v-bind="validateInfos[`notification.payload.${input.key}`]">
<a-checkbox <a-input v-model:value="hook.notification.payload[input.key]" :placeholder="input.label" size="large" />
:checked="Boolean(hook.condition)" </a-form-item>
class="nc-check-box-hook-condition" </a-col>
@update:checked="hook.condition = $event" </a-row>
>
On Condition <a-row class="mb-5" type="flex">
</a-checkbox> <a-col :span="24">
<a-card>
<LazySmartsheetToolbarColumnFilter <a-checkbox
v-if="hook.condition" :checked="Boolean(hook.condition)"
ref="filterRef" class="nc-check-box-hook-condition"
class="mt-4" @update:checked="hook.condition = $event"
:auto-save="false" >
:show-loading="false" On Condition
:hook-id="hook.id" </a-checkbox>
web-hook
/> <LazySmartsheetToolbarColumnFilter
</a-card> v-if="hook.condition"
</a-col> ref="filterRef"
</a-row> class="mt-4"
:auto-save="false"
<a-row> :show-loading="false"
<a-col :span="24"> :hook-id="hook.id"
<LazyWebhookTest web-hook
ref="webhookTestRef" />
:hook="{ </a-card>
...hook, </a-col>
notification: { </a-row>
...hook.notification,
payload: hook.notification.payload, <a-row>
}, <a-col :span="24">
}" <LazyWebhookTest
/> ref="webhookTestRef"
</a-col> :hook="{
</a-row> ...hook,
</a-form-item> notification: {
</a-form> ...hook.notification,
payload: hook.notification.payload,
},
}"
/>
</a-col>
</a-row>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane key="hook-log" class="nc-hook-log">
<template #tab>
<span>
<MdiHistory />
Call Log
</span>
</template>
<LazyWebhookCallLog />
</a-tab-pane>
</a-tabs>
</template> </template>

Loading…
Cancel
Save