From 0d43f1baeaceeae7977b331d535100136418fc28 Mon Sep 17 00:00:00 2001 From: javajohnhub Date: Mon, 29 Jan 2018 19:41:18 -0500 Subject: [PATCH] added source selection --- src/app/components/home/btfg.service.ts | 4 ++-- src/app/components/home/home.component.html | 5 +++++ src/app/components/home/home.component.ts | 19 +++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/app/components/home/btfg.service.ts b/src/app/components/home/btfg.service.ts index 16c152e..0fbebb9 100644 --- a/src/app/components/home/btfg.service.ts +++ b/src/app/components/home/btfg.service.ts @@ -8,8 +8,8 @@ export class BtfgService { constructor(private _http: HttpClient) {} - getPaymentInfo() { - return this._http.get('http://104.128.234.137/pool-payments.json'); + getPaymentInfo(source) { + return this._http.get(source); } getBlockchainStatus() { return this._http.get('https://wallet.burst.cryptoguru.org:8125/burst?requestType=getBlockchainStatus'); diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html index 72cd3cc..11e3ed2 100644 --- a/src/app/components/home/home.component.html +++ b/src/app/components/home/home.component.html @@ -5,7 +5,12 @@
+
+
+
+ +
{{this.selectedCurrency.name}}: {{burstPrice}} diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index 26db5a8..7135f3a 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -45,6 +45,8 @@ export class HomeComponent implements OnInit { payoutThreshholdString; currencies; _selectedCurrency = { id: 1, name: 'USD' } ; + _selectedSource = { id: 1, url: 'http://burst.btfg.space/pool-payments.json' }; + sources; @ViewChild('myInput') myInput: ElementRef; @ViewChild('teraInput') teraInput: ElementRef; constructor( @@ -85,6 +87,13 @@ export class HomeComponent implements OnInit { { label: 'TWD', value: { id: 31, name: 'TWD' } }, { label: 'ZAR', value: { id: 32, name: 'ZAR' } }, ]; + + this.sources = [ + { label: 'Select Source', value: { id: 1, url: 'http://burst.btfg.space/pool-payments.json' } }, + { label: '.space', value: { id: 1, url: 'http://burst.btfg.space/pool-payments.json' } }, + { label: '.com', value: { id: 2, url: 'http://burst.drecanis.com/pool-payments.json' } }, + { label: 'ip', value: { id: 3, url: 'http://104.128.234.137/pool-payments.json' } }, + ] } ngOnInit() { @@ -245,7 +254,7 @@ export class HomeComponent implements OnInit { this.blockReward = this.blockData['blocks'][0]['blockReward'] this.loading = false; }) - this._btfgService.getPaymentInfo() + this._btfgService.getPaymentInfo(this.selectedSource.url) .subscribe((data) => { this.loading = true; this.blockShares = []; @@ -364,8 +373,14 @@ export class HomeComponent implements OnInit { this._selectedCurrency = currency; this.reloadData(); } + get selectedSource(){ + return this._selectedSource; + } + set selectedSource(source){ + this._selectedSource = source; + this.reloadData(); + } get burstPrice(){ - console.log(this._burstPrice) return this._burstPrice; } set burstPrice(price){