+ show transactions direction

This commit is contained in:
Taegus
2018-12-18 19:42:43 +01:00
parent 8578898b04
commit 0ec20aa2d8
3 changed files with 47 additions and 5 deletions

View File

@@ -22,3 +22,15 @@
.sendWrapper input { .sendWrapper input {
color: #aaa; color: #aaa;
} }
#tableTransactionsForAll .fa-arrow-right {
color: #8B0000;
}
#tableTransactionsForAll .fa-arrow-left {
color: #228B22;
}
#tableTransactionsForAll .fa-arrows-alt-h {
color: #DCDCDC;
}

View File

@@ -2,6 +2,7 @@
<table id="tableTransactionsForAll" class="display tableTransactions" style="width:100%"> <table id="tableTransactionsForAll" class="display tableTransactions" style="width:100%">
<thead> <thead>
<tr> <tr>
<th></th>
<th>Block</th> <th>Block</th>
<th>Timestamp</th> <th>Timestamp</th>
<th>From</th> <th>From</th>
@@ -11,6 +12,7 @@
</thead> </thead>
<tfoot> <tfoot>
<tr> <tr>
<th></th>
<th>Block</th> <th>Block</th>
<th>Timestamp</th> <th>Timestamp</th>
<th>From</th> <th>From</th>

View File

@@ -77,27 +77,55 @@ class Transactions {
$("#loadingTransactionsOverlay").css("display", "block"); $("#loadingTransactionsOverlay").css("display", "block");
setTimeout(() => { setTimeout(() => {
var dataTransactions = ipcRenderer.sendSync('getTransactions');
var addressList = EthoWallets.getAddressList();
dataTransactions.forEach(function(element) {
var isFromValid = (addressList.indexOf(element[2].toLowerCase()) > -1);
var isToValid = (addressList.indexOf(element[3].toLowerCase()) > -1);
if ((isToValid) && (!isFromValid)) {
element.unshift(0);
} else if ((!isToValid) && (isFromValid)) {
element.unshift(1);
} else {
element.unshift(2);
}
});
// render the transactions // render the transactions
$('#tableTransactionsForAll').DataTable({ $('#tableTransactionsForAll').DataTable({
"paging": false, "paging": false,
"scrollY": "calc(100vh - 115px)", "scrollY": "calc(100vh - 115px)",
"responsive": true, "responsive": true,
"processing": true, "processing": true,
"order": [[ 0, "desc" ]], "order": [[ 1, "desc" ]],
"data": ipcRenderer.sendSync('getTransactions'), "data": dataTransactions,
"columnDefs": [ "columnDefs": [
{ {
"className": "transactionsBlockNum", "targets": 0,
"targets": 0 "render": function ( data, type, row ) {
if (data == 0) {
return '<i class="fas fa-arrow-left"></i>';
} else if (data == 1) {
return '<i class="fas fa-arrow-right"></i>';
} else {
return '<i class="fas fa-arrows-alt-h"></i>';
}
}
}, },
{ {
"targets": 1, "className": "transactionsBlockNum",
"targets": 1
},
{
"targets": 2,
"render": function ( data, type, row ) { "render": function ( data, type, row ) {
return moment(data).format("MMM Do YYYY"); return moment(data).format("MMM Do YYYY");
} }
}, },
{ {
"targets": 4, "targets": 5,
"render": function ( data, type, row ) { "render": function ( data, type, row ) {
return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), 'ether')).toFixed(2); return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), 'ether')).toFixed(2);
} }