Merge pull request #804 from SonicWizard/next

Completed Latest Transactions
This commit is contained in:
Jason Dreyzehner 2017-08-23 13:43:56 -04:00 committed by GitHub
commit fbfd9ecb34
8 changed files with 90 additions and 86 deletions

View File

@ -38,12 +38,10 @@
"devDependencies": {
"@angular/cli": "1.1.2",
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.6.2",
"@ionic/cli-plugin-ionic-angular": "1.4.1",
"@types/jasmine": "2.5.41",
"@types/node": "7.0.4",
"codecov": "2.2.0",
"ionic": "3.9.1",
"ionic": "3.9.2",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.1",

View File

@ -1,4 +1,27 @@
<!-- Generated template for the LatestTransactionsComponent component -->
<div>
{{text}}
<div *ngIf="loading">
<ion-spinner name="crescent"></ion-spinner>
</div>
<div *ngIf="!loading">
<ion-grid>
<ion-row>
<ion-col><b>Hash</b></ion-col>
<ion-col text-right><b>Value Out</b></ion-col>
</ion-row>
<ion-row *ngFor="let tx of transactions">
<ion-col col-9>
<div class="ellipsis">
<a (click)="goToTx(tx.txid)">{{ tx.txid }}</a>
</div>
</ion-col>
<ion-col col-3 text-right>
{{ currency.getConversion(tx.valueOut) }}
</ion-col>
</ion-row>
</ion-grid>
</div>
</div>

View File

@ -1,3 +1,23 @@
latest-transactions {
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;
}
ion-row:last-child {
background-color: white;
}
}
}

View File

@ -1,6 +1,8 @@
import { Component } from '@angular/core';
// import { Http } from '@angular/http';
// import { ApiProvider } from '../../providers/api/api';
import { Component, NgZone, Input } from '@angular/core';
import { Http } from '@angular/http';
import { NavController } from 'ionic-angular';
import { ApiProvider } from '../../providers/api/api';
import { CurrencyProvider } from '../../providers/currency/currency';
/**
* Generated class for the LatestTransactionsComponent component.
@ -14,14 +16,34 @@ import { Component } from '@angular/core';
})
export class LatestTransactionsComponent {
private text: string;
private loading: boolean = true;
private transactions: Array<any> = [];
@Input() public refreshSeconds: number = 10;
private timer: number;
constructor(/*private http: Http, private api: ApiProvider*/) {
console.log('Hello LatestTransactionsComponent Component');
this.text = 'Hello Latest Transactions';
constructor(private http: Http, private navCtrl: NavController, private api: ApiProvider, public currency: CurrencyProvider, private ngZone: NgZone) {
this.loadTransactions();
}
/*
let url: string = this.api.apiPrefix + 'txs?' + this.queryType + '=' + this.queryValue;
public ngOnChanges(): void {
if (this.timer) {
clearInterval(this.timer);
}
this.ngZone.runOutsideAngular(() => {
this.timer = setInterval(
function (): void {
this.ngZone.run(function (): void {
this.loadTransactions.call(this);
}.bind(this));
}.bind(this),
1000 * this.refreshSeconds
);
});
}
private loadTransactions(): void {
let url: string = this.api.apiPrefix + 'txs';
this.http.get(url).subscribe(
(data) => {
@ -33,20 +55,11 @@ export class LatestTransactionsComponent {
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;
}
);
*/
}
public goToTx(txId: string): void {
this.navCtrl.push('transaction', {
'txId': txId
});
}
}

View File

@ -18,7 +18,7 @@
<div>
<h1>Latest Transactions</h1>
<latest-transactions></latest-transactions>
<latest-transactions [refreshSeconds]="8"></latest-transactions>
</div>
<div class="about">

View File

@ -20,8 +20,4 @@ export class HomePage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
public ionViewDidLoad(): void {
console.log('ionViewDidLoad HomePage');
}
}

View File

@ -13,7 +13,6 @@ import { ApiProvider } from '../../providers/api/api';
export class BlocksProvider {
constructor(public http: Http, private api: ApiProvider) {
console.log('Hello BlocksProvider Provider');
}
public getBlocks(): any {

View File

@ -159,50 +159,9 @@
ws "1.1.1"
xml2js "^0.4.17"
"@ionic/cli-plugin-cordova@1.6.2":
version "1.6.2"
resolved "https://registry.yarnpkg.com/@ionic/cli-plugin-cordova/-/cli-plugin-cordova-1.6.2.tgz#f71d10641df8b522f54f8274e0d5bc4dbb8b5208"
dependencies:
"@ionic/cli-utils" "1.7.0"
chalk "^2.0.0"
elementtree "^0.1.7"
tslib "^1.7.1"
"@ionic/cli-plugin-ionic-angular@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@ionic/cli-plugin-ionic-angular/-/cli-plugin-ionic-angular-1.4.1.tgz#bb94b7ad61c2f79757b2dff041c0b7e2151777ec"
dependencies:
"@ionic/cli-utils" "1.7.0"
chalk "^2.0.0"
tslib "^1.7.1"
"@ionic/cli-utils@1.7.0":
version "1.7.0"
resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.7.0.tgz#05bdbf3e7533eeeee27d58f3adbfe26bf2bf0d1d"
dependencies:
archiver "^2.0.0"
chalk "^2.0.0"
ci-info "^1.0.0"
cross-spawn "^5.1.0"
dargs "^5.1.0"
dev-null "^0.1.1"
inquirer "^3.2.1"
leek "0.0.24"
lodash "^4.17.4"
minimist "^1.2.0"
ncp "^2.0.0"
semver "^5.4.1"
slice-ansi "^1.0.0"
string-width "^2.1.1"
strip-ansi "^4.0.0"
superagent "^3.5.2"
tslib "^1.7.1"
uuid "^3.0.1"
wrap-ansi "^3.0.1"
"@ionic/cli-utils@1.9.1":
version "1.9.1"
resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.9.1.tgz#a0118819cb8de1f3bc4bc5b401e5b61d7f41d5b5"
"@ionic/cli-utils@1.9.2":
version "1.9.2"
resolved "https://registry.yarnpkg.com/@ionic/cli-utils/-/cli-utils-1.9.2.tgz#9916d8bb6ec696b948b6be1c05fbec46c87ddc0b"
dependencies:
"@types/gulp" "^3.8.33"
archiver "^2.0.0"
@ -1973,10 +1932,6 @@ detect-node@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127"
dev-null@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dev-null/-/dev-null-0.1.1.tgz#5a205ce3c2b2ef77b6238d6ba179eb74c6a0e818"
di@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c"
@ -3223,11 +3178,11 @@ ionic-angular@3.4.2:
version "3.4.2"
resolved "https://registry.yarnpkg.com/ionic-angular/-/ionic-angular-3.4.2.tgz#762631f1af78a5ae1c0aa0f4d23b31435142abe1"
ionic@3.9.1:
version "3.9.1"
resolved "https://registry.yarnpkg.com/ionic/-/ionic-3.9.1.tgz#be50eea2f55bad40574772ecaeaf5a460fd16330"
ionic@3.9.2:
version "3.9.2"
resolved "https://registry.yarnpkg.com/ionic/-/ionic-3.9.2.tgz#d958069ce29d9dbb8b9c1638b59995ce005ce845"
dependencies:
"@ionic/cli-utils" "1.9.1"
"@ionic/cli-utils" "1.9.2"
chalk "^2.0.0"
opn "^5.1.0"
os-name "^2.0.1"