hide loading message when there are not txs

This commit is contained in:
Mario Colque 2014-01-23 17:31:49 -03:00
parent 2d1f3191e3
commit fc1717e7e3
2 changed files with 12 additions and 5 deletions

View File

@ -3,6 +3,7 @@
angular.module('insight.blocks').controller('BlocksController',
function($scope, $rootScope, $routeParams, $location, Global, Block, Blocks, BlockByHeight) {
$scope.global = Global;
$scope.loading = false;
if ($routeParams.blockHeight) {
BlockByHeight.get({
@ -16,18 +17,24 @@ angular.module('insight.blocks').controller('BlocksController',
}
$scope.list = function() {
$scope.loading = true;
Blocks.get({
blockDate: $routeParams.blockDate
}, function(res) {
$scope.loading = false;
$scope.blocks = res.blocks;
$scope.pagination = res.pagination;
});
};
$scope.findOne = function() {
$scope.loading = true;
Block.get({
blockHash: $routeParams.blockHash
}, function(block) {
$scope.loading = false;
$scope.block = block;
}, function(e) {
if (e.status === 400) {

View File

@ -33,11 +33,11 @@
</tr>
</thead>
<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'>
<td>
<a href="/#!/block/{{b.hash}}">{{b.height}}</a>
</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>
@ -47,5 +47,5 @@
</table>
</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>