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'
const mailTo = 'andrew.ng@apactech.io'
// const mailCC = ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io']
const mailCC = ''
const mailCC = ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io']
// const mailCC = ''
type DetectAI = {
status: string[]

View File

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

View File

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