You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/08 05:53:15 UTC

[GitHub] [incubator-devlake] mintsweet opened a new pull request, #3017: feat(config-ui): added a data integration webhook

mintsweet opened a new pull request, #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017

   ### What done this PR do
   
   - [ ] Add Webhooks Section to Data Integrations.
   - [ ]  Create Webhooks Management Page
     - [ ]  Add Data Grid / Table for Listing all Available Webhooks
     - [ ] Integrate Add / Edit Webhook Workflow
     - [ ] Integrate Delete Webhook Workflow
   - [ ] Create Webhooks Hook Service for creating, modifying & fetching API Resources
   - [ ] Required Form & Field Validations
   - [ ] Error Handling
   
   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Does this close any open issues?
   Closes https://github.com/apache/incubator-devlake/issues/2979
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   No response.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation merged pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation merged PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966582757


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";

Review Comment:
   ```suggestion
   import { ReactComponent as EditIcon } from "@/images/icons/setting-con.svg";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966574684


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {

Review Comment:
   This can be expressed to be more declarative by removing the need for an IF statement, rather than making it imperative. Use the callback mechanism of the setter to set record value if it exists otherwise fallback to the current record value.
   
   ```suggestion
       setRecord(existingRecord => r ? r : existingRecord)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966592670


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({
+  visible,
+  modalType,
+  record,
+  onCancel,
+  onCreate,
+  onUpdate,
+  onDelete,
+}) => {
+  const [name, setName] = useState("");
+  const [error, setError] = useState("");
+
+  const title = useMemo(() => {
+    switch (modalType) {
+      case "add":
+        return "Add a New Webhook";
+      case "edit":
+        return "Edit Webhook";
+      case "delete":
+        return "Delete this Webhook? ";
+    }
+  }, [modalType]);
+
+  useEffect(() => {
+    setName(record?.name);
+  }, [record]);
+
+  const handleInputChange = (e) => {
+    setName(e.target.value);
+    setError("");
+  };
+
+  const handleSubmit = () => {
+    if (!name) {
+      setError("Name is required");
+      return;
+    }
+
+    if (modalType === "add") {
+      onCreate(name);
+    } else if (modalType === "edit") {
+      onUpdate(record.id, name);
+    }
+  };
+
+  return (
+    <Dialog isOpen={visible} title={title} onClose={onCancel}>
+      {modalType === "delete" ? (
+        <S.FormWrapper>
+          <div className="message">
+            <p>This Webhook cannot be recovered once it’s deleted.</p>
+          </div>
+          <div className="btns">
+            <Button onClick={onCancel}>Cancel</Button>
+            <Button intent={Intent.PRIMARY} onClick={() => onDelete(record.id)}>
+              Confirm
+            </Button>
+          </div>
+        </S.FormWrapper>
+      ) : (
+        <S.FormWrapper>
+          <div className="form">
+            <h2>Webhook Name *</h2>
+            <p>
+              Give your Webhook a unique name to help you identify it in the
+              future.
+            </p>
+            <input

Review Comment:
   Set an inlined style of `width: 100%` so the input stretches to the width of the Modal Dialog. Although the vanilla `<input />` tag will be sufficient for now, you may want to consider using the `InputGroup` component from BlueprintJS core (see our other form inputs). 
   
   `Before`
   <img width="547" alt="Screen Shot 2022-09-08 at 11 36 17 PM" src="https://user-images.githubusercontent.com/1742233/189266727-ceb2400f-9f82-4fb6-9a5d-d1cee1a2d8ee.png">
   
   `After`
   <img width="526" alt="Screen Shot 2022-09-08 at 11 36 32 PM" src="https://user-images.githubusercontent.com/1742233/189266752-7178550a-9bc9-4b6a-aa8f-be2ad4b1e2f9.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971626885


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);
+  const [operating, setOperating] = useState(false);

Review Comment:
   I think operating includes save, update and delete operations, isSaving cannot express this meaning.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966587468


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit
+                      onClick={() =>
+                        handleShowModal("edit", { id: 1, name: "CI-webhook-1" })
+                      }
+                    />
+                    <Delete
+                      onClick={() =>
+                        handleShowModal("delete", {
+                          id: 1,
+                          name: "CI-webhook-1",
+                        })
+                      }
+                    />
+                  </li>
+                </S.Grid>
+                <S.Grid>
+                  <li>2</li>
+                  <li>My Webhook</li>
+                  <li>
+                    <Edit />
+                    <Delete />
+                  </li>
+                </S.Grid>
+                <S.Grid>
+                  <li>3</li>
+                  <li>Webhook Test</li>
+                  <li>
+                    <Edit />
+                    <Delete />
+                  </li>
+                </S.Grid>
+              </S.Wrapper>
+            </S.Container>
+          </div>
+        </div>
+      </Content>
+      <FormModal

Review Comment:
   (Update signature after refactoring `FormModal` to `WebhookFormModal`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971628197


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);

Review Comment:
   I think loading is the context provided to the page, isFetching cannot express the loading of elements on the page.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1241430848

   @mintsweet  Some overall feedback in regards to coding standards. We have a **no-semicolon** rule in place and prefer _Single_ quotes over double (with the exception of the ASF Header Notices containing double quotes). Please re-format all JS(X) files so that no semi-colons are used and replace double quotes with single quotes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966585142


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";

Review Comment:
   ```suggestion
   import { ReactComponent as WebHookProviderIcon } from "@/images/integrations/webhook.svg";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966583800


##########
config-ui/src/images/icons/setting-con.svg:
##########
@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none"

Review Comment:
   This SVG needs to be made responsive, set `width="100"` and `height="100"`



##########
config-ui/src/images/icons/delete.svg:
##########
@@ -0,0 +1,7 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none"

Review Comment:
   This SVG needs to be made responsive, set `width="100"` and `height="100"`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966572593


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({

Review Comment:
   Let's refactor this to `WebhookFormModal` and relocate file to `@/components/WebhookModalForm.jsx`
   
   ```suggestion
   export const WebhookFormModal = ({
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967055212


##########
config-ui/src/images/icons/setting-con.svg:
##########
@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none"

Review Comment:
   When you import the react SVG as Component, give it a `width` and `height` property. 
   
   ```
   <EditIcon width={16} height={16} />
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966724766


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({
+  visible,
+  modalType,
+  record,
+  onCancel,
+  onCreate,
+  onUpdate,
+  onDelete,
+}) => {
+  const [name, setName] = useState("");
+  const [error, setError] = useState("");
+
+  const title = useMemo(() => {
+    switch (modalType) {
+      case "add":
+        return "Add a New Webhook";
+      case "edit":
+        return "Edit Webhook";
+      case "delete":
+        return "Delete this Webhook? ";
+    }
+  }, [modalType]);
+
+  useEffect(() => {
+    setName(record?.name);
+  }, [record]);
+
+  const handleInputChange = (e) => {
+    setName(e.target.value);
+    setError("");
+  };
+
+  const handleSubmit = () => {
+    if (!name) {
+      setError("Name is required");
+      return;
+    }
+
+    if (modalType === "add") {
+      onCreate(name);
+    } else if (modalType === "edit") {
+      onUpdate(record.id, name);
+    }
+  };
+
+  return (
+    <Dialog isOpen={visible} title={title} onClose={onCancel}>
+      {modalType === "delete" ? (
+        <S.FormWrapper>
+          <div className="message">
+            <p>This Webhook cannot be recovered once it’s deleted.</p>
+          </div>
+          <div className="btns">
+            <Button onClick={onCancel}>Cancel</Button>
+            <Button intent={Intent.PRIMARY} onClick={() => onDelete(record.id)}>
+              Confirm
+            </Button>
+          </div>
+        </S.FormWrapper>
+      ) : (
+        <S.FormWrapper>
+          <div className="form">
+            <h2>Webhook Name *</h2>
+            <p>
+              Give your Webhook a unique name to help you identify it in the
+              future.
+            </p>
+            <input

Review Comment:
   The design does not seem to fill the input



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1241051237

   @mintsweet Thanks for taking on the DORA Webhook Feature PR. I understand that this is in `Draft` and still being worked on, however I'll be leaving some feedback early in the process to get this PR more refined.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971034168


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);
+  const [operating, setOperating] = useState(false);

Review Comment:
   Can we refactor this to `isSaving` to be consistent with the save flags used in other hook services? You may alias it to `operating` or another preferred alias when the hook is implemented.
   ```suggestion
     const [isSaving, setIsSaving] = useState(false);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mappjzc commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mappjzc commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1240809297

   Thank you for your pull request.
   @e2corporation please review this pull request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966723022


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   This is not consistent with the design, the icon is too small.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966587232


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   Instead of using these SVG's directly as actionable triggers, the SVG should be used as an **Icon** for a minimal style **Button** component. The Icons are also a bit large in their current form (see previous comments about making SVGs responsive). After making the SVG icons responsive, these need to be changed to use **Button** component Instead. You can look at the Data Grid on other areas such as the Data Integrations table to see similar examples for action icons.
   
   
   
   `Before`
   <img width="920" alt="Screen Shot 2022-09-08 at 11 02 42 PM" src="https://user-images.githubusercontent.com/1742233/189265021-71b9aa4b-d7dd-47fd-886c-d2598a9f5201.png">
   
   `After` using **Button** + Custom SVG Icon
   <img width="926" alt="Screen Shot 2022-09-08 at 11 15 32 PM" src="https://user-images.githubusercontent.com/1742233/189265055-8310d759-7257-4964-b295-b0e40cc1e4da.png">
   
   ```
   <Button intent={Intent.PRIMARY} icon={<EditIcon width={16} height={16} />} onClick={() => {}} minimal small />
   <Button intent={Intent.PRIMARY} icon={<DeleteIcon width={16} height={16} />} onClick={() => {}} minimal small />
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1253126479

   > @e2corporation Hi, Julien, this PR is completely ready.
   
   @mintsweet Thanks for the updates, I'm going to merge for now. These files will probably get touched again after my ESLint PR Changes are applied.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1252681537

   @mintsweet Hello Junren, I'd like to get this PR merged next, are you able to rebase & update this PR if ready? Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971034168


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);
+  const [operating, setOperating] = useState(false);

Review Comment:
   Can we refactor this to `isFetching` to be consistent with the fetch flags used in other hook services? You may alias it to `operating` or another preferred alias when the hook is implemented.
   ```suggestion
     const [isFetching, setIsFetching] = useState(false);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966573294


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";

Review Comment:
   Update `import` name and location after Refactoring `FormModal` to `WebhookFormModal`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967117515


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*

Review Comment:
   Ideally this will get migrated to `@/components` or `@/components/webhooks` in the future for better separation and accessibility. For now its ok to keep the child component here, though it should be renamed to `FormModal.jsx` to match the component function signature.
   
   Only _Page_ level components are using lowercase alpha-numeric filenames.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966694793


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({

Review Comment:
   I think the form modal is a component of this directory, not a common component.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967055749


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   @mintsweet The design is a template reference, you should follow what's built in the system. Not everything is properly scaled on the designs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966582837


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";

Review Comment:
   ```suggestion
   import { ReactComponent as DeleteIcon } from "@/images/icons/delete.svg";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1241615337

   @e2corporation thanks for your comments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966572593


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({

Review Comment:
   Let's refactor this to `WebhookFormModal` and relocate file to `@/components/WebhookModalForm.jsx'
   
   ```suggestion
   export const WebhookFormModal = ({
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1253123117

   @e2corporation Hi, Julien, this PR is completely ready.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#issuecomment-1241441410

   @mintsweet The default `iProvider` style width is not ideal for the "Webhook/Issue..." label and causes rendering bug. Use an inline style override to increase the default width of `96px` to `130px`
   
   `(Default 96px)`
   <img width="786" alt="Screen Shot 2022-09-08 at 10 54 55 PM" src="https://user-images.githubusercontent.com/1742233/189262793-3efa6da5-d665-4ec2-956c-b392e66a023c.png">
   
   `(Modified 130px)`
   
   <img width="1053" alt="Screen Shot 2022-09-08 at 10 56 53 PM" src="https://user-images.githubusercontent.com/1742233/189262827-a0e5dd5a-0c1b-47eb-8905-b86ac87595b2.png">
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966572762


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";

Review Comment:
   Alias as `CopyIcon` since this is an image asset.
   ```suggestion
   import { ReactComponent as CopyIcon } from "@/images/icons/copy.svg";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967055749


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   @mintsweet The design is a template reference, you should follow what's built in the system. Not everything is properly scaled on the designs. The raw icons in your version is too large.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967080064


##########
config-ui/src/images/icons/setting-con.svg:
##########
@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none"

Review Comment:
   `color` and `fill` and `stroke` props can be used to override color as well when needed in other scenarios.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971036955


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);

Review Comment:
   ```suggestion
     const [isFetching, setIsFetching] = useState(false);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r967090179


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   updating 16px to 18px would be a bit better width={18} height={18}



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r971034168


##########
config-ui/src/hooks/useWebhookManager.jsx:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import { useState, useEffect } from "react";
+
+import request from "@/utils/request";
+import { DEVLAKE_ENDPOINT } from "@/utils/config";
+
+export const useWebhookManager = () => {
+  const [loading, setLoading] = useState(false);
+  const [operating, setOperating] = useState(false);

Review Comment:
   Can we refactor this to `isSaving` to be consistent with the fetch flags used in other hook services? You may alias it to `operating` or another preferred alias when the hook is implemented.
   ```suggestion
     const [isSaving, setIsSaving] = useState(false);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966583884


##########
config-ui/src/images/icons/copy.svg:
##########
@@ -0,0 +1,13 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none"

Review Comment:
   This SVG needs to be made responsive, set `width="100"` and `height="100"`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966722312


##########
config-ui/src/images/icons/setting-con.svg:
##########
@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none"

Review Comment:
   I don't quite understand how to make it responsive after setting the width and height?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966792810


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from "@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {
+      setRecord(r);
+    }
+  };
+
+  const handleHideModal = () => {
+    setVisible(false);
+    setModalType("add");
+    setRecord();
+  };
+
+  const handleAddWebhook = (name) => {
+    console.log(name);
+    handleHideModal();
+  };
+
+  const handleEditWebhook = (id, name) => {
+    console.log(id, name);
+    handleHideModal();
+  };
+
+  const handleDeleteWebhook = (id) => {
+    console.log(id);
+    handleHideModal();
+  };
+
+  return (
+    <div className="container">
+      <Nav />
+      <Sidebar />
+      <Content>
+        <div className="main">
+          <AppCrumbs
+            items={[
+              { href: "/", icon: false, text: "Dashboard" },
+              // use /connections replace here
+              { href: "/integrations", icon: false, text: "Integrations" },
+              {
+                href: `/connections/webhook`,
+                icon: false,
+                text: "WebHook",
+                current: true,
+              },
+            ]}
+          />
+          <div className="headlineContainer">
+            <div
+              style={{
+                display: "flex",
+                alignItems: "center",
+                justifyContent: "space-between",
+                marginBottom: 12,
+              }}
+            >
+              <div style={{ display: "flex", alignItems: "center" }}>
+                <WebHookProvider
+                  className="providerIconSvg"
+                  width="30"
+                  height="30"
+                />
+                <h1 style={{ margin: "0 0 0 8px" }}>WebHook</h1>
+              </div>
+              <Link style={{ color: "#777777" }} to="/integrations">
+                <Icon icon="undo" size={16} /> Go Back
+              </Link>
+            </div>
+            <div className="page-description">
+              Use Webhooks to define Incidents and Deployments for your CI tools
+              if they are not listed in Data Sources.
+            </div>
+          </div>
+          <div className="manageProvider">
+            <S.Container>
+              <span>
+                <Button
+                  intent="primary"
+                  text="Add Webhook"
+                  onClick={() => handleShowModal("add")}
+                />
+              </span>
+              <S.Wrapper>
+                <S.Grid className="title">
+                  <li>ID</li>
+                  <li>Webhook Name</li>
+                  <li></li>
+                </S.Grid>
+                <S.Grid>
+                  <li>1</li>
+                  <li>CI-webhook-1</li>
+                  <li>
+                    <Edit

Review Comment:
   @yumengwang03 What are your two cents?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3017: feat(config-ui): added a data integration webhook

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966791129


##########
config-ui/src/pages/connections/webhook/form-modal.jsx:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect, useMemo } from "react";
+import { Dialog, Button, Toaster, Position, Intent } from "@blueprintjs/core";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+
+import { ReactComponent as Copy } from "@/images/icons/copy.svg";
+import * as S from "./styled";
+
+const CopyToaster = Toaster.create({
+  position: Position.TOP_RIGHT,
+});
+
+export const FormModal = ({
+  visible,
+  modalType,
+  record,
+  onCancel,
+  onCreate,
+  onUpdate,
+  onDelete,
+}) => {
+  const [name, setName] = useState("");
+  const [error, setError] = useState("");
+
+  const title = useMemo(() => {
+    switch (modalType) {
+      case "add":
+        return "Add a New Webhook";
+      case "edit":
+        return "Edit Webhook";
+      case "delete":
+        return "Delete this Webhook? ";
+    }
+  }, [modalType]);
+
+  useEffect(() => {
+    setName(record?.name);
+  }, [record]);
+
+  const handleInputChange = (e) => {
+    setName(e.target.value);
+    setError("");
+  };
+
+  const handleSubmit = () => {
+    if (!name) {
+      setError("Name is required");
+      return;
+    }
+
+    if (modalType === "add") {
+      onCreate(name);
+    } else if (modalType === "edit") {
+      onUpdate(record.id, name);
+    }
+  };
+
+  return (
+    <Dialog isOpen={visible} title={title} onClose={onCancel}>
+      {modalType === "delete" ? (
+        <S.FormWrapper>
+          <div className="message">
+            <p>This Webhook cannot be recovered once it’s deleted.</p>
+          </div>
+          <div className="btns">
+            <Button onClick={onCancel}>Cancel</Button>
+            <Button intent={Intent.PRIMARY} onClick={() => onDelete(record.id)}>
+              Confirm
+            </Button>
+          </div>
+        </S.FormWrapper>
+      ) : (
+        <S.FormWrapper>
+          <div className="form">
+            <h2>Webhook Name *</h2>
+            <p>
+              Give your Webhook a unique name to help you identify it in the
+              future.
+            </p>
+            <input

Review Comment:
   @mintsweet I would prefer the stretched input personally. Is it your intention to make it unstretched @yumengwang03 ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org