mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-07 05:21:40 -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 = {};
|
let peerData = {};
|
||||||
if (peer) {
|
if (peer) {
|
||||||
peerData.latency = peer.latency;
|
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;
|
peerData.clientVersion = peer.version;
|
||||||
if (peer.paths[0]) {
|
if (peer.paths[0]) {
|
||||||
peerData.lastOnline = peer.paths[0].lastReceive;
|
peerData.lastOnline = peer.paths[0].lastReceive;
|
||||||
peerData.physicalAddress = peer.paths[0].address.split("/")[0];
|
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.lastAuthorizedCredential;
|
||||||
delete data.lastAuthorizedCredentialType;
|
delete data.lastAuthorizedCredentialType;
|
||||||
|
|
|
@ -101,7 +101,10 @@ function NetworkMembers({ network }) {
|
||||||
name: "Peer status",
|
name: "Peer status",
|
||||||
minWidth: "100px",
|
minWidth: "100px",
|
||||||
cell: (row) =>
|
cell: (row) =>
|
||||||
row.online ? (
|
(row.online === 0) ? (
|
||||||
|
<Typography color="error">OFFLINE</Typography>
|
||||||
|
) : ( (row.online === 1) ? (
|
||||||
|
|
||||||
<Typography style={{ color: "#008000" }}>
|
<Typography style={{ color: "#008000" }}>
|
||||||
{"ONLINE (v" +
|
{"ONLINE (v" +
|
||||||
row.config.vMajor +
|
row.config.vMajor +
|
||||||
|
@ -112,8 +115,32 @@ function NetworkMembers({ network }) {
|
||||||
")"}
|
")"}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<Typography color="error">OFFLINE</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",
|
id: "delete",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue