Update loading list log

This commit is contained in:
nguyentrungthat 2026-01-08 13:37:26 +07:00
parent 0650e012d8
commit 9bc0f96afc
3 changed files with 88 additions and 70 deletions

View File

@ -8,8 +8,8 @@ import axios from 'axios'
import moment from 'moment' import moment from 'moment'
const mailTo = 'andrew.ng@apactech.io' const mailTo = 'andrew.ng@apactech.io'
// const mailCC = ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io'] const mailCC = ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io']
const mailCC = '' // const mailCC = ''
type DetectAI = { type DetectAI = {
status: string[] status: string[]

View File

@ -294,8 +294,8 @@ export class WebSocketIo {
.map((f) => 'storage/system_logs/' + f) .map((f) => 'storage/system_logs/' + f)
io.to(socket.id).emit('list_logs', getListSystemLogs) io.to(socket.id).emit('list_logs', getListSystemLogs)
const listHistory = await this.getHistory(data?.stationId, data?.lineId) // const listHistory = await this.getHistory(data?.stationId, data?.lineId)
io.to(socket.id).emit('list_histories', listHistory) // io.to(socket.id).emit('list_histories', listHistory)
}) })
socket.on('get_content_log', async (data) => { socket.on('get_content_log', async (data) => {

View File

@ -9,6 +9,7 @@ import {
ScrollArea, ScrollArea,
Tooltip, Tooltip,
TextInput, TextInput,
Loader,
} from "@mantine/core"; } from "@mantine/core";
import { DateInput } from "@mantine/dates"; import { DateInput } from "@mantine/dates";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@ -41,7 +42,7 @@ function DrawerLogs({
const [systemLogs, setSystemLogs] = useState<ISystemLog[]>([]); const [systemLogs, setSystemLogs] = useState<ISystemLog[]>([]);
const [isDownloadLog, setIsDownloadLog] = useState(false); const [isDownloadLog, setIsDownloadLog] = useState(false);
// const [testLogContent, setTestLogContent] = useState(""); // const [testLogContent, setTestLogContent] = useState("");
// const [isLogModalOpen, setIsLogModalOpen] = useState(false); const [loading, setLoading] = useState(true);
const [downloadName, setDownloadName] = useState(""); const [downloadName, setDownloadName] = useState("");
const [searchFileName, setSearchFileName] = useState(""); const [searchFileName, setSearchFileName] = useState("");
const [fromDate, setFromDate] = useState<Date | null>(null); const [fromDate, setFromDate] = useState<Date | null>(null);
@ -67,6 +68,9 @@ function DrawerLogs({
path: file, path: file,
}; };
}); });
setTimeout(() => {
setLoading(false);
}, 1000);
setSystemLogs( setSystemLogs(
list.sort( list.sort(
(a: ISystemLog, b: ISystemLog) => (a: ISystemLog, b: ISystemLog) =>
@ -211,6 +215,19 @@ function DrawerLogs({
</Grid> </Grid>
</Box> </Box>
<ScrollArea h={"85vh"} style={{ marginTop: "15px" }}> <ScrollArea h={"85vh"} style={{ marginTop: "15px" }}>
{loading ? (
<Box
style={{
height: "10vh",
width: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<Loader color="blue" />
</Box>
) : (
<Table <Table
stickyHeader stickyHeader
striped striped
@ -280,6 +297,7 @@ function DrawerLogs({
))} ))}
</Table.Tbody> </Table.Tbody>
</Table> </Table>
)}
</ScrollArea> </ScrollArea>
</Grid.Col> </Grid.Col>
</Grid> </Grid>