Skip to content

Commit

Permalink
feat: add current mode to large network page
Browse files Browse the repository at this point in the history
  • Loading branch information
PudgyPug authored and afostr committed Jul 24, 2024
1 parent 1887784 commit 78a2fe3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions public/large-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
this.networkStatus.processed = report.totalProcessed
this.networkStatus.rejected = report.totalRejected
this.networkStatus.rejectedTps = report.rejectedTps
this.networkStatus.mode = report.mode
this.networkStatus.active = Object.keys(G.nodes.active).length - crashedCount
this.networkStatus.syncing = Object.keys(G.nodes.syncing).length
this.networkStatus.joining = Object.keys(report.nodes.joining).length
Expand Down Expand Up @@ -554,6 +555,18 @@
console.log(nodeId, node)
}
},
getModeEmoji(networkMode){
switch (networkMode) {
case 'forming': return ' 🟡'
case 'processing': return ' 🟢'
case 'safety': return ' ⚠️'
case 'recovery': return ' ♻️'
case 'restart': return ' 🔄'
case 'restore': return ' 🔵'
case 'shutdown': return ' 🔴'
default: return ''
}
},

changeNodesSize() {
const nodeSize = this.getNodeSize(Object.keys(G.nodes.active).length)
Expand Down
6 changes: 5 additions & 1 deletion views/large-network.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
<tr id="itemrow">
<td id="monheader">NETWORK</td>
</tr>
<tr id="itemrow">
<td id="monlabel">Mode:</td>
<td id="monval" style="text-transform: capitalize;">{{(networkStatus.mode ?? '') + getModeEmoji(networkStatus.mode)}}</td>
</tr>
<tr id="itemrow">
<td id="monlabel">Counter:</td>
<td id="monval">{{networkStatus.counter}}</td>
Expand Down Expand Up @@ -357,4 +361,4 @@
<script src="version.js"></script>
</body>

</html>
</html>

0 comments on commit 78a2fe3

Please sign in to comment.