Added interval to get latest blocks and styled latest blocks grid
This commit is contained in:
parent
cdbc84e93a
commit
722eb21cfb
@ -1,3 +1,19 @@
|
|||||||
latest-blocks {
|
latest-blocks {
|
||||||
|
ion-grid {
|
||||||
|
// border: 2px solid green;
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
|
||||||
|
ion-row {
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-row:nth-child(even) {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-row:first-child {
|
||||||
|
background-color: white;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,17 @@ export class LatestBlocksComponent {
|
|||||||
public blocks: Array<any> = [];
|
public blocks: Array<any> = [];
|
||||||
|
|
||||||
constructor(private blocksProvider: BlocksProvider, private navCtrl: NavController) {
|
constructor(private blocksProvider: BlocksProvider, private navCtrl: NavController) {
|
||||||
blocksProvider.getBlocks().subscribe(
|
this.loadBlocks();
|
||||||
|
setInterval(
|
||||||
|
function (): void {
|
||||||
|
this.loadBlocks.call(this);
|
||||||
|
}.bind(this),
|
||||||
|
1000 * 30
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadBlocks(): void {
|
||||||
|
this.blocksProvider.getBlocks().subscribe(
|
||||||
(data) => {
|
(data) => {
|
||||||
this.blocks = JSON.parse(data['_body']).blocks;
|
this.blocks = JSON.parse(data['_body']).blocks;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { Http } from '@angular/http';
|
||||||
|
import { ApiProvider } from '../../providers/api/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the LatestTransactionsComponent component.
|
* Generated class for the LatestTransactionsComponent component.
|
||||||
@ -14,9 +16,37 @@ export class LatestTransactionsComponent {
|
|||||||
|
|
||||||
private text: string;
|
private text: string;
|
||||||
|
|
||||||
constructor() {
|
constructor(private http: Http, private api: ApiProvider) {
|
||||||
console.log('Hello LatestTransactionsComponent Component');
|
console.log('Hello LatestTransactionsComponent Component');
|
||||||
this.text = 'Hello Latest Transactions';
|
this.text = 'Hello Latest Transactions';
|
||||||
|
|
||||||
|
/*
|
||||||
|
let url: string = this.api.apiPrefix + 'txs?' + this.queryType + '=' + this.queryValue;
|
||||||
|
|
||||||
|
this.http.get(url).subscribe(
|
||||||
|
(data) => {
|
||||||
|
this.transactions = JSON.parse(data['_body']);
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.log('err is', err);
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
this.http.get(this.api.apiPrefix + 'tx/' + this.txId).subscribe(
|
||||||
|
(data) => {
|
||||||
|
this.tx = JSON.parse(data['_body']);
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.log('err is', err);
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
transaction {
|
transaction {
|
||||||
|
// TODO Customize the grid to have 13 columns so that we have 6-col inputs, 6-col outputs, 1 col arrow
|
||||||
|
// See http://ionicframework.com/docs/api/components/grid/Grid/#customizing-the-grid
|
||||||
|
|
||||||
ion-grid {
|
ion-grid {
|
||||||
background-color: #F4F4F4;
|
background-color: #F4F4F4;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user