Skip to content

Commit

Permalink
Merge pull request #23 from erigontech/peername
Browse files Browse the repository at this point in the history
display peername, small fixes
  • Loading branch information
dvovk authored Oct 2, 2024
2 parents 68ae16e + d8e8e06 commit dd8cbf6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/app/components/PeersStatistics/PeerDetailsPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const PeerDetailsPopup = ({ peerId, onClose, ...props }: PeerDetailsPopup
<thead></thead>
<tbody>
{renderMainInfoRow("ID", peer.id)}
{renderMainInfoRow("Name", peer.name)}
{renderMainInfoRow("protocols", peer.protocols)}
{renderMainInfoRow("enr", peer.enr)}
{renderMainInfoRow("Enode", peer.enode)}
Expand Down Expand Up @@ -128,9 +129,9 @@ export const PeerDetailsPopup = ({ peerId, onClose, ...props }: PeerDetailsPopup
return (
<>
<div className="justify-center items-center flex overflow-x-hidden overflow-y-auto inset-0 z-50 outline-none focus:outline-none absolute bg-black/[.4]">
<div className="relative w-auto my-6 mx-auto max-w-3xl">
<div className="">
{/*content*/}
<div className="border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none items-center">
<div className="border-0 rounded-lg shadow-lg relative flex flex-col w-max bg-white outline-none focus:outline-none items-center">
{/*header*/}
<h3 className="text-3xl font-semibold mt-5">Peer Details</h3>
{/*body*/}
Expand Down
20 changes: 19 additions & 1 deletion src/app/components/PeersStatistics/PeerDetailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import SortIcon from "@mui/icons-material/Sort";

enum SortColumn {
Id = "Id",
Name = "Name",
Type = "Type",
Status = "Status",
TotalIn = "TotalIn",
Expand Down Expand Up @@ -41,6 +42,8 @@ export const PeersDetailsTable = ({ peers, onPeerClicked }: PeersDetailsTablePro
let sortedPeers = prs.sort((a, b) => {
if (sotOpt.column === SortColumn.Id) {
return compareStrings(a.id, b.id, sotOpt.descending);
} else if (sotOpt.column === SortColumn.Name) {
return compareStrings(a.name, b.name, sotOpt.descending);
} else if (sotOpt.column === SortColumn.Type) {
return compareStrings(a.type, b.type, sotOpt.descending);
} else if (sotOpt.column === SortColumn.Status) {
Expand Down Expand Up @@ -100,7 +103,7 @@ export const PeersDetailsTable = ({ peers, onPeerClicked }: PeersDetailsTablePro

return (
<div className="flex flex-col shadow-lg rounded-md p-2 bg-white min-h-[40px] max-h-[83vh] w-full overflow-auto">
<table className="table-fixed text-left w-full">
<table className="table-auto text-left w-full">
<thead>
<tr className="border-b">
<th
Expand All @@ -117,6 +120,20 @@ export const PeersDetailsTable = ({ peers, onPeerClicked }: PeersDetailsTablePro
{getArrowIcon(SortColumn.Id)}
</div>
</th>
<th
className="px-4 py-2 cursor-pointer"
onClick={() => {
sortPeers(visiblePeers, {
column: SortColumn.Name,
descending: !currentSortState.descending
});
}}
>
<div className="flex flex-row">
peer Name
{getArrowIcon(SortColumn.Name)}
</div>
</th>
<th
className="px-4 py-2 cursor-pointer"
onClick={() => {
Expand Down Expand Up @@ -214,6 +231,7 @@ export const PeersDetailsTable = ({ peers, onPeerClicked }: PeersDetailsTablePro
}}
>
<td className="px-4 py-2 overflow-hidden text-ellipsis">{peer.id}</td>
<td className="px-4 py-2 overflow-hidden text-ellipsis">{peer.name}</td>
<td className="px-4 py-2 overflow-hidden text-ellipsis">{getPeerType(peer)}</td>
<td className="px-4 py-2 overflow-hidden text-ellipsis">{peer.active ? "active" : ""}</td>
<td className="px-4 py-2 overflow-hidden text-ellipsis">{multipleBytes(peer.network.bytesIn)}</td>
Expand Down

0 comments on commit dd8cbf6

Please sign in to comment.