Merge pull request #141 from colkito/fix/node-ui-fixes
Fix/node ui fixes - ok!
This commit is contained in:
commit
0de7bcc132
|
@ -42,6 +42,9 @@ var getTransaction = function(txid, cb) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tx) return cb(new Error('Transaction not found'));
|
||||||
|
|
||||||
return cb(null, tx.info);
|
return cb(null, tx.info);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -79,13 +82,17 @@ exports.list = function(req, res, next) {
|
||||||
txs = block.info.tx;
|
txs = block.info.tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txs, getTransaction,
|
async.mapSeries(txs, getTransaction, function(err, results) {
|
||||||
function(err, results) {
|
if (err) {
|
||||||
res.jsonp({
|
console.log(err);
|
||||||
pagesTotal: pagesTotal,
|
res.status(404).send('TX not found');
|
||||||
txs: results
|
}
|
||||||
});
|
|
||||||
|
res.jsonp({
|
||||||
|
pagesTotal: pagesTotal,
|
||||||
|
txs: results
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (addrStr) {
|
else if (addrStr) {
|
||||||
|
@ -109,13 +116,17 @@ exports.list = function(req, res, next) {
|
||||||
txs = a.transactions;
|
txs = a.transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txs, getTransaction,
|
async.mapSeries(txs, getTransaction, function(err, results) {
|
||||||
function(err, results) {
|
if (err) {
|
||||||
res.jsonp({
|
console.log(err);
|
||||||
pagesTotal: pagesTotal,
|
res.status(404).send('TX not found');
|
||||||
txs: results
|
}
|
||||||
});
|
|
||||||
|
res.jsonp({
|
||||||
|
pagesTotal: pagesTotal,
|
||||||
|
txs: results
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -133,6 +144,11 @@ exports.list = function(req, res, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txids, getTransaction, function(err, alltxs) {
|
async.mapSeries(txids, getTransaction, function(err, alltxs) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
res.status(404).send('TX not found');
|
||||||
|
}
|
||||||
|
|
||||||
res.jsonp({
|
res.jsonp({
|
||||||
txs: alltxs,
|
txs: alltxs,
|
||||||
length: alltxs.length
|
length: alltxs.length
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
angular.module('insight.blocks').controller('BlocksController',
|
angular.module('insight.blocks').controller('BlocksController',
|
||||||
function($scope, $rootScope, $routeParams, $location, Global, Block, Blocks, BlockByHeight) {
|
function($scope, $rootScope, $routeParams, $location, Global, Block, Blocks, BlockByHeight) {
|
||||||
$scope.global = Global;
|
$scope.global = Global;
|
||||||
|
$scope.loading = false;
|
||||||
|
|
||||||
if ($routeParams.blockHeight) {
|
if ($routeParams.blockHeight) {
|
||||||
BlockByHeight.get({
|
BlockByHeight.get({
|
||||||
|
@ -16,18 +17,24 @@ angular.module('insight.blocks').controller('BlocksController',
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.list = function() {
|
$scope.list = function() {
|
||||||
|
$scope.loading = true;
|
||||||
|
|
||||||
Blocks.get({
|
Blocks.get({
|
||||||
blockDate: $routeParams.blockDate
|
blockDate: $routeParams.blockDate
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
|
$scope.loading = false;
|
||||||
$scope.blocks = res.blocks;
|
$scope.blocks = res.blocks;
|
||||||
$scope.pagination = res.pagination;
|
$scope.pagination = res.pagination;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.findOne = function() {
|
$scope.findOne = function() {
|
||||||
|
$scope.loading = true;
|
||||||
|
|
||||||
Block.get({
|
Block.get({
|
||||||
blockHash: $routeParams.blockHash
|
blockHash: $routeParams.blockHash
|
||||||
}, function(block) {
|
}, function(block) {
|
||||||
|
$scope.loading = false;
|
||||||
$scope.block = block;
|
$scope.block = block;
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
if (e.status === 400) {
|
if (e.status === 400) {
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-ng-show="!blocks.length"><td colspan="5">Waiting for blocks...</td></tr>
|
<tr data-ng-show="loading">
|
||||||
|
<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></td>
|
||||||
<a href="/#!/block/{{b.hash}}">{{b.height}}</a>
|
|
||||||
</td>
|
|
||||||
<td>{{b.time * 1000 | date:'medium'}}</td>
|
<td>{{b.time * 1000 | date:'medium'}}</td>
|
||||||
<td>{{b.tx.length}}</td>
|
<td>{{b.tx.length}}</td>
|
||||||
<td>{{b.size}}</td>
|
<td>{{b.size}}</td>
|
||||||
|
@ -47,5 +47,5 @@
|
||||||
</table>
|
</table>
|
||||||
</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-show="!blocks.length">No blocks yet.</h2>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in New Issue