mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-05 20:41:43 -07:00
Merge pull request #46 from timothyle97/feat-update_online_parsing
Update Peer Online/Offline Parsing and Add Peer Data
This commit is contained in:
commit
504ce7f4b1
2 changed files with 48 additions and 13 deletions
|
@ -37,13 +37,21 @@ async function getMemberAdditionalData(data) {
|
|||
let peerData = {};
|
||||
if (peer) {
|
||||
peerData.latency = peer.latency;
|
||||
peerData.online = peer.latency !== -1;
|
||||
if (peer.latency !== -1)
|
||||
peerData.online = 1;
|
||||
if (peer.latency == -1)
|
||||
peerData.online = 2;
|
||||
peerData.clientVersion = peer.version;
|
||||
if (peer.paths[0]) {
|
||||
peerData.lastOnline = peer.paths[0].lastReceive;
|
||||
peerData.physicalAddress = peer.paths[0].address.split("/")[0];
|
||||
peerData.physicalPort = peer.paths[0].address.split("/")[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
peerData.online = 0;
|
||||
}
|
||||
|
||||
delete data.lastAuthorizedCredential;
|
||||
delete data.lastAuthorizedCredentialType;
|
||||
|
|
|
@ -101,19 +101,46 @@ function NetworkMembers({ network }) {
|
|||
name: "Peer status",
|
||||
minWidth: "100px",
|
||||
cell: (row) =>
|
||||
row.online ? (
|
||||
<Typography style={{ color: "#008000" }}>
|
||||
{"ONLINE (v" +
|
||||
row.config.vMajor +
|
||||
"." +
|
||||
row.config.vMinor +
|
||||
"." +
|
||||
row.config.vRev +
|
||||
")"}
|
||||
</Typography>
|
||||
) : (
|
||||
(row.online === 0) ? (
|
||||
<Typography color="error">OFFLINE</Typography>
|
||||
),
|
||||
) : ( (row.online === 1) ? (
|
||||
|
||||
<Typography style={{ color: "#008000" }}>
|
||||
{"ONLINE (v" +
|
||||
row.config.vMajor +
|
||||
"." +
|
||||
row.config.vMinor +
|
||||
"." +
|
||||
row.config.vRev +
|
||||
")"}
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography style={{ color: "#f1c232" }}>
|
||||
{"RELAYED (v" +
|
||||
row.config.vMajor +
|
||||
"." +
|
||||
row.config.vMinor +
|
||||
"." +
|
||||
row.config.vRev +
|
||||
")"}
|
||||
</Typography>
|
||||
)),
|
||||
},
|
||||
{
|
||||
id: "physicalip",
|
||||
name: "Physical IP / Latency",
|
||||
minWidth: "220px",
|
||||
cell: (row) =>
|
||||
(row.online === 1) ? (
|
||||
<p>
|
||||
{row.physicalAddress +
|
||||
"/" +
|
||||
row.physicalPort}<br />{
|
||||
"(" +
|
||||
row.latency +
|
||||
" ms)"}
|
||||
</p>
|
||||
) : (""),
|
||||
},
|
||||
{
|
||||
id: "delete",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue