// Copyright (C) 2019 Intel Corporation. All rights reserved. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception import { Descriptions, DatePicker, Card, Space, Button, Badge, Divider, Row, Statistic, Col, Modal, Form, Input, message, Upload, UploadFile } from "antd"; import { useEffect, useState } from "react"; import moment from "moment"; import "antd/dist/antd.css"; import { UploadOutlined } from "@ant-design/icons"; import type { DatePickerProps, RangePickerProps } from "antd/es/date-picker"; const { TextArea } = Input; interface DataType { id: number; branch: string; build_args: string; start_time: string; end_time: string; status: string; repo: string; data: any; wamr_commit: string; fuzz_time: number; end_error: number; error: number; } interface select_uuid { res: Array; setId: any; setResult: any; } const normFile = (e: any) => { console.log("Upload event:", e); if (Array.isArray(e)) { return e; } return e?.fileList; }; const Description = ({ res, setId, setResult }: select_uuid) => { // const formRef = react const range = (start: number, end: number) => { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; }; const [modalVisible, setModalVisible] = useState(false); const [modal2Visible, setModal2Visible] = useState(false); const [form] = Form.useForm(); // const [fileList, setFileList] = useState([]); const disabledDate: RangePickerProps["disabledDate"] = (current) => { return current && current < moment().subtract(1, "day").endOf("day"); }; // let fileList: UploadFile[] = []; var fileList: Array = []; const new_fuzzing = (repo: string, branch: string, fuzz_time: number, build_args: string) => { fetch(import.meta.env.VITE_SERVER_URL + "/new_fuzzing", { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify({ repo: repo, branch: branch, fuzz_time: fuzz_time, build_args: build_args }) }) .then((res) => { return res.json(); }) .then((body) => { if (body.status === 0) { message.error(body.msg); } else { message.success("new fuzzing success"); } }); }; return ( <> <> { const fields_value = form.getFieldsValue(["repo", "branch", "end_time", "build_args"]); let repo = fields_value.repo; let branch = fields_value.branch; let fuzz_time = fields_value.end_time; const build_args = fields_value.build_args; if (repo !== "" || branch !== "") { repo = repo === undefined ? "https://github.com/bytecodealliance/wasm-micro-runtime.git" : repo; branch = branch === undefined ? "main" : branch; if (fuzz_time) { const this_time = Date.parse(new Date().toString()); fuzz_time = Date.parse(fuzz_time); if (fuzz_time > this_time) { fuzz_time = (fuzz_time - this_time) / 1000; } else { fuzz_time = 1; } } new_fuzzing(repo, branch, fuzz_time, build_args); setModalVisible(false); } else { message.error("please enter repo and branch"); } }} onCancel={() => { setModalVisible(false); }} >