Skip to content

Commit 406e380

Browse files
committed
feat: 网络检测-展示table 数据
1 parent 7d63a1b commit 406e380

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

src/apis/NodeManageApi/index.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import axios from '@/utils/axios';
2+
import type { ResponseData, TableResponseData } from '@/utils/commonTypes';
23
import type {
3-
ResponseData,
4-
TableRequestParams,
5-
TableResponseData,
6-
} from '@/utils/commonTypes';
7-
import type {
4+
PostHostAliveDetectionRunRequest,
85
QueryPalmNodeParams,
96
TPostNodesDownloadDataRunRequest,
107
} from './type';
@@ -49,19 +46,11 @@ const postHostAliveDetectionRun = (data: {
4946
hosts: string;
5047
nodes_id: string[];
5148
}): Promise<
52-
ResponseData<
53-
TableRequestParams<{
54-
list: Array<{ node: 'string'; result: Array<string> }>;
55-
}>
56-
>
49+
ResponseData<TableResponseData<PostHostAliveDetectionRunRequest[]>>
5750
> =>
5851
axios.post<
5952
never,
60-
ResponseData<
61-
TableRequestParams<{
62-
list: Array<{ node: 'string'; result: Array<string> }>;
63-
}>
64-
>
53+
ResponseData<TableResponseData<PostHostAliveDetectionRunRequest[]>>
6554
>('/task/start/host-alive-detection/run', data);
6655

6756
export {

src/apis/NodeManageApi/type.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ interface NetworkPingTableProp {
2424
Ok: boolean;
2525
}
2626

27+
interface PostHostAliveDetectionRunRequest {
28+
node: 'string';
29+
result: Array<string>;
30+
}
31+
2732
export type {
2833
QueryPalmNodeParams,
2934
TPostNodesDownloadDataRunRequest,
3035
NetworkPingTableProp,
36+
PostHostAliveDetectionRunRequest,
3137
};

src/pages/NodeManage/compoments/NewWorkDetecitonDrawer.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import NetWorkIcon from '../Icon/NetWorkIcon';
77
import { Button, Input, Tooltip } from 'antd';
88
import { postHostAliveDetectionRun } from '@/apis/NodeManageApi';
99
import { useSafeState } from 'ahooks';
10+
import type { CreateTableProps } from '@/compoments/WizardTable/types';
11+
import type { PostHostAliveDetectionRunRequest } from '@/apis/NodeManageApi/type';
1012

1113
const NetWorkIconNode: FC<{ node_ids: Array<string> }> = ({ node_ids }) => {
1214
const newWorkDetecitonDrawerRef = useRef<UseDrawerRefType>(null);
@@ -45,6 +47,20 @@ const NewWorkDetecitonDrawer = forwardRef<UseDrawerRefType>(
4547
},
4648
}));
4749

50+
const columns: CreateTableProps<
51+
PostHostAliveDetectionRunRequest[]
52+
>['columns'] = [
53+
{
54+
dataIndex: 'node',
55+
title: '节点',
56+
},
57+
{
58+
dataIndex: 'result',
59+
title: '检测结果',
60+
render: (value) => (value.length > 0 ? value.join('\n') : '-'),
61+
},
62+
];
63+
4864
return (
4965
<WizardDrawer
5066
footer={null}
@@ -74,19 +90,18 @@ const NewWorkDetecitonDrawer = forwardRef<UseDrawerRefType>(
7490
</div>
7591
<WizardTable
7692
page={page}
77-
columns={[]}
78-
rowKey="aa"
93+
columns={columns}
94+
rowKey="node"
7995
request={async () => {
80-
// const data =
81-
await postHostAliveDetectionRun({
96+
const { data } = await postHostAliveDetectionRun({
8297
nodes_id: nodeIds,
8398
hosts,
8499
dns_timeout: 0.5,
85100
});
86101
return {
87-
list: [],
102+
list: data?.list ?? [],
88103
pagemeta: {
89-
limit: 10,
104+
limit: 1000,
90105
page: 1,
91106
total: 10,
92107
total_page: 1,

0 commit comments

Comments
 (0)