File tree Expand file tree Collapse file tree 3 files changed +31
-21
lines changed
pages/NodeManage/compoments Expand file tree Collapse file tree 3 files changed +31
-21
lines changed Original file line number Diff line number Diff line change 11import axios from '@/utils/axios' ;
2+ import type { ResponseData , TableResponseData } from '@/utils/commonTypes' ;
23import 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
6756export {
Original file line number Diff line number Diff 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+
2732export type {
2833 QueryPalmNodeParams ,
2934 TPostNodesDownloadDataRunRequest ,
3035 NetworkPingTableProp ,
36+ PostHostAliveDetectionRunRequest ,
3137} ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import NetWorkIcon from '../Icon/NetWorkIcon';
77import { Button , Input , Tooltip } from 'antd' ;
88import { postHostAliveDetectionRun } from '@/apis/NodeManageApi' ;
99import { useSafeState } from 'ahooks' ;
10+ import type { CreateTableProps } from '@/compoments/WizardTable/types' ;
11+ import type { PostHostAliveDetectionRunRequest } from '@/apis/NodeManageApi/type' ;
1012
1113const 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 ,
You can’t perform that action at this time.
0 commit comments