add webhook gitea

This commit is contained in:
joseph le 2023-09-20 16:15:27 +07:00
parent b72c9a51e1
commit ba039431ef
1 changed files with 20 additions and 1 deletions

View File

@ -54,6 +54,7 @@ import { WebLinksAddon } from "xterm-addon-web-links";
const TestDevice = ({ socket, user }) => { const TestDevice = ({ socket, user }) => {
const [isloading, setIsLoading] = useReducer((x) => x + 1, 0); const [isloading, setIsLoading] = useReducer((x) => x + 1, 0);
const [print, setPrint] = useState(false); const [print, setPrint] = useState(false);
// const [scanCheck, setScanCheck] = useState(false);
const [openHistory, setOpenHistory] = useState(false); const [openHistory, setOpenHistory] = useState(false);
const [listLastLogs, setlistLastLogs] = useState([]); const [listLastLogs, setlistLastLogs] = useState([]);
const [allStation, setAllStation] = useState([]); const [allStation, setAllStation] = useState([]);
@ -1157,8 +1158,17 @@ const TestDevice = ({ socket, user }) => {
}); });
socket?.on("sendListDeviceOn", (data) => { socket?.on("sendListDeviceOn", (data) => {
// console.log(data)
setListDeviceOn(data); setListDeviceOn(data);
// console.log(Date.now(), data);
// data.map((t) => {
// // if (listTestAuto.filter((item) => item.id === t.id).length === 0) {
// temp.push(t.infoLine);
// station_temp.push(t.station);
// listMode.push(t.mode);
// // setListTestAuto((listTestAuto) => [...listTestAuto, t])
// // }
// });
let temp = []; let temp = [];
let station_temp = []; let station_temp = [];
let listMode = []; let listMode = [];
@ -1192,6 +1202,8 @@ const TestDevice = ({ socket, user }) => {
created_by: user.username, created_by: user.username,
}); });
} }
// }, 5000);
// }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@ -1210,9 +1222,16 @@ const TestDevice = ({ socket, user }) => {
// if (data.type === "input") { // if (data.type === "input") {
setIsLoading(); setIsLoading();
// } // }
// if (data.type === "test") {
// getAllLastLog();
// }
// toast.success("update command")
}); });
}, [socket]); }, [socket]);
console.log(listTestAuto); console.log(listTestAuto);
// console.log(listDeviceOff);
//Update list line run //Update list line run
useEffect(() => { useEffect(() => {
let temp = []; let temp = [];