Lint fixes

This commit is contained in:
GloriousCode
2018-08-16 17:32:25 +10:00
parent bdcf87ab03
commit 6c0ad602da
16 changed files with 95 additions and 83 deletions

View File

@@ -32,8 +32,8 @@
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
"build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc",
"lint": "tslint -c tslint.json src/**/*{.ts,.tsx} main.ts",
"lint:fix": "tslint --fix -c tslint.json src/**/*{.ts,.tsx} main.ts",
"lint": "tslint --project tslint.json src/**/*{.ts,.tsx} main.ts",
"lint:fix": "tslint --fix --project tslint.json src/**/*{.ts,.tsx} main.ts",
"ng:serve": "ng serve -o",
"electron:tsc": "tsc main.ts",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",

View File

@@ -17,7 +17,10 @@ export class AppComponent implements OnInit {
private ws: WebsocketResponseHandlerService;
public isConnected = false;
constructor(public electronService: ElectronService, sidebarService: SidebarService, private router: Router, private websocketHandler: WebsocketResponseHandlerService) {
constructor(public electronService: ElectronService,
sidebarService: SidebarService,
private router: Router,
private websocketHandler: WebsocketResponseHandlerService) {
if (electronService.isElectron()) {
console.log('Mode electron');

View File

@@ -5,6 +5,28 @@ import { Config, CurrencyPairRedux, Wallet } from './../../shared/classes/config
import { MatSnackBar, MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
import { WalletComponent } from '../wallet/wallet.component';
@Component({
selector: 'app-dialog-overview-example-dialog',
template: '<h4>Enabled Currencies</h4><div *ngFor="let currency of data.pairs">'
+ '<mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled">{{currency.Name}}</mat-checkbox>'
+ '</div><button mat-raised-button color="primary" (click)="close()">DONE</button>',
})
export class EnabledCurrenciesDialogueComponent {
constructor(
public dialogRef: MatDialogRef<EnabledCurrenciesDialogueComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
onNoClick(): void {
this.dialogRef.close();
}
public close(): void {
this.dialogRef.close();
}
}
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
@@ -18,10 +40,13 @@ export class SettingsComponent implements OnInit {
private snackBar: MatSnackBar;
private dialogue;
constructor(private websocketHandler: WebsocketResponseHandlerService, snackBar: MatSnackBar, public dialog: MatDialog) {
constructor(private websocketHandler: WebsocketResponseHandlerService,
snackBar: MatSnackBar,
public dialog: MatDialog) {
this.ws = websocketHandler;
this.snackBar = snackBar;
}
ngOnInit() {
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetConfig) {
@@ -82,25 +107,6 @@ export class SettingsComponent implements OnInit {
}
}
@Component({
selector: 'app-dialog-overview-example-dialog',
template: '<h4>Enabled Currencies</h4><div *ngFor="let currency of data.pairs"><mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled">{{currency.Name}}</mat-checkbox></div><button mat-raised-button color="primary" (click)="close()">DONE</button>',
})
export class EnabledCurrenciesDialogueComponent {
constructor(
public dialogRef: MatDialogRef<EnabledCurrenciesDialogueComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
onNoClick(): void {
this.dialogRef.close();
}
public close(): void {
this.dialogRef.close();
}
}

View File

@@ -28,18 +28,23 @@ export class WalletComponent implements OnInit {
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetPortfolio) {
this.wallet = <Wallet>msg.data;
console.log(msg.data);
this.attachIcon(this.wallet.coin_totals);
this.attachIcon(this.wallet.coins_offline);
this.attachIcon(this.wallet.coins_online);
console.log('wallet: ' + msg.data);
console.log('message: ' + JSON.stringify(msg));
console.log('data: ' + this.wallet);
this.attachIcon(this.wallet.offline_summary.BTC);
this.attachIcon(this.wallet.offline_summary.ETH);
this.attachIcon(this.wallet.offline_summary.LTC);
if (this.wallet != null && this.wallet.coin_totals != null) {
this.attachIcon(this.wallet.coin_totals);
this.attachIcon(this.wallet.coins_offline);
this.attachIcon(this.wallet.coins_online);
this.attachIcon(this.wallet.online_summary.BTC);
this.attachIcon(this.wallet.online_summary.ETH);
this.attachIcon(this.wallet.online_summary.LTC);
this.attachIcon(this.wallet.offline_summary.BTC);
this.attachIcon(this.wallet.offline_summary.ETH);
this.attachIcon(this.wallet.offline_summary.LTC);
this.attachIcon(this.wallet.online_summary.BTC);
this.attachIcon(this.wallet.online_summary.ETH);
this.attachIcon(this.wallet.online_summary.LTC);
}
}
});
}

View File

@@ -25,8 +25,12 @@ export class WebsocketResponseHandlerService {
this.isConnected = this.ws.isConnected;
}, 2000);
const websocketResponseMessage = JSON.parse(response.data);
const websocketResponseData = websocketResponseMessage.Data === undefined ? websocketResponseMessage.data : websocketResponseMessage.Data;
const websocketResponseEvent = websocketResponseMessage.Event === undefined ? websocketResponseMessage.event : websocketResponseMessage.Event;
const websocketResponseData = websocketResponseMessage.Data === undefined
? websocketResponseMessage.data
: websocketResponseMessage.Data;
const websocketResponseEvent = websocketResponseMessage.Event === undefined
? websocketResponseMessage.event
: websocketResponseMessage.Event;
const responseMessage = new WebSocketMessage();
responseMessage.event = websocketResponseEvent;

View File

@@ -52,7 +52,7 @@ export class WebsocketService {
}, 400);
if (ws.readyState !== WebSocket.OPEN) {
new Error('Failed to send message to websocket after 10 attempts');
throw new Error('Failed to send message to websocket after 10 attempts');
this.isConnected = false;
}
}

View File

@@ -1,5 +1,11 @@
import { inherits } from 'util';
export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
}
export class Config {
Name: string;
EncryptConfig?: number;
@@ -113,11 +119,6 @@ export class Config {
}
}
export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
}
export interface CurrencyPairFormat {
Uppercase: boolean;

View File

@@ -1,3 +1,11 @@
export class WebSocketMessageType {
public static Auth = 'auth';
public static GetConfig = 'GetConfig';
public static SaveConfig = 'SaveConfig';
public static GetPortfolio = 'GetPortfolio';
public static TickerUpdate = 'ticker_update';
}
export class WebSocketMessage {
public event: string;
public data: any;
@@ -23,11 +31,3 @@ export class WebSocketMessage {
return response;
}
}
export class WebSocketMessageType {
public static Auth = 'auth';
public static GetConfig = 'GetConfig';
public static SaveConfig = 'SaveConfig';
public static GetPortfolio = 'GetPortfolio';
public static TickerUpdate = 'ticker_update';
}

View File

@@ -1,5 +1,12 @@
import { Component, OnInit } from '@angular/core';
export class MyOrders {
public count: number;
public total: number;
public price: number;
public amount: number;
}
@Component({
selector: 'app-my-orders',
templateUrl: './my-orders.component.html',
@@ -25,11 +32,3 @@ export class MyOrdersComponent implements OnInit {
this.orders.push(item);
}
}
export class MyOrders {
public count: number;
public total: number;
public price: number;
public amount: number;
}

View File

@@ -1,5 +1,12 @@
import { Component, OnInit } from '@angular/core';
export class Order {
public count: number;
public total: number;
public price: number;
public amount: number;
}
@Component({
selector: 'app-orders',
templateUrl: './orders.component.html',
@@ -49,11 +56,3 @@ export class OrdersComponent implements OnInit {
}
}
export class Order {
public count: number;
public total: number;
public price: number;
public amount: number;
}

View File

@@ -11,7 +11,6 @@ import {CommonModule} from '@angular/common';
styleUrls: ['theme-picker.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
host: {'aria-hidden': 'true'},
})
export class ThemePickerComponent {
currentTheme;

View File

@@ -1,5 +1,11 @@
import { Component, OnInit } from '@angular/core';
export class TradeHistoryOrder {
public price: number;
public time: Date;
public amount: number;
}
@Component({
selector: 'app-trade-history',
templateUrl: './trade-history.component.html',
@@ -45,12 +51,4 @@ export class TradeHistoryComponent implements OnInit {
this.orders.push(item);
this.orders.push(item);
}
}
export class TradeHistoryOrder {
public price: number;
public time: Date;
public amount: number;
}

View File

@@ -30,7 +30,7 @@
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
import 'core-js/es6/map';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
@@ -41,8 +41,8 @@
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
// import 'core-js/es6/reflect';
// import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/

View File

@@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es2015",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",

View File

@@ -7,13 +7,12 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"es2015",
"dom",
]
}

View File

@@ -22,8 +22,7 @@
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
true
],
"import-spacing": true,
"indent": [