Commit 850a24b2 authored by Dirk Luijk's avatar Dirk Luijk

Fixed linting

parent 2f44a3a0
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
......@@ -18,7 +18,7 @@
<p class="lead mb-0">{{ transaction.id }}</p>
<span class="badge badge-primary">from {{ transaction.from }}</span>
<span class="badge badge-secondary">to {{ transaction.to }}</span>
<span class="badge badge-info">{{ transaction.amount | currency: 'EUR'}}</span>
<span class="badge badge-info">{{ transaction.amount | currency: 'EUR' }}</span>
</div>
</ng-container>
</div>
......
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { useAnimation, transition, trigger } from '@angular/animations';
import { transition, trigger, useAnimation } from '@angular/animations';
import 'rxjs/add/observable/timer';
import 'rxjs/add/operator/switchMap';
......
......@@ -15,6 +15,7 @@ export class BlockchainService {
getBlockchain(): Observable<Blockchain> {
this.messageService.log('Fetching blockchain...');
return this.http.get<Blockchain>('/api/blockchain')
.do(blockchain => {
// todo: move sorting to backend?
......@@ -25,6 +26,7 @@ export class BlockchainService {
doMine(): Observable<Block> {
this.messageService.log('Mining...');
return this.http.post<Block>('/api/mine', {})
.do(block => this.messageService.log(`Successfully mined block ${block.index} with ${block.transactions.length} transaction(s)`))
.catch(() => {
......
......@@ -3,7 +3,7 @@ import { transition, trigger, useAnimation } from '@angular/animations';
import { slideAnimation } from '../slide.animation';
import { MessageService, Message } from './message.service';
import { Message, MessageService } from './message.service';
@Component({
selector: 'app-messages',
......
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
......@@ -19,7 +19,7 @@ export class PeersComponent implements OnInit, OnDestroy {
constructor(private peersService: PeersService) { }
ngOnInit() {
ngOnInit(): void {
this.subscription = Observable.timer(0, 5000)
.switchMap(() => this.peersService.getPeers())
.subscribe(peers => this.peers = peers);
......
......@@ -11,6 +11,7 @@ export class PeersService {
getPeers(): Observable<string[]> {
this.messageService.log('Fetching peers...');
return this.http.get<string[]>('/api/peers')
.do(peers => this.messageService.log(`Got ${peers.length} peer(s)`));
}
......
import { animate, animation, query, style, stagger } from '@angular/animations';
import { animate, animation, query, stagger, style } from '@angular/animations';
export const slideAnimation = animation([
query(':enter', [
......
import { Component } from '@angular/core';
import {Transaction} from '../../api/transaction';
import { TransactionService } from '../transaction.service';
import { Router } from '@angular/router';
import { Transaction } from '../../api';
import { TransactionService } from '../transaction.service';
@Component({
selector: 'app-create-transaction',
templateUrl: './create-transaction.component.html'
......
......@@ -15,10 +15,10 @@
<th>Amount</th>
</tr>
<tr *ngFor="let transaction of transactions; trackBy: trackByFn">
<td>{{transaction.id}}</td>
<td>{{transaction.from}}</td>
<td>{{transaction.to}}</td>
<td>{{transaction.amount | currency: 'EUR'}}</td>
<td>{{ transaction.id }}</td>
<td>{{ transaction.from }}</td>
<td>{{ transaction.to }}</td>
<td>{{ transaction.amount | currency: 'EUR' }}</td>
</tr>
</table>
</div>
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
......
......@@ -15,17 +15,19 @@ export class TransactionService {
getTransactions(): Observable<Transaction[]> {
this.log('Fetching transactions...');
return this.http.get<Transaction[]>('/api/pendingtransactions')
.do(transactions => this.log(`Got ${transactions.length} transactions`));
}
save(transaction: Transaction): Observable<TransactionResult> {
this.log('Sending new transaction');
return this.http.post<TransactionResult>('/api/newtransaction', transaction)
.do(result => this.log(result.message));
}
private log(message: string) {
private log(message: string): void {
this.messageService.log(message);
}
}
......@@ -40,27 +40,21 @@
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
......@@ -100,13 +100,6 @@
"allow-declarations",
"allow-named-functions"
],
"trailing-comma": [
true,
{
"multiline": "always",
"singleline": "never"
}
],
"one-line": [
true,
"check-open-brace",
......@@ -191,15 +184,14 @@
"directive-selector": [
true,
"attribute",
"p1",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
[
"p1",
"eb"
"app"
],
"kebab-case"
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment