display peer number in node tab

This commit is contained in:
Iuri Matias 2021-08-23 14:45:00 -04:00
parent 329d37e377
commit 067ed7b255
3 changed files with 45 additions and 2 deletions

View File

@ -30,7 +30,9 @@ proc init*(self: NodeController) =
self.view.setLastMessage($WalletSignal(e).blockNumber)
self.status.events.on(SignalType.DiscoverySummary.event) do(e:Args):
self.status.network.peerSummaryChange(DiscoverySummarySignal(e).enodes)
var data = DiscoverySummarySignal(e)
self.status.network.peerSummaryChange(data.enodes)
self.view.setPeerSize(data.enodes.len)
self.status.events.on(SignalType.Stats.event) do (e:Args):
self.view.setStats(StatsSignal(e).stats)

View File

@ -13,6 +13,7 @@ QtObject:
wakuBloomFilterMode*: bool
fullNode*: bool
stats*: Stats
peerSize: int
proc setup(self: NodeView) =
self.QObject.setup
@ -142,4 +143,19 @@ QtObject:
QtProperty[string] downloadRate:
read = downloadRate
notify = statsChanged
notify = statsChanged
proc getPeerSize*(self: NodeView): int {.slot.} = self.peerSize
proc peerSizeChanged*(self: NodeView, value: int) {.signal.}
proc setPeerSize*(self: NodeView, value: int) {.slot.} =
self.peerSize = value
self.peerSizeChanged(value)
proc resetPeers*(self: NodeView) {.slot.} =
self.setPeerSize(0)
QtProperty[int] peerSize:
read = getPeerSize
notify = peerSizeChanged

View File

@ -20,6 +20,31 @@ Item {
}
RowLayout {
id: peerContainer2
Layout.fillWidth: true
StyledText {
id: peerDescription
color: Style.current.lightBlueText
text: "Peers"
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
StyledText {
id: peerNumber
color: Style.current.lightBlueText
text: nodeModel.peerSize
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
font.weight: Font.Medium
font.pixelSize: 20
}
}
ColumnLayout {
id: messageContainer
Layout.fillHeight: true