|
|
@ -9,6 +9,7 @@ import { |
|
|
|
fieldRequiredValidator, |
|
|
|
fieldRequiredValidator, |
|
|
|
iconMap, |
|
|
|
iconMap, |
|
|
|
inject, |
|
|
|
inject, |
|
|
|
|
|
|
|
isEeUI, |
|
|
|
message, |
|
|
|
message, |
|
|
|
onMounted, |
|
|
|
onMounted, |
|
|
|
parseProp, |
|
|
|
parseProp, |
|
|
@ -19,7 +20,6 @@ import { |
|
|
|
useI18n, |
|
|
|
useI18n, |
|
|
|
useNuxtApp, |
|
|
|
useNuxtApp, |
|
|
|
watch, |
|
|
|
watch, |
|
|
|
isEeUI |
|
|
|
|
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
import { extractNextDefaultName } from '~/helpers/parsers/parserHelpers' |
|
|
|
import { extractNextDefaultName } from '~/helpers/parsers/parserHelpers' |
|
|
|
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ let hookRef = reactive< |
|
|
|
type: 'URL', |
|
|
|
type: 'URL', |
|
|
|
payload: { |
|
|
|
payload: { |
|
|
|
method: 'POST', |
|
|
|
method: 'POST', |
|
|
|
body: '{{ json data }}', |
|
|
|
body: '{{ json event }}', |
|
|
|
headers: [{}], |
|
|
|
headers: [{}], |
|
|
|
parameters: [{}], |
|
|
|
parameters: [{}], |
|
|
|
path: '', |
|
|
|
path: '', |
|
|
@ -76,9 +76,10 @@ let hookRef = reactive< |
|
|
|
version: 'v2', |
|
|
|
version: 'v2', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isBodyShownEasterEgg = ref(false) |
|
|
|
const isBodyShown = ref(hookRef.version === 'v1' || isEeUI) |
|
|
|
const isBodyShown = ref(hookRef.version === 'v1' || isEeUI) |
|
|
|
|
|
|
|
|
|
|
|
const urlTabKey = ref(isBodyShown.value ? 'body' : 'params') |
|
|
|
const urlTabKey = ref(isBodyShownEasterEgg.value && isBodyShown.value ? 'body' : 'params') |
|
|
|
|
|
|
|
|
|
|
|
const apps: Record<string, any> = ref() |
|
|
|
const apps: Record<string, any> = ref() |
|
|
|
|
|
|
|
|
|
|
@ -302,7 +303,8 @@ function onNotificationTypeChange(reset = false) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (hookRef.notification.type === 'URL') { |
|
|
|
if (hookRef.notification.type === 'URL') { |
|
|
|
hookRef.notification.payload.body = hookRef.notification.payload.body || '{{ json data }}' |
|
|
|
const body = hookRef.notification.payload.body |
|
|
|
|
|
|
|
hookRef.notification.payload.body = body ? (body === '{{ json data }}' ? '{{ json event }}' : body) : '{{ json event }}' |
|
|
|
hookRef.notification.payload.parameters = hookRef.notification.payload.parameters || [{}] |
|
|
|
hookRef.notification.payload.parameters = hookRef.notification.payload.parameters || [{}] |
|
|
|
hookRef.notification.payload.headers = hookRef.notification.payload.headers || [{}] |
|
|
|
hookRef.notification.payload.headers = hookRef.notification.payload.headers || [{}] |
|
|
|
hookRef.notification.payload.method = hookRef.notification.payload.method || 'POST' |
|
|
|
hookRef.notification.payload.method = hookRef.notification.payload.method || 'POST' |
|
|
@ -655,6 +657,7 @@ onMounted(async () => { |
|
|
|
size="large" |
|
|
|
size="large" |
|
|
|
class="nc-select-hook-url-method" |
|
|
|
class="nc-select-hook-url-method" |
|
|
|
dropdown-class-name="nc-dropdown-hook-notification-url-method" |
|
|
|
dropdown-class-name="nc-dropdown-hook-notification-url-method" |
|
|
|
|
|
|
|
@dblclick="isBodyShownEasterEgg = !isBodyShownEasterEgg" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-select-option v-for="(method, i) in methodList" :key="i" :value="method.title"> |
|
|
|
<a-select-option v-for="(method, i) in methodList" :key="i" :value="method.title"> |
|
|
|
<div class="flex items-center gap-2 justify-between"> |
|
|
|
<div class="flex items-center gap-2 justify-between"> |
|
|
@ -684,7 +687,7 @@ onMounted(async () => { |
|
|
|
|
|
|
|
|
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<NcTabs v-model:activeKey="urlTabKey" type="card" closeable="false" class="border-1 !pb-2 !rounded-lg"> |
|
|
|
<NcTabs v-model:activeKey="urlTabKey" type="card" closeable="false" class="border-1 !pb-2 !rounded-lg"> |
|
|
|
<a-tab-pane v-if="isBodyShown" key="body" tab="Body"> |
|
|
|
<a-tab-pane v-if="isBodyShown && isBodyShownEasterEgg" key="body" tab="Body"> |
|
|
|
<LazyMonacoEditor |
|
|
|
<LazyMonacoEditor |
|
|
|
v-model="hookRef.notification.payload.body" |
|
|
|
v-model="hookRef.notification.payload.body" |
|
|
|
disable-deep-compare |
|
|
|
disable-deep-compare |
|
|
@ -804,7 +807,7 @@ onMounted(async () => { |
|
|
|
|
|
|
|
|
|
|
|
<a-row> |
|
|
|
<a-row> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<div v-if="isBodyShown" class="text-gray-600"> |
|
|
|
<div v-if="isBodyShown && isBodyShownEasterEgg" class="text-gray-600"> |
|
|
|
<div class="flex items-center"> |
|
|
|
<div class="flex items-center"> |
|
|
|
<em |
|
|
|
<em |
|
|
|
>{{ $t('msg.webhookBodyMsg1') }} <strong>{{ $t('msg.webhookBodyMsg2') }}</strong> |
|
|
|
>{{ $t('msg.webhookBodyMsg1') }} <strong>{{ $t('msg.webhookBodyMsg2') }}</strong> |
|
|
|