diff --git a/dashboard/src/components/UpdateWebhookModal.tsx b/dashboard/src/components/UpdateWebhookModal.tsx index 55af022..db35d31 100644 --- a/dashboard/src/components/UpdateWebhookModal.tsx +++ b/dashboard/src/components/UpdateWebhookModal.tsx @@ -63,6 +63,7 @@ interface headersValidatorDataType { interface selecetdWebhookDataTypes { [WebhookInputDataFields.ID]: string; [WebhookInputDataFields.EVENT_NAME]: string; + [WebhookInputDataFields.EVENT_DESCRIPTION]?: string; [WebhookInputDataFields.ENDPOINT]: string; [WebhookInputDataFields.ENABLED]: boolean; [WebhookInputDataFields.HEADERS]?: Record; @@ -86,6 +87,7 @@ const initHeadersValidatorData: headersValidatorDataType = { interface webhookDataType { [WebhookInputDataFields.EVENT_NAME]: string; + [WebhookInputDataFields.EVENT_DESCRIPTION]?: string; [WebhookInputDataFields.ENDPOINT]: string; [WebhookInputDataFields.ENABLED]: boolean; [WebhookInputDataFields.HEADERS]: headersDataType[]; @@ -98,6 +100,7 @@ interface validatorDataType { const initWebhookData: webhookDataType = { [WebhookInputDataFields.EVENT_NAME]: webhookEventNames['User login'], + [WebhookInputDataFields.EVENT_DESCRIPTION]: '', [WebhookInputDataFields.ENDPOINT]: '', [WebhookInputDataFields.ENABLED]: true, [WebhookInputDataFields.HEADERS]: [{ ...initHeadersData }], @@ -144,6 +147,9 @@ const UpdateWebhookModal = ({ case WebhookInputDataFields.EVENT_NAME: setWebhook({ ...webhook, [inputType]: value }); break; + case WebhookInputDataFields.EVENT_DESCRIPTION: + setWebhook({ ...webhook, [inputType]: value }); + break; case WebhookInputDataFields.ENDPOINT: setWebhook({ ...webhook, [inputType]: value }); setValidator({ @@ -246,6 +252,8 @@ const UpdateWebhookModal = ({ let params: any = { [WebhookInputDataFields.EVENT_NAME]: webhook[WebhookInputDataFields.EVENT_NAME], + [WebhookInputDataFields.EVENT_DESCRIPTION]: + webhook[WebhookInputDataFields.EVENT_DESCRIPTION], [WebhookInputDataFields.ENDPOINT]: webhook[WebhookInputDataFields.ENDPOINT], [WebhookInputDataFields.ENABLED]: webhook[WebhookInputDataFields.ENABLED], @@ -402,7 +410,9 @@ const UpdateWebhookModal = ({ + + Event Description + + + + inputChangehandler( + WebhookInputDataFields.EVENT_DESCRIPTION, + e.currentTarget.value, + ) + } + /> + + + ; @@ -118,6 +118,7 @@ const Webhooks = () => { useEffect(() => { fetchWebookData(); }, [paginationProps.page, paginationProps.limit]); + console.log({ webhookData }); return ( diff --git a/server/db/models/webhook.go b/server/db/models/webhook.go index f86ee80..3faefc1 100644 --- a/server/db/models/webhook.go +++ b/server/db/models/webhook.go @@ -39,12 +39,13 @@ func (w *Webhook) AsAPIWebhook() *model.Webhook { w.EventDescription = strings.Join(strings.Split(w.EventName, "."), " ") } return &model.Webhook{ - ID: id, - EventName: refs.NewStringRef(w.EventName), - Endpoint: refs.NewStringRef(w.EndPoint), - Headers: headersMap, - Enabled: refs.NewBoolRef(w.Enabled), - CreatedAt: refs.NewInt64Ref(w.CreatedAt), - UpdatedAt: refs.NewInt64Ref(w.UpdatedAt), + ID: id, + EventName: refs.NewStringRef(w.EventName), + EventDescription: refs.NewStringRef(w.EventDescription), + Endpoint: refs.NewStringRef(w.EndPoint), + Headers: headersMap, + Enabled: refs.NewBoolRef(w.Enabled), + CreatedAt: refs.NewInt64Ref(w.CreatedAt), + UpdatedAt: refs.NewInt64Ref(w.UpdatedAt), } }