fixed lasts conflicts in block/list
This commit is contained in:
parent
149fe6337a
commit
13c9d0075a
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('insight.system').controller('HeaderController',
|
angular.module('insight.system').controller('HeaderController',
|
||||||
function ($scope, Global) {
|
function ($scope, get_socket, Global, Block) {
|
||||||
$scope.global = Global;
|
$scope.global = Global;
|
||||||
|
|
||||||
$scope.menu = [
|
$scope.menu = [
|
||||||
@ -15,5 +15,23 @@ angular.module('insight.system').controller('HeaderController',
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var socket = get_socket($scope);
|
||||||
|
socket.emit('subscribe', 'inv');
|
||||||
|
|
||||||
|
var getBlock = function(hash) {
|
||||||
|
Block.get({
|
||||||
|
blockHash: hash
|
||||||
|
}, function(res) {
|
||||||
|
$scope.totalBlocks = res.height;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.on('block', function(block) {
|
||||||
|
var blockHash = block.hash.toString();
|
||||||
|
console.log('Update Height');
|
||||||
|
getBlock(blockHash);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.isCollapsed = false;
|
$scope.isCollapsed = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,9 +3,25 @@
|
|||||||
var TRANSACTION_DISPLAYED = 5;
|
var TRANSACTION_DISPLAYED = 5;
|
||||||
var BLOCKS_DISPLAYED = 5;
|
var BLOCKS_DISPLAYED = 5;
|
||||||
angular.module('insight.system').controller('IndexController',
|
angular.module('insight.system').controller('IndexController',
|
||||||
function($scope, $rootScope, Global, get_socket, Blocks, Transactions) {
|
function($scope, $rootScope, Global, get_socket, Blocks, Block, Transactions, Transaction) {
|
||||||
$scope.global = Global;
|
$scope.global = Global;
|
||||||
|
|
||||||
|
var getTransaction = function(txid) {
|
||||||
|
Transaction.get({
|
||||||
|
txId: txid
|
||||||
|
}, function(res) {
|
||||||
|
$scope.txs.unshift(res);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var getBlock = function(hash) {
|
||||||
|
Block.get({
|
||||||
|
blockHash: hash
|
||||||
|
}, function(res) {
|
||||||
|
$scope.blocks.unshift(res);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var socket = get_socket($scope);
|
var socket = get_socket($scope);
|
||||||
socket.emit('subscribe', 'inv');
|
socket.emit('subscribe', 'inv');
|
||||||
|
|
||||||
@ -13,19 +29,21 @@ angular.module('insight.system').controller('IndexController',
|
|||||||
$scope.flashMessage = $rootScope.flashMessage || null;
|
$scope.flashMessage = $rootScope.flashMessage || null;
|
||||||
|
|
||||||
socket.on('tx', function(tx) {
|
socket.on('tx', function(tx) {
|
||||||
|
var txStr = tx.txid.toString();
|
||||||
console.log('Transaction received! ' + JSON.stringify(tx));
|
console.log('Transaction received! ' + JSON.stringify(tx));
|
||||||
if ($scope.txs.length === TRANSACTION_DISPLAYED) {
|
if ($scope.txs.length === TRANSACTION_DISPLAYED) {
|
||||||
$scope.txs.pop();
|
$scope.txs.pop();
|
||||||
}
|
}
|
||||||
$scope.txs.unshift(tx);
|
getTransaction(txStr);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('block', function(block) {
|
socket.on('block', function(block) {
|
||||||
|
var blockHash = block.hash.toString();
|
||||||
console.log('Block received! ' + JSON.stringify(block));
|
console.log('Block received! ' + JSON.stringify(block));
|
||||||
if ($scope.blocks.length === BLOCKS_DISPLAYED) {
|
if ($scope.blocks.length === BLOCKS_DISPLAYED) {
|
||||||
$scope.blocks.pop();
|
$scope.blocks.pop();
|
||||||
}
|
}
|
||||||
$scope.blocks.unshift(block);
|
getBlock(blockHash);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.human_since = function(time) {
|
$scope.human_since = function(time) {
|
||||||
@ -38,6 +56,7 @@ angular.module('insight.system').controller('IndexController',
|
|||||||
limit: BLOCKS_DISPLAYED
|
limit: BLOCKS_DISPLAYED
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
$scope.blocks = res.blocks;
|
$scope.blocks = res.blocks;
|
||||||
|
$scope.blocksLength = res.lenght;
|
||||||
});
|
});
|
||||||
|
|
||||||
Transactions.get({
|
Transactions.get({
|
||||||
|
|||||||
@ -11,33 +11,47 @@
|
|||||||
<p class="lead text-center m20v">{{pagination.current}}</p>
|
<p class="lead text-center m20v">{{pagination.current}}</p>
|
||||||
|
|
||||||
<div class="m50v">
|
<div class="m50v">
|
||||||
<a class="btn btn-default" href="#!/blocks-date/{{pagination.prev}}"><small>← {{pagination.prev}}</small></a>
|
<a class="btn btn-primary" href="#!/blocks-date/{{pagination.prev}}"><small>← {{pagination.prev}}</small></a>
|
||||||
<a class="btn btn-primary" href="#!/blocks-date/{{pagination.next}}"><small>{{pagination.next}} →</small></a>
|
<a class="btn btn-primary" href="#!/blocks-date/{{pagination.next}}"><small>{{pagination.next}} →</small></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-9">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>
|
<h1>
|
||||||
Blocks
|
Blocks
|
||||||
<small>by date</small>
|
<small>by date</small>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<table class="table" data-ng-show="blocks || blocks.length">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Hash</th>
|
<th>Height</th>
|
||||||
<th>Solved at</th>
|
<th>Timestamp</th>
|
||||||
|
<th>Transactions</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Confirmations</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-ng-repeat="block in blocks">
|
<tr data-ng-show="!blocks.length"><td colspan="5">Waiting for blocks...</td></tr>
|
||||||
<td><a href="#!/block/{{block.hash}}">{{block.hash}}</a></td>
|
<tr class="fader" data-ng-repeat='b in blocks'>
|
||||||
<td>{{block.time * 1000 | date:'medium'}}</td>
|
<td>
|
||||||
|
<a href="/#!/block/{{b.hash}}">{{b.height}}</a>
|
||||||
|
</td>
|
||||||
|
<td>{{b.time * 1000 | date:'medium'}}</td>
|
||||||
|
<td>{{b.tx.length}}</td>
|
||||||
|
<td>{{b.size}}</td>
|
||||||
|
<td>{{b.confirmations}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<ul class="pager" data-ng-show="blocks.length">
|
||||||
|
<li class="previous"><a href="#!/blocks-date/{{pagination.prev}}">← {{pagination.prev}}</a></li>
|
||||||
|
<li class="disabled"><a href="#">{{pagination.current}}</a></li>
|
||||||
|
<li class="next"><a href="#!/blocks-date/{{pagination.next}}">{{pagination.next}} →</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-center text-muted" data-ng-hide="!blocks || blocks.length">No blocks yet.</h2>
|
<h2 class="text-center text-muted" data-ng-hide="!blocks || blocks.length">No blocks yet.</h2>
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<strong> Conn: </strong> {{info.connections}}
|
<strong> Conn: </strong> {{info.connections}}
|
||||||
</i>
|
</i>
|
||||||
<i class="small">
|
<i class="small">
|
||||||
<strong>Height:</strong> {{info.blocks}}
|
<strong>Height:</strong> {{totalBlocks || info.blocks}}
|
||||||
</i>
|
</i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-ng-show="!blocks.length"><td colspan="5">Loading...</td></tr>
|
<tr data-ng-show="!blocks.length"><td colspan="5">Waiting for blocks...</td></tr>
|
||||||
<tr class="fader" data-ng-repeat='b in blocks'>
|
<tr class="fader" data-ng-repeat='b in blocks'>
|
||||||
<td>
|
<td>
|
||||||
<a href="/#!/block/{{b.hash}}">{{b.height}}</a>
|
<a href="/#!/block/{{b.hash}}">{{b.height}}</a>
|
||||||
@ -29,7 +29,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
@ -45,7 +44,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-ng-show="!txs.length"><td colspan="5">Loading...</td></tr>
|
<tr data-ng-show="!txs.length"><td colspan="5">Waiting for transactions...</td></tr>
|
||||||
<tr class="fader" data-ng-repeat='tx in txs'>
|
<tr class="fader" data-ng-repeat='tx in txs'>
|
||||||
<td>
|
<td>
|
||||||
<a class="ellipsis" href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
|
<a class="ellipsis" href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user