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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
