Merge branch 'master' of github.com:bitpay/insight into feature/realtime-sync-info
Conflicts: public/js/controllers/footer.js public/views/header.html
This commit is contained in:
commit
21f03749c8
@ -36,7 +36,6 @@ script(type='text/javascript', src='/js/services/socket.js')
|
||||
//Application Controllers
|
||||
script(type='text/javascript', src='/js/controllers/index.js')
|
||||
script(type='text/javascript', src='/js/controllers/header.js')
|
||||
script(type='text/javascript', src='/js/controllers/footer.js')
|
||||
script(type='text/javascript', src='/js/controllers/blocks.js')
|
||||
script(type='text/javascript', src='/js/controllers/transactions.js')
|
||||
script(type='text/javascript', src='/js/controllers/address.js')
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('insight.system').controller('FooterController',
|
||||
function ($scope, Global) {
|
||||
$scope.global = Global;
|
||||
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('insight.search').controller('SearchController',
|
||||
function ($scope, $routeParams, $location, Global, Block, Transaction, Address) {
|
||||
function ($scope, $routeParams, $location, $timeout, Global, Block, Transaction, Address, BlockByHeight) {
|
||||
$scope.global = Global;
|
||||
|
||||
$scope.search = function() {
|
||||
@ -10,25 +10,34 @@ angular.module('insight.search').controller('SearchController',
|
||||
$scope.badQuery = false;
|
||||
$scope.q = '';
|
||||
|
||||
Block.get({
|
||||
blockHash: q
|
||||
}, function() {
|
||||
$location.path('block/' + q);
|
||||
}, function () { //block not found, search on TX
|
||||
Transaction.get({
|
||||
txId: q
|
||||
BlockByHeight.get({
|
||||
blockHeight: q
|
||||
}, function(hash) {
|
||||
$location.path('/block/' + hash.blockHash);
|
||||
}, function() { // block by height not found
|
||||
Block.get({
|
||||
blockHash: q
|
||||
}, function() {
|
||||
$location.path('tx/' + q);
|
||||
}, function () { //tx not found, search on Address
|
||||
Address.get({
|
||||
addrStr: q
|
||||
$location.path('block/' + q);
|
||||
}, function () { //block not found, search on TX
|
||||
Transaction.get({
|
||||
txId: q
|
||||
}, function() {
|
||||
$location.path('address/' + q);
|
||||
}, function () { //address not found, fail :(
|
||||
$scope.badQuery = true;
|
||||
$scope.q = q;
|
||||
});
|
||||
});
|
||||
$location.path('tx/' + q);
|
||||
}, function () { //tx not found, search on Address
|
||||
Address.get({
|
||||
addrStr: q
|
||||
}, function() {
|
||||
$location.path('address/' + q);
|
||||
}, function () { //address not found, fail :(
|
||||
$scope.badQuery = true;
|
||||
$timeout(function() {
|
||||
$scope.badQuery = false;
|
||||
}, 2000);
|
||||
$scope.q = q;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -23,6 +23,17 @@ angular.module('insight.status').controller('StatusController',
|
||||
$scope.getSync = function() {
|
||||
Sync.get({}, function(sync) {
|
||||
$rootScope.syncError = null;
|
||||
|
||||
if (sync.blocksToSync > sync.syncedBlocks ) {
|
||||
sync.message = 'Blocks to sync: ' + (sync.blocksToSync - sync.syncedBlocks);
|
||||
sync.tooltip = 'Skipped blocks:' + sync.skipped_blocks;
|
||||
}
|
||||
else {
|
||||
sync.message = 'On sync';
|
||||
sync.tooltip = '';
|
||||
}
|
||||
|
||||
|
||||
$scope.sync = sync;
|
||||
}, function(e) {
|
||||
$rootScope.syncError = 'Could not get sync information' + e;
|
||||
|
||||
@ -14,19 +14,29 @@ angular.module('insight.transactions').controller('transactionsController',
|
||||
|
||||
var ret = [];
|
||||
var tmp = {};
|
||||
var u=0;
|
||||
// TODO multiple output address
|
||||
//
|
||||
for(var i=0; i < l; i++) {
|
||||
|
||||
var notAddr = false;
|
||||
|
||||
// non standard input
|
||||
if (items[i].scriptSig && !items[i].addr) {
|
||||
items[i].addr = 'Unparsed address [' + u++ + ']';
|
||||
items[i].notAddr = true;
|
||||
notAddr = true;
|
||||
}
|
||||
|
||||
// non standard output
|
||||
if (items[i].scriptPubKey && items[i].scriptPubKey.addresses.length > 1) {
|
||||
item[i].addr = items[i].scriptPubKey.addresses.join(',');
|
||||
items[i].addr = items[i].scriptPubKey.addresses.join(',');
|
||||
ret.push(items[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
var addr = items[i].addr ||
|
||||
(items[i].scriptPubKey && items[i].scriptPubKey.addresses[0] );
|
||||
var addr = items[i].addr || (items[i].scriptPubKey && items[i].scriptPubKey.addresses[0] );
|
||||
|
||||
if (!tmp[addr]) {
|
||||
tmp[addr] = {};
|
||||
tmp[addr].valueSat = 0;
|
||||
@ -37,6 +47,7 @@ angular.module('insight.transactions').controller('transactionsController',
|
||||
tmp[addr].valueSat += items[i].valueSat;
|
||||
tmp[addr].value = tmp[addr].valueSat / 100000000;
|
||||
tmp[addr].items.push(items[i]);
|
||||
tmp[addr].notAddr = notAddr;
|
||||
tmp[addr].count++;
|
||||
}
|
||||
|
||||
|
||||
@ -11,28 +11,32 @@
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" ng-class="{active: $uiRoute}">
|
||||
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" data-ng-class="{active: $uiRoute}">
|
||||
<a href="#!/{{item.link}}">{{item.title}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div ng-controller="SearchController">
|
||||
<form class="navbar-form navbar-left" role="search" ng-submit="search()">
|
||||
<div class="form-group" ng-class="{'has-error': badQuery}">
|
||||
<input id="search" type="text" class="form-control" ng-model="q" placeholder="Search for block, transaction or address">
|
||||
<div data-ng-controller="SearchController">
|
||||
<form class="navbar-form navbar-left" role="search" data-ng-submit="search()">
|
||||
<div class="form-group" data-ng-class="{'has-error': badQuery}">
|
||||
<input id="search" type="text" class="form-control" data-ng-model="q" placeholder="Search for block, transaction or address">
|
||||
</div>
|
||||
<div class="no_matching text-danger" ng-show="badQuery">No matching records found!</div>
|
||||
<div class="no_matching text-danger" data-ng-show="badQuery">No matching records found!</div>
|
||||
</form>
|
||||
<div class="status" data-ng-controller="StatusController" data-ng-init="getStatus('Info')">
|
||||
<i class="small" data-ng-show="info.blocks">
|
||||
<strong>Status:</strong> {{statusMessage}}
|
||||
</i>
|
||||
<i class="small">
|
||||
<strong> Connections: </strong> {{info.connections}}
|
||||
</i>
|
||||
<i class="small">
|
||||
<strong>Height:</strong> {{info.blocks}}
|
||||
</i>
|
||||
</div>
|
||||
<div class="status" data-ng-controller="StatusController">
|
||||
<span data-ng-init="getSync()">
|
||||
<span class="small" tooltip="{{sync.tooltip}}" tooltip-placement="down">
|
||||
<i><strong> {{sync.message}} </strong></i>
|
||||
</span>
|
||||
</span>
|
||||
<span data-ng-init="getStatus('Info')">
|
||||
<i class="small">
|
||||
<strong> Connections: </strong> {{info.connections}}
|
||||
</i>
|
||||
<i class="small">
|
||||
<strong>Height:</strong> {{info.blocks}}
|
||||
</i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Block </strong>
|
||||
<td class="text-muted text-right">
|
||||
<td class="text-right">
|
||||
|
||||
<a href="/#!/block/{{tx.blockhash}}" class=" ellipsis">{{tx.blockhash}}</a>
|
||||
</tbody>
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
<div class="line-bot">
|
||||
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
|
||||
|
||||
<a class="pull-right" style="margin-left:10px" data-ng-click="itemsExpanded = !itemsExpanded">
|
||||
<span data-ng-show="itemsExpanded" class="glyphicon glyphicon-minus-sign" tooltip="Hide items details" tooltip-placement="down" ></span>
|
||||
<span data-ng-show="!itemsExpanded" class="glyphicon glyphicon-plus-sign" tooltip="Show items details" tooltip-placement="down"></span>
|
||||
</a>
|
||||
|
||||
<span class="pull-right">{{tx.time * 1000 | date:'medium'}}</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -13,42 +21,32 @@
|
||||
</div>
|
||||
|
||||
<div data-ng-show="!tx.isCoinBase">
|
||||
<ul class="list-unstyled" data-ng-repeat="vin in tx.vinSimple" data-ng-show="!inputsExpanded">
|
||||
<ul class="list-unstyled" data-ng-repeat="vin in tx.vinSimple" data-ng-show="!itemsExpanded">
|
||||
<li class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="ellipsis">
|
||||
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<a data-ng-show="!vin.notAddr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-right text-muted"><small>{{vin.value}} BTC</small></p>
|
||||
</ul>
|
||||
|
||||
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="inputsExpanded">
|
||||
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="itemsExpanded">
|
||||
<li class="row expanded-tx">
|
||||
<a class="col-md-1 glyphicon glyphicon-arrow-right" href="/#!/tx/{{vin.txid}}" alt="Outpoint: {{vin.txid}},{{vin.vout}}" tooltip="Outpoint: {{vin.txid}},{{vin.vout}}" tooltip-placement="right" >
|
||||
</a>
|
||||
<div class="col-md-8">
|
||||
<div class="ellipsis">
|
||||
<span data-ng-show="!vin.addr">Address could not be parsed</span>
|
||||
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
|
||||
<span data-ng-show="vin.notAddr">{{vin.addr}}</span>
|
||||
<a data-ng-show="!vin.notAddr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
|
||||
</div>
|
||||
<div style="word-wrap:break-word">
|
||||
<small><strong>scriptSig</strong>{{vin.scriptSig.asm}}</small>
|
||||
<small><strong>scriptSig</strong> {{vin.scriptSig.asm}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-right text-muted"><small>{{vin.value}} BTC</small></p>
|
||||
</ul>
|
||||
|
||||
<div class="text-center">
|
||||
<a class="text-small" data-ng-click="inputsExpanded = !inputsExpanded">
|
||||
<span data-ng-show="inputsExpanded">
|
||||
<span class="glyphicon glyphicon-chevron-up"></span> Collapse Inputs
|
||||
</span>
|
||||
<span data-ng-show="!inputsExpanded">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span> Expand Inputs
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -58,17 +56,18 @@
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!outputsExpanded">
|
||||
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!itemsExpanded">
|
||||
<div class="col-md-9">
|
||||
<div class="ellipsis">
|
||||
<a href="/#!/address/{{address}}" data-ng-repeat="address in vout.addr.split(',')">{{address}}</a>
|
||||
<span data-ng-show="vout.hideLink">{{vout.addr}}</span>
|
||||
<a href="/#!/address/{{address}}" data-ng-show="!vout.hideLink" data-ng-repeat="address in vout.addr.split(',')">{{address}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<p class="text-right text-muted"> <small>{{vout.value}} BTC</small></p>
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vout in tx.vout" data-ng-show="outputsExpanded">
|
||||
<div data-ng-repeat="vout in tx.vout" data-ng-show="itemsExpanded">
|
||||
<div class="col-md-9 expanded-tx">
|
||||
<div class="ellipsis">
|
||||
<a href="/#!/address/{{address}}" data-ng-repeat="address in vout.scriptPubKey.addresses">{{address}}</a>
|
||||
@ -84,16 +83,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="text-small" data-ng-click="outputsExpanded = !outputsExpanded">
|
||||
<span data-ng-show="outputsExpanded">
|
||||
<span class="glyphicon glyphicon-chevron-up"></span> Collapse Outputs
|
||||
</span>
|
||||
<span data-ng-show="!outputsExpanded">
|
||||
<span class="glyphicon glyphicon-chevron-down"></span> Expand Outputs
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
10
server.js
10
server.js
@ -24,6 +24,16 @@ var express = require('express'),
|
||||
var config = require('./config/config');
|
||||
|
||||
//Bootstrap db connection
|
||||
// If mongod is running
|
||||
mongoose.connection.on('open', function () {
|
||||
console.log('Connected to mongo server.');
|
||||
});
|
||||
// If mongod is not running
|
||||
mongoose.connection.on('error', function (err) {
|
||||
console.log('Could not connect to mongo server!');
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
mongoose.connect(config.db);
|
||||
|
||||
//Bootstrap models
|
||||
|
||||
Loading…
Reference in New Issue
Block a user