added time filter
This commit is contained in:
parent
f36a5dda1a
commit
ad42e1c389
@ -1,4 +1,9 @@
|
|||||||
var nodes = [
|
var nodes = [
|
||||||
|
//
|
||||||
|
// Duplicate this file and rename it to "nodes.js".
|
||||||
|
// It will be loaded as the main config file and
|
||||||
|
// will be ignored by git. Add nodes like the one below
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// name: 'Readable name of the node',
|
// name: 'Readable name of the node',
|
||||||
// type: 'C++/Go...',
|
// type: 'C++/Go...',
|
||||||
|
@ -49,4 +49,21 @@ angular.module('netStatsApp.filters', [])
|
|||||||
return function(current, best) {
|
return function(current, best) {
|
||||||
return (best - current <= 1 ? '' : (best - current > 1 && best - current < 4 ? 'text-warning' : 'text-danger'));
|
return (best - current <= 1 ? '' : (best - current > 1 && best - current < 4 ? 'text-warning' : 'text-danger'));
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
.filter('timeClass', function() {
|
||||||
|
return function(timestamp) {
|
||||||
|
var time = Math.floor((new Date()).getTime() / 1000);
|
||||||
|
var diff = time - timestamp;
|
||||||
|
|
||||||
|
if(diff <= 12)
|
||||||
|
return 'text-success';
|
||||||
|
|
||||||
|
if(diff <= 20)
|
||||||
|
return 'text-info';
|
||||||
|
|
||||||
|
if(diff <= 30)
|
||||||
|
return 'text-warning';
|
||||||
|
|
||||||
|
return 'text-danger';
|
||||||
|
};
|
||||||
});
|
});
|
@ -27,7 +27,7 @@ block content
|
|||||||
span.big-details {{"#" + bestBlock}}
|
span.big-details {{"#" + bestBlock}}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-6.stat-holder
|
div.col-xs-6.stat-holder
|
||||||
div.row.big-info.blocktime.text-success
|
div.row.big-info.blocktime(class="{{ lastBlock | timeClass }}")
|
||||||
div.pull-left.icon-full-width
|
div.pull-left.icon-full-width
|
||||||
i.icon-time
|
i.icon-time
|
||||||
div.pull-left
|
div.pull-left
|
||||||
@ -82,5 +82,5 @@ block content
|
|||||||
td(class="{{ node.stats.block.height | blockClass : bestBlock }}") {{'#' + node.stats.block.height}}
|
td(class="{{ node.stats.block.height | blockClass : bestBlock }}") {{'#' + node.stats.block.height}}
|
||||||
td(class="{{ node.stats.block.height | blockClass : bestBlock }}").hidden-sm.hidden-xs
|
td(class="{{ node.stats.block.height | blockClass : bestBlock }}").hidden-sm.hidden-xs
|
||||||
span.small {{node.stats.block.hash}}
|
span.small {{node.stats.block.hash}}
|
||||||
td(am-time-ago="node.stats.block.timestamp", am-preprocess="unix")
|
td(am-time-ago="node.stats.block.timestamp", am-preprocess="unix", class="{{ node.stats.block.timestamp | timeClass }}")
|
||||||
td {{ node.stats.active ? '100%' : '0%' }}
|
td {{ node.stats.active ? '100%' : '0%' }}
|
||||||
|
Loading…
Reference in New Issue
Block a user