cleaned up tslint warnings
This commit is contained in:
parent
ccc5f8868a
commit
04c4a71f14
@ -4,10 +4,10 @@ import { BlockDetailPage } from './block-detail';
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
BlockDetailPage,
|
BlockDetailPage
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
IonicPageModule.forChild(BlockDetailPage),
|
IonicPageModule.forChild(BlockDetailPage)
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
BlockDetailPage
|
BlockDetailPage
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { Http } from '@angular/http';
|
|||||||
|
|
||||||
export class BlocksPage {
|
export class BlocksPage {
|
||||||
|
|
||||||
|
public loading: boolean;
|
||||||
public title: string;
|
public title: string;
|
||||||
public blocks: Observable<Block[]>;
|
public blocks: Observable<Block[]>;
|
||||||
public q: string;
|
public q: string;
|
||||||
@ -25,7 +26,7 @@ export class BlocksPage {
|
|||||||
blocksService.getLatestBlocks();
|
blocksService.getLatestBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public search(event) {
|
public search(): void {
|
||||||
console.log('q is', this.q);
|
console.log('q is', this.q);
|
||||||
let apiPrefix: string = 'http://localhost:3001/insight-api/';
|
let apiPrefix: string = 'http://localhost:3001/insight-api/';
|
||||||
this.http.get(apiPrefix + 'block/' + this.q).subscribe(
|
this.http.get(apiPrefix + 'block/' + this.q).subscribe(
|
||||||
@ -33,30 +34,28 @@ export class BlocksPage {
|
|||||||
this.resetSearch();
|
this.resetSearch();
|
||||||
console.log('block', data);
|
console.log('block', data);
|
||||||
},
|
},
|
||||||
(err) => {
|
() => {
|
||||||
this.http.get(apiPrefix + 'tx/' + this.q).subscribe(
|
this.http.get(apiPrefix + 'tx/' + this.q).subscribe(
|
||||||
(data) => {
|
(data: any) => {
|
||||||
this.resetSearch();
|
this.resetSearch();
|
||||||
console.log('tx', data);
|
console.log('tx', data);
|
||||||
},
|
},
|
||||||
(err) => {
|
() => {
|
||||||
this.http.get(apiPrefix + 'addr/' + this.q).subscribe(
|
this.http.get(apiPrefix + 'addr/' + this.q).subscribe(
|
||||||
(data) => {
|
(data: any) => {
|
||||||
this.resetSearch();
|
this.resetSearch();
|
||||||
console.log('addr', data);
|
console.log('addr', data);
|
||||||
},
|
},
|
||||||
(err) => {
|
() => {
|
||||||
this.http.get(apiPrefix + 'block-index/' + this.q).subscribe(
|
this.http.get(apiPrefix + 'block-index/' + this.q).subscribe(
|
||||||
function (data) {
|
function (data: any): void {
|
||||||
this.resetSearch();
|
this.resetSearch();
|
||||||
console.log('block-index', data);
|
let parsedData: any = JSON.parse(data._body);
|
||||||
let parsedData = JSON.parse(data._body);
|
|
||||||
console.log('parsedData', parsedData);
|
|
||||||
this.navCtrl.push('block-detail', {
|
this.navCtrl.push('block-detail', {
|
||||||
'blockHash': parsedData.blockHash
|
'blockHash': parsedData.blockHash
|
||||||
});
|
});
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function (err) {
|
function (): void {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.reportBadQuery();
|
this.reportBadQuery();
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
@ -69,18 +68,24 @@ export class BlocksPage {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSearch = function() {
|
private resetSearch(): void {
|
||||||
this.q = '';
|
this.q = '';
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
};
|
}
|
||||||
|
|
||||||
reportBadQuery() {
|
/* tslint:disable:no-unused-variable */
|
||||||
|
private reportBadQuery(): void {
|
||||||
this.badQuery = true;
|
this.badQuery = true;
|
||||||
console.log('badQuery', this.badQuery);
|
console.log('badQuery', this.badQuery);
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(
|
||||||
this.badQuery = false;
|
function (): void {
|
||||||
console.log('badQuery', this.badQuery);
|
this.badQuery = false;
|
||||||
}.bind(this), 2000);
|
console.log('badQuery', this.badQuery);
|
||||||
|
}.bind(this),
|
||||||
|
2000
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
/* tslint:enable:no-unused-variable */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { BlocksService } from './blocksService';
|
// import { BlocksService } from './blocksService';
|
||||||
import { Block } from '../models';
|
// import { Block } from '../models';
|
||||||
import { TestUtils } from '../test';
|
// import { TestUtils } from '../test';
|
||||||
|
|
||||||
let blocks: BlocksService = null;
|
// let blocks: BlocksService = null;
|
||||||
|
|
||||||
// describe('BlocksService', () => {
|
// describe('BlocksService', () => {
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Http, Response } from '@angular/http';
|
import { Http, Response } from '@angular/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { Block, InsightBlockObject } from '../models';
|
import { Block, InsightBlockObject } from '../models';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|||||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||||
import { HttpModule } from '@angular/http';
|
import { HttpModule } from '@angular/http';
|
||||||
import { MockBackend } from '@angular/http/testing';
|
// import { MockBackend } from '@angular/http/testing';
|
||||||
import { App, Config, Form, IonicModule, Keyboard, DomController, MenuController, NavController, Platform, GestureController } from 'ionic-angular';
|
import { App, Config, Form, IonicModule, Keyboard, DomController, MenuController, NavController, Platform, GestureController } from 'ionic-angular';
|
||||||
import { ConfigMock, PlatformMock } from './mocks';
|
import { ConfigMock, PlatformMock } from './mocks';
|
||||||
import { BlocksServiceMock } from './services/mocks';
|
import { BlocksServiceMock } from './services/mocks';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user