corrected tx model, added block view in frontend

This commit is contained in:
arnaucode
2017-08-29 16:10:39 +02:00
parent 139040269f
commit 99af4a76ff
11 changed files with 266 additions and 74 deletions

View File

@@ -0,0 +1,73 @@
<div class="row">
<div class="col-sm-4">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Block Height {{block.height}}</h3>
</div>
<div class="panel-body">
Block Hash:
<p style="font-size: 9px;">
{{block.hash}}
</p>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Block evolution</h3>
</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Tx in block</h3>
</div>
<div class="panel-body">
<div class="col-sm-12">
<table class="table table-hover">
<thead>
<tr>
<th>Txid</th>
<th>Input</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tx in block.txs">
<td style="max-width:20px; overflow:hidden;">
<a ng-href="#!/address/{{tx.from}}" class="list-group-item-text">
{{tx.txid}}
</a>
</td>
<td style="max-width:20px; overflow:hidden;">
<table><tbody><tr ng-repeat="vin in tx.vin"><td>
<a ng-href="#!/address/{{vin.address}}" class="list-group-item-text">
{{vin.address}}
</a>
:{{vin.amount}}
</td></tr></tbody></table>
</td>
<td style="max-width:20px; overflow:hidden;">
<table><tbody><tr ng-repeat="vout in tx.vout"><td>
<a ng-href="#!/address/{{vout.address}}" class="list-group-item-text">
{{vout.address}}
</a>
:{{vout.value}}
</td></tr></tbody></table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

21
web/views/block/block.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
angular.module('app.block', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/block/:height', {
templateUrl: 'views/block/block.html',
controller: 'BlockCtrl'
});
}])
.controller('BlockCtrl', function($scope, $http, $routeParams) {
$scope.block = {};
$http.get(urlapi + 'block/' + $routeParams.height)
.then(function(data, status, headers, config) {
console.log(data);
$scope.block = data.data;
}, function(data, status, headers, config) {
console.log('data error');
});
});