Skip to content

Commit 8bffd28

Browse files
committed
feat(webhooks): add example webhook name constant and input field to form
1 parent f6ec9d5 commit 8bffd28

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

app/javascript/dashboard/constants/globals.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default {
4747
},
4848
EXAMPLE_URL: 'example.com',
4949
EXAMPLE_WEBHOOK_URL: 'https://example/api/webhook',
50+
EXAMPLE_WEBHOOK_NAME: 'My Example Webhook',
5051
INBOX_SORT_BY: {
5152
NEWEST: 'desc',
5253
OLDEST: 'asc',

app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { required, url, minLength } from '@vuelidate/validators';
44
import wootConstants from 'dashboard/constants/globals';
55
import { getI18nKey } from 'dashboard/routes/dashboard/settings/helper/settingsHelper';
66
7-
const { EXAMPLE_WEBHOOK_URL } = wootConstants;
7+
const { EXAMPLE_WEBHOOK_URL, EXAMPLE_WEBHOOK_NAME } = wootConstants;
88
99
const SUPPORTED_WEBHOOK_EVENTS = [
1010
'conversation_created',
@@ -48,6 +48,7 @@ export default {
4848
},
4949
data() {
5050
return {
51+
name: this.value.name || '',
5152
url: this.value.url || '',
5253
subscriptions: this.value.subscriptions || [],
5354
supportedWebhookEvents: SUPPORTED_WEBHOOK_EVENTS,
@@ -62,10 +63,19 @@ export default {
6263
}
6364
);
6465
},
66+
webhookNameInputPlaceholder() {
67+
return this.$t(
68+
'INTEGRATION_SETTINGS.WEBHOOK.FORM.END_POINT.PLACEHOLDER',
69+
{
70+
webhookExampleURL: EXAMPLE_WEBHOOK_NAME,
71+
}
72+
);
73+
},
6574
},
6675
methods: {
6776
onSubmit() {
6877
this.$emit('submit', {
78+
name: this.name,
6979
url: this.url,
7080
subscriptions: this.subscriptions,
7181
});
@@ -78,6 +88,16 @@ export default {
7888
<template>
7989
<form class="flex flex-col w-full" @submit.prevent="onSubmit">
8090
<div class="w-full">
91+
<label>
92+
{{ $t('INTEGRATION_SETTINGS.WEBHOOK.FORM.END_POINT.LABEL') }}
93+
<input
94+
v-model="name"
95+
type="text"
96+
name="name"
97+
:placeholder="webhookNameInputPlaceholder"
98+
@input="v$.name.$touch"
99+
/>
100+
</label>
81101
<label :class="{ error: v$.url.$error }">
82102
{{ $t('INTEGRATION_SETTINGS.WEBHOOK.FORM.END_POINT.LABEL') }}
83103
<input

0 commit comments

Comments
 (0)