diff --git a/app/js/controllers/main/home/tabs/HomeConnectionsController.js b/app/js/controllers/main/home/tabs/HomeConnectionsController.js index 1509e8c7dba3b6ee13438c575e36e069d8547f3a..2991c1bdc00e97128adbd391dbd4807d414671ce 100644 --- a/app/js/controllers/main/home/tabs/HomeConnectionsController.js +++ b/app/js/controllers/main/home/tabs/HomeConnectionsController.js @@ -1,7 +1,9 @@ "use strict"; module.exports = ($scope, Webmin, heads, info, conf, ws) => { - + + const SPECIFIC_SUFFIX = '--------' + const UNKNOWN_VALUE = '-' $scope.discriminateNodes = (info) => { info.connections.level1.concat(info.connections.level2).forEach(c => { c.prefered = (conf.preferedNodes || []).indexOf(c.pubkey) !== -1 @@ -15,6 +17,34 @@ module.exports = ($scope, Webmin, heads, info, conf, ws) => { const headsMap = {} + $scope.removeBlanks = (confPrefPriv, headsMap) => { + for (const pp of confPrefPriv) { + const ws2pFullId = pp + '-' + SPECIFIC_SUFFIX + if (headsMap[ws2pFullId]) { + delete headsMap[ws2pFullId] + } + } + } + + $scope.addBlanks = (confPrefPriv, headsMap) => { + const pubkeys = Object.keys(headsMap).map(k => k.split('-')[0]) + const unknown = confPrefPriv.filter(pub => !pubkeys.includes(pub)) + for (const pp of unknown) { + const ws2pFullId = pp + '-' + SPECIFIC_SUFFIX + headsMap[ws2pFullId] = { + api: UNKNOWN_VALUE, + blockstamp: UNKNOWN_VALUE, + uid: UNKNOWN_VALUE, + ws2pId: UNKNOWN_VALUE, + software: UNKNOWN_VALUE, + softVersion: UNKNOWN_VALUE, + prefix: UNKNOWN_VALUE, + freeRooms: UNKNOWN_VALUE, + step: UNKNOWN_VALUE + } + } + } + $scope.headsIntoMap = (heads) => { for (const value of heads) { const sp = value.message.split(':') @@ -48,6 +78,11 @@ module.exports = ($scope, Webmin, heads, info, conf, ws) => { api, blockstamp, uid, ws2pId, software, softVersion, prefix, freeRooms, step } } + + const confPreferedPrivileged = conf.preferedNodes.concat(conf.privilegedNodes) + $scope.removeBlanks(confPreferedPrivileged, headsMap) + $scope.addBlanks(confPreferedPrivileged, headsMap) + $scope.heads = Object.keys(headsMap).map(k => { const pubkey = k.split('-')[0] return { diff --git a/app/styles/main.styl b/app/styles/main.styl index b4245ed6cb548a7d39722b44c8f003dbf827add0..8f49354c2ae49d833c9a4d20e6387da5a153a4fd 100644 --- a/app/styles/main.styl +++ b/app/styles/main.styl @@ -413,7 +413,7 @@ blockquote.info } .legend span { - width: 500px; + width: 100%; display: block; margin-bottom: 4px; } \ No newline at end of file