-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e07f61a
commit e337e0e
Showing
4 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,65 @@ | ||
import Table from "common/Table"; | ||
import useTable from "common/useTable"; | ||
import React from "react"; | ||
import { ServerResponseType, ServerServiceNameType } from "./ServerType"; | ||
import { getCoreRowModel } from '@tanstack/react-table'; | ||
import { ServerResponseType, ServerServiceNameType, TCPData } from "./ServerType"; | ||
import { useVirtual } from "react-virtual"; | ||
|
||
interface ServerDetailServicesTabPanelTCPType { | ||
serverName: ServerServiceNameType; | ||
serverData: ServerResponseType; | ||
serverData: ServerResponseType<TCPData>; | ||
} | ||
|
||
export default function ServerDetailServicesTabPanelTCP( | ||
props: ServerDetailServicesTabPanelTCPType | ||
) { | ||
return <div></div>; | ||
const { | ||
serverData: { | ||
Message: { Data: {Ports } }, | ||
}, | ||
} = props; | ||
|
||
const data = Object.entries(Ports).map(([key, value]) => { | ||
return { | ||
Port: key, | ||
State: value, | ||
}; | ||
}) | ||
|
||
const tableInstance = useTable({ | ||
data, | ||
columns, | ||
getCoreRowModel: getCoreRowModel(), | ||
}); | ||
|
||
const tableContainerRef = React.useRef<HTMLDivElement>(null); | ||
|
||
const { rows } = tableInstance.getRowModel(); | ||
|
||
const rowVirtualizer = useVirtual({ | ||
parentRef: tableContainerRef, | ||
size: rows.length, | ||
overscan: 10, | ||
}); | ||
|
||
return ( | ||
<Table | ||
ref={tableContainerRef} | ||
variant='default' | ||
virtualization | ||
instance={tableInstance} | ||
virtualizationInstance={rowVirtualizer} | ||
/> | ||
); | ||
} | ||
|
||
const columns = [ | ||
{ | ||
header: 'Port', | ||
accessorKey: 'Port', | ||
}, | ||
{ | ||
header: 'State', | ||
accessorKey: 'State', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters