Skip to content
Snippets Groups Projects
Commit 9e619ccd authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[add] show disconnected prefered/privileged

parent ecda5933
Branches
No related tags found
No related merge requests found
...@@ -4,8 +4,23 @@ module.exports = ($scope, Webmin, heads, info, conf, ws) => { ...@@ -4,8 +4,23 @@ module.exports = ($scope, Webmin, heads, info, conf, ws) => {
const SPECIFIC_SUFFIX = '--------' const SPECIFIC_SUFFIX = '--------'
const UNKNOWN_VALUE = '-' const UNKNOWN_VALUE = '-'
$scope.computeDisconnectedPreferedPrivileged = (info) => {
const connected = info.connections.level1
.concat(info.connections.level2)
.map(c => c.pubkey)
const disconnected = [];
(conf.preferedNodes || []).concat(conf.privilegedNodes || []).forEach(pubkey => {
if (connected.indexOf(pubkey) === -1 && disconnected.indexOf(pubkey) === -1) {
disconnected.push(pubkey)
}
})
return disconnected.map(pubkey => ({ pubkey }))
}
$scope.discriminateNodes = (info) => { $scope.discriminateNodes = (info) => {
info.connections.level1.concat(info.connections.level2).forEach(c => { info.connections.disconnected = $scope.computeDisconnectedPreferedPrivileged(info)
info.connections.level1
.concat(info.connections.level2)
.concat(info.connections.disconnected).forEach(c => {
c.prefered = (conf.preferedNodes || []).indexOf(c.pubkey) !== -1 c.prefered = (conf.preferedNodes || []).indexOf(c.pubkey) !== -1
c.privileged = (conf.privilegedNodes || []).indexOf(c.pubkey) !== -1 c.privileged = (conf.privilegedNodes || []).indexOf(c.pubkey) !== -1
}) })
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
td {{ peer.uid }} td {{ peer.uid }}
td INCOMING td INCOMING
td {{ peer.handle }} td {{ peer.handle }}
tr(ng-repeat="peer in info.connections.disconnected track by $index" ng-class="{ privileged: peer.privileged, prefered: peer.prefered }")
td {{ peer.pubkey.slice(0, 20) }}
td -
td -
td DISCONNECTED
td -
.legend .legend
h5(translate="home.tabs.connections.legend.title") h5(translate="home.tabs.connections.legend.title")
span.prefered(translate="home.tabs.connections.legend.prefered") span.prefered(translate="home.tabs.connections.legend.prefered")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment