feat: online / offline badge and reporter ticker
This commit is contained in:
parent
0dc90012ed
commit
e48f8f5fc0
@ -57,7 +57,6 @@ func main() {
|
|||||||
ticker := time.Tick(time.Duration(interval) * time.Second)
|
ticker := time.Tick(time.Duration(interval) * time.Second)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
<-ticker
|
|
||||||
log.Println("Send report data to:", parsedURL.String())
|
log.Println("Send report data to:", parsedURL.String())
|
||||||
sendUDPTestPack(*parsedURL, ReportData{
|
sendUDPTestPack(*parsedURL, ReportData{
|
||||||
WorkspaceId: *WorkspaceId,
|
WorkspaceId: *WorkspaceId,
|
||||||
@ -66,6 +65,8 @@ func main() {
|
|||||||
Timeout: interval * 2,
|
Timeout: interval * 2,
|
||||||
Payload: utils.GetReportDataPaylod(interval, *IsVnstat),
|
Payload: utils.GetReportDataPaylod(interval, *IsVnstat),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
<-ticker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { Button, Form, Input, Modal, Table } from 'antd';
|
import { Badge, Button, Form, Input, Modal, Table } from 'antd';
|
||||||
import { ColumnsType } from 'antd/es/table';
|
import { ColumnsType } from 'antd/es/table';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import { ServerStatusInfo } from '../../types';
|
import { ServerStatusInfo } from '../../types';
|
||||||
@ -67,9 +67,11 @@ export const ServerList: React.FC = React.memo(() => {
|
|||||||
key: 'status',
|
key: 'status',
|
||||||
title: 'Status',
|
title: 'Status',
|
||||||
render: (val, record) => {
|
render: (val, record) => {
|
||||||
return Date.now() - (record.updatedAt + record.timeout) < 0
|
return Date.now() - (record.updatedAt + record.timeout) < 0 ? (
|
||||||
? 'online'
|
<Badge status="success" text="online" />
|
||||||
: 'offline';
|
) : (
|
||||||
|
<Badge status="error" text="offline" />
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user