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

@@ -8,23 +8,29 @@
{{address.amount}}
</div>
</div>
</div>
<div class="col-sm-8">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Blocks where address appears</h3>
</div>
<div class="panel-body" ng-repeat="block in address.blocks">
Block Height: {{block.height}}
<br>
Hash: {{block.Hash}}
<br>
{{block.datet}}
<br>
{{block.Size}}
<div class="panel-body">
<div class="list-group">
<a ng-href="#!/block/{{block.height}}" class="list-group-item-text" ng-repeat="block in address.blocks">
Block Height: {{block.height}}
<br> Hash: {{block.hash}}
<br> {{block.datet}}
<br> Size: {{block.size}} bytes
<br>
</a>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Tx where address appears</h3>
@@ -42,9 +48,21 @@
</thead>
<tbody>
<tr ng-repeat="tx in address.txs">
<td style="max-width:20px; overflow:hidden;">{{tx.blockheight}}</td>
<td style="max-width:20px; overflow:hidden;">{{tx.from}}</td>
<td style="max-width:20px; overflow:hidden;">{{tx.to}}</td>
<td style="max-width:20px; overflow:hidden;">
<a ng-href="#!/block/{{tx.blockheight}}" class="list-group-item-text">
{{tx.blockheight}}
</a>
</td>
<td style="max-width:20px; overflow:hidden;">
<a ng-href="#!/address/{{tx.from}}" class="list-group-item-text">
{{tx.from}}
</a>
</td>
<td style="max-width:20px; overflow:hidden;">
<a ng-href="#!/address/{{tx.to}}" class="list-group-item-text">
{{tx.to}}
</a>
</td>
<td>{{tx.amount}}</td>
<td><a ng-href="#!/tx/{{tx.id}}">View</a></td>
</tr>

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');
});
});

View File

@@ -130,34 +130,46 @@
<h3 class="panel-title">Last Tx with amount</h3>
</div>
<div class="panel-body" style="max-height: 250px;overflow-y: scroll;">
<table class="table table-hover">
<!--<colgroup>
<col class="col-md-2">
<col class="col-md-2">
<col class="col-md-2">
<col class="col-md-2">
<col class="col-md-2">
<col class="col-md-2">
</colgroup>-->
<thead>
<tr>
<th>BlockHeight</th>
<th>From</th>
<th>To</th>
<th>Amount</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tx in txs">
<td style="max-width:20px; overflow:hidden;">{{tx.blockheight}}</td>
<td style="max-width:20px; overflow:hidden;">{{tx.from}}</td>
<td style="max-width:20px; overflow:hidden;">{{tx.to}}</td>
<td>{{tx.amount}}</td>
<td><a ng-href="#!/tx/{{tx.id}}">View</a></td>
</tr>
</tbody>
</table>
<table class="table table-hover">
<thead>
<tr>
<th>BlockHeight</th>
<th>Txid</th>
<th>Input</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="tx in txs">
<td style="max-width:20px; overflow:hidden;">
<a ng-href="#!/block/{{tx.blockheight}}" class="list-group-item-text">
{{tx.blockheight}}
</a>
</td>
<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>