Skip to content
Snippets Groups Projects
Commit 6b3ef2f8 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[enh] Add delta time between fork and main consensus block - fix #506

parent 1ffd4860
No related branches found
No related tags found
No related merge requests found
......@@ -1855,6 +1855,7 @@ $ionicon-var-badge-editable: $ionicon-var-edit + "\00a0";
content: url('../img/logo_tor_32px.png');
}
.row-header{
border-bottom: solid 1px #ccc !important;
margin: 0px;
......
......@@ -149,6 +149,12 @@
color: #fff !important;
}
.list .item-peer .badge.badge-secondary,
.list .item-peer .badge .badge-secondary {
top: 31px;
font-size: 10px;
}
.settings .item-divider {
background-color: #f5f5f5;
}
......
......@@ -339,17 +339,6 @@ angular.module('cesium')
};
})
// Auto remove auth/login data, after some inactivity
// see: https://stackoverflow.com/questions/28197316/javascript-or-angularjs-defer-browser-close-or-tab-close-between-refresh
.directive('cleanAuthIdle', function() {
return {
restrict: 'AE',
link: function(element, attrs){
}
};
})
// Un-authenticate when window closed
// see: https://stackoverflow.com/questions/28197316/javascript-or-angularjs-defer-browser-close-or-tab-close-between-refresh
.directive('windowExitUnauth', function($window, csWallet) {
......
......@@ -239,6 +239,18 @@ angular.module('cesium.filters', ['cesium.config', 'cesium.platform', 'pascalpre
};
})
.filter('formatDurationTime', function() {
return function(input) {
if (!input) return '';
var sign = input && input < 0 ? '- ' : '+ ';
var hourFloat = Math.abs(input / 60 / 60);
var hour = Math.trunc(hourFloat);
var min = Math.trunc((hourFloat - hour) * 60);
return hour > 0 ? (sign + hour + 'h ' + min + 's') : (sign + min + 's') ;
};
})
// Display time in ms or seconds (see i18n label 'COMMON.EXECUTION_TIME')
.filter('formatDurationMs', function() {
return function(input) {
......
......@@ -472,6 +472,9 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.bma.services', 'cesi
_.forEach(data.peers, function(peer){
peer.hasMainConsensusBlock = peer.buid == mainBlock.buid;
peer.hasConsensusBlock = !peer.hasMainConsensusBlock && buids[peer.buid].count > 1;
if (peer.hasConsensusBlock) {
peer.consensusBlockDelta = buids[peer.buid].medianTime - mainBlock.medianTime;
}
});
data.peers = _.uniq(data.peers, false, function(peer) {
return peer.id;
......
......@@ -32,10 +32,10 @@
ng-click="selectPeer(peer)">
<i class="icon ion-android-desktop"
ng-class="{'balanced': peer.online && peer.hasMainConsensusBlock, 'energized': peer.online && peer.hasConsensusBlock, 'gray': peer.online && !peer.hasConsensusBlock && !peer.hasMainConsensusBlock, 'stable': !peer.online}"
ng-class=":rebind:{'balanced': peer.online && peer.hasMainConsensusBlock, 'energized': peer.online && peer.hasConsensusBlock, 'gray': peer.online && !peer.hasConsensusBlock && !peer.hasMainConsensusBlock, 'stable': !peer.online}"
ng-if=":rebind:!peer.uid || !peer.avatar"></i>
<b class="icon-secondary ion-person" ng-if=":rebind:!peer.avatar && peer.uid"
ng-class="{'balanced': peer.online && peer.hasMainConsensusBlock, 'energized': peer.online && peer.hasConsensusBlock, 'gray': peer.online && !peer.hasConsensusBlock && !peer.hasMainConsensusBlock, 'stable': !peer.online}"
ng-class=":rebind:{'balanced': peer.online && peer.hasMainConsensusBlock, 'energized': peer.online && peer.hasConsensusBlock, 'gray': peer.online && !peer.hasConsensusBlock && !peer.hasMainConsensusBlock, 'stable': !peer.online}"
style="left: 26px; top: -3px;"></b>
<i class="avatar" ng-if=":rebind:peer.uid && peer.avatar" style="background-image: url('{{:rebind:peer.avatar.src}}')"></i>
<b class="icon-secondary assertive ion-close-circled" ng-if=":rebind:!peer.online" style="left: 37px; top: -10px;"></b>
......@@ -78,7 +78,9 @@
</div>
<div class="col col-20 no-padding text-center">
<span id="helptip-network-peer-{{$index}}-block"
class="badge" ng-class="{'badge-balanced': peer.hasMainConsensusBlock, 'badge-energized': peer.hasConsensusBlock }">{{:rebind:peer.currentNumber|formatInteger}}</span>
class="badge" ng-class=":rebind:{'badge-balanced': peer.hasMainConsensusBlock, 'badge-energized': peer.hasConsensusBlock }">{{:rebind:peer.currentNumber|formatInteger}}</span>
<span class="badge badge-secondary" ng-if=":rebind:peer.consensusBlockDelta">{{:rebind:peer.consensusBlockDelta|formatDurationTime}}</span>
</div>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment