Browse Source

add WebhookTpl

visuddhinanda 2 years ago
parent
commit
c89d3d2775
1 changed files with 7 additions and 1 deletions
  1. 7 1
      dashboard/src/components/webhook/WebhookEdit.tsx

+ 7 - 1
dashboard/src/components/webhook/WebhookEdit.tsx

@@ -5,13 +5,14 @@ import {
   ProFormText,
 } from "@ant-design/pro-components";
 import { message, Space, Typography } from "antd";
-import { useRef } from "react";
+import { useRef, useState } from "react";
 import { useIntl } from "react-intl";
 import { Link } from "react-router-dom";
 
 import { get, post, put } from "../../request";
 import { IWebhookRequest, IWebhookResponse } from "../api/webhook";
 import { TResType } from "../discussion/DiscussionListCard";
+import WebhookTpl, { IWebhookEvent } from "./WebhookTpl";
 
 const { Title } = Typography;
 
@@ -32,6 +33,7 @@ const WebhookEditWidget = ({
   onSuccess,
 }: IWidget) => {
   const formRef = useRef<ProFormInstance>();
+  const [event, setEvent] = useState<IWebhookEvent[]>([]);
   const intl = useIntl();
 
   return (
@@ -52,6 +54,7 @@ const WebhookEditWidget = ({
           let data: IWebhookRequest = values;
           data.res_id = res_id;
           data.res_type = res_type;
+          data.event2 = event;
           let res: IWebhookResponse;
           if (typeof id === "undefined") {
             res = await post<IWebhookRequest, IWebhookResponse>(
@@ -152,6 +155,9 @@ const WebhookEditWidget = ({
             label={intl.formatMessage({ id: "forms.fields.status.label" })}
           />
         </ProForm.Group>
+        <ProForm.Group>
+          <WebhookTpl onChange={(value: IWebhookEvent[]) => setEvent(value)} />
+        </ProForm.Group>
       </ProForm>
     </Space>
   );