Updates Angular to v7 and updates components to support better formatted config syntax

This commit is contained in:
Scott Grant
2018-11-12 16:56:23 +11:00
parent 659f7cc86c
commit b11c52ca07
10 changed files with 3953 additions and 10443 deletions

13934
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -48,57 +48,57 @@
"start:web": "ng serve --o"
},
"dependencies": {
"node-sass": "^4.9.2",
"rxjs-compat": "^6.2.1",
"node-sass": "^4.10.0",
"rxjs-compat": "^6.3.3",
"rxjs-tslint": "^0.1.5"
},
"devDependencies": {
"@amcharts/amcharts3-angular": "^2.1.1",
"@angular-devkit/build-angular": "~0.6.8",
"@angular/animations": "^6.1.2",
"@angular/cdk": "^6.4.0",
"@angular/cli": "^6.0.8",
"@angular/common": "^6.1.2",
"@angular/compiler": "^6.1.2",
"@angular/compiler-cli": "^6.1.2",
"@angular/core": "^6.1.2",
"@angular/forms": "^6.1.2",
"@angular/http": "^6.1.2",
"@angular/language-service": "^6.1.2",
"@angular/material": "^6.4.0",
"@angular/platform-browser": "^6.1.2",
"@angular/platform-browser-dynamic": "^6.1.2",
"@angular/router": "^6.1.2",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"@amcharts/amcharts3-angular": "2.2.2",
"@angular-devkit/build-angular": "~0.10.0",
"@angular/animations": "^7.0.3",
"@angular/cdk": "^7.0.3",
"@angular/cli": "^7.0.5",
"@angular/common": "^7.0.3",
"@angular/compiler": "^7.0.3",
"@angular/compiler-cli": "^7.0.3",
"@angular/core": "^7.0.3",
"@angular/forms": "^7.0.3",
"@angular/http": "^7.0.3",
"@angular/language-service": "^7.0.3",
"@angular/material": "^7.0.3",
"@angular/platform-browser": "^7.0.3",
"@angular/platform-browser-dynamic": "^7.0.3",
"@angular/router": "^7.0.3",
"@ngx-translate/core": "^11.0.0",
"@ngx-translate/http-loader": "^4.0.0",
"@types/es6-collections": "^0.5.31",
"@types/jasmine": "^2.8.8",
"@types/jasminewd2": "^2.0.3",
"@types/node": "^7.0.67",
"codelyzer": "^4.4.2",
"@types/jasmine": "^2.8.11",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^10.12.5",
"codelyzer": "^4.5.0",
"core-js": "^2.5.7",
"cross-env": "^5.2.0",
"dotenv": "^6.0.0",
"electron": "^2.0.7",
"electron-builder": "^20.27.1",
"electron-reload": "^1.2.5",
"fs-extra": "^5.0.0",
"jasmine-core": "^2.99.1",
"dotenv": "^6.1.0",
"electron": "^3.0.8",
"electron-builder": "^20.34.0",
"electron-reload": "^1.3.0",
"fs-extra": "^7.0.1",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^3.0.0",
"karma": "^3.1.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.3",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^1.2.0",
"karma-jasmine-html-reporter": "^1.4.0",
"npm-run-all": "^4.1.3",
"protractor": "^5.4.0",
"protractor": "^5.4.1",
"replace": "^1.0.0",
"rxjs": "^6.2.2",
"ts-node": "^4.1.0",
"rxjs": "^6.3.3",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "^2.9.2",
"wait-on": "^2.1.0",
"webdriver-manager": "^12.0.6",
"typescript": "^3.1.6",
"wait-on": "^3.2.0",
"webdriver-manager": "^12.1.0",
"zone.js": "^0.8.26"
}
}

View File

@@ -41,18 +41,18 @@ export class CurrencyListComponent implements OnInit {
}
public getExchangeCurrencies(): void {
for (let i = 0; i < this.settings.Exchanges.length; i++) {
if (this.settings.Exchanges[i].Enabled === true) {
for (let j = 0; j < this.settings.Exchanges[i].Pairs.length; j++) {
if (this.settings.Exchanges[i].Pairs[j].Enabled) {
if (this.exchangeCurrencies.has(this.settings.Exchanges[i].Pairs[j].ParsedName)) {
const array = this.exchangeCurrencies.get(this.settings.Exchanges[i].Pairs[j].ParsedName);
array.push(this.settings.Exchanges[i].Name);
this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, array);
for (let i = 0; i < this.settings.exchanges.length; i++) {
if (this.settings.exchanges[i].enabled === true) {
for (let j = 0; j < this.settings.exchanges[i].pairs.length; j++) {
if (this.settings.exchanges[i].pairs[j].enabled) {
if (this.exchangeCurrencies.has(this.settings.exchanges[i].pairs[j].parsedName)) {
const array = this.exchangeCurrencies.get(this.settings.exchanges[i].pairs[j].parsedName);
array.push(this.settings.exchanges[i].name);
this.exchangeCurrencies.set(this.settings.exchanges[i].pairs[j].parsedName, array);
} else {
const exchangeArray = new Array<string>();
exchangeArray.push(this.settings.Exchanges[i].Name);
this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, exchangeArray);
exchangeArray.push(this.settings.exchanges[i].name);
this.exchangeCurrencies.set(this.settings.exchanges[i].pairs[j].parsedName, exchangeArray);
}
}
}

View File

@@ -13,9 +13,9 @@
</div>
<form class="form-content">
<mat-list>
<mat-list-item [ngClass]="{'selected' : selectedCurrency == currency.ParsedName && selectedExchange == exchange.value }" *ngFor="let currency of exchange.key | enabledCurrencies" >
<h4 matLine>{{currency.ParsedName}}</h4>
<button mat-button (click)="selectCurrency(exchange.value,currency.ParsedName)">SELECT</button>
<mat-list-item [ngClass]="{'selected' : selectedCurrency == currency.parsedName && selectedExchange == exchange.value }" *ngFor="let currency of exchange.key | enabledCurrencies" >
<h4 matLine>{{currency.parsedName}}</h4>
<button mat-button (click)="selectCurrency(exchange.value,currency.parsedName)">SELECT</button>
</mat-list-item>
</mat-list>
</form>

View File

@@ -42,9 +42,9 @@ export class ExchangeGridComponent implements OnInit {
}
public getExchangeCurrencies(): void {
for (let i = 0; i < this.settings.Exchanges.length; i++) {
if (this.settings.Exchanges[i].Enabled === true) {
this.exchangeCurrencies.set(this.settings.Exchanges[i].Name, this.settings.Exchanges[i].Pairs);
for (let i = 0; i < this.settings.exchanges.length; i++) {
if (this.settings.exchanges[i].enabled === true) {
this.exchangeCurrencies.set(this.settings.exchanges[i].name, this.settings.exchanges[i].pairs);
}
}
this.exchangeCurrencies.forEach((value: CurrencyPairRedux[], key: string) => {});

View File

@@ -17,24 +17,24 @@
</mat-expansion-panel-header>
<form class="form-content">
<mat-form-field>
<input matInput name="username" [(ngModel)]="settings.Webserver.AdminUsername" placeholder="Username">
<input matInput name="username" [(ngModel)]="settings.webserver.adminUsername" placeholder="Username">
</mat-form-field>
<mat-form-field>
<input matInput name="password" type="password" [(ngModel)]="settings.Webserver.AdminPassword" placeholder="Password">
<input matInput name="password" type="password" [(ngModel)]="settings.webserver.adminPassword" placeholder="Password">
</mat-form-field>
<mat-form-field>
<input type="number" matInput name="connection-limit" [(ngModel)]="settings.Webserver.WebsocketConnectionLimit" placeholder="Websocket connection limit">
<input type="number" matInput name="connection-limit" [(ngModel)]="settings.webserver.websocketConnectionLimit" placeholder="Websocket connection limit">
</mat-form-field>
<mat-checkbox name="allow-insecure-origin" [(ngModel)]="settings.Webserver.WebsocketAllowInsecureOrigin">Allow Insecure Websocket Origin</mat-checkbox>
<mat-checkbox name="allow-insecure-origin" [(ngModel)]="settings.webserver.websocketAllowInsecureOrigin">Allow Insecure Websocket Origin</mat-checkbox>
</form>
</mat-expansion-panel>
<!--CURRENCY SETTINGS-->
<mat-expansion-panel *ngFor="let provider of settings.CurrencyConfig?.ForexProviders">
<mat-expansion-panel *ngFor="let provider of settings.currencyConfig?.forexProviders">
<mat-expansion-panel-header>
<mat-panel-title>
{{provider.Name}}
{{provider.name}}
</mat-panel-title>
<mat-panel-description>
Forex Providers
@@ -42,21 +42,21 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="fpEnabled" [(ngModel)]="provider.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="fpEnabled" [(ngModel)]="provider.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-checkbox name="fpVerbose" [(ngModel)]="provider.Verbose" [disabled]="!provider.Enabled">Verbose</mat-checkbox>
<mat-checkbox name="fpVerbose" [(ngModel)]="provider.verbose" [disabled]="!provider.enabled">Verbose</mat-checkbox>
<div mat-line></div>
<div mat-line></div>
<mat-form-field>
<input matInput name="fpPollingDelay" type="number" [(ngModel)]="provider.RESTPollingDelay" [disabled]="!provider.Enabled" placeholder="Polling Delay">
<input matInput name="fpPollingDelay" type="number" [(ngModel)]="provider.RESTPollingDelay" [disabled]="!provider.enabled" placeholder="Polling Delay">
</mat-form-field>
<mat-form-field>
<input matInput name="fpKey" type="password" [(ngModel)]="provider.APIKey" [disabled]="!provider.Enabled" placeholder="APIKey">
<input matInput name="fpKey" type="password" [(ngModel)]="provider.APIKey" [disabled]="!provider.enabled" placeholder="APIKey">
</mat-form-field>
<mat-form-field>
<input matInput name="fpKeyLevel" [(ngModel)]="provider.APIKeyLvl" [disabled]="!provider.Enabled" placeholder="APIKey Level">
<input matInput name="fpKeyLevel" [(ngModel)]="provider.APIKeyLvl" [disabled]="!provider.enabled" placeholder="APIKey Level">
</mat-form-field>
<mat-checkbox name="fpPrimary" [(ngModel)]="provider.PrimaryProvider">Primary Provider</mat-checkbox>
<mat-checkbox name="fpPrimary" [(ngModel)]="provider.primaryProvider">Primary Provider</mat-checkbox>
</form>
</mat-expansion-panel>
@@ -73,25 +73,25 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="smsEnabled" [(ngModel)]="settings.Communications.SMSGlobal.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="smsEnabled" [(ngModel)]="settings.communications.smsGlobal.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-checkbox name="smsVerbose" [(ngModel)]="settings.Communications.SMSGlobal.Verbose" [disabled]="!settings?.Communications.SMSGlobal.Enabled">Verbose</mat-checkbox>
<mat-checkbox name="smsVerbose" [(ngModel)]="settings.communications.smsGlobal.verbose" [disabled]="!settings?.communications.smsGlobal.enabled">Verbose</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="smsUsername" [(ngModel)]="settings.Communications.SMSGlobal.Username" [disabled]="!settings?.Communications.SMSGlobal.Enabled" placeholder="Username">
<input matInput name="smsUsername" [(ngModel)]="settings.communications.smsGlobal.username" [disabled]="!settings?.communications.smsGlobal.enabled" placeholder="Username">
</mat-form-field>
<mat-form-field>
<input matInput name="smsPassword" type="password" [(ngModel)]="settings.Communications.SMSGlobal.Password" [disabled]="!settings?.Communications.SMSGlobal.Enabled" placeholder="Password">
<input matInput name="smsPassword" type="password" [(ngModel)]="settings.communications.smsGlobal.Password" [disabled]="!settings?.communications.smsGlobal.enabled" placeholder="Password">
</mat-form-field>
<div *ngFor="let contact of settings.Communications.SMSGlobal?.Contacts">
<mat-checkbox name="contactEnabled" [disabled]="!settings?.Communications.SMSGlobal.Enabled" [(ngModel)]="contact.Enabled">Enabled</mat-checkbox>
<div *ngFor="let contact of settings.communications.smsGlobal?.contacts">
<mat-checkbox name="contactEnabled" [disabled]="!settings?.communications.smsGlobal.enabled" [(ngModel)]="contact.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="contactUsername" [(ngModel)]="contact.Name" [disabled]="!settings.Communications.SMSGlobal.Enabled || !contact.Enabled" placeholder="Contact Name" />
<input matInput name="contactUsername" [(ngModel)]="contact.name" [disabled]="!settings.communications.smsGlobal.enabled || !contact.enabled" placeholder="Contact Name" />
</mat-form-field>
<mat-form-field>
<input matInput name="contactPassword" [(ngModel)]="contact.Number" [disabled]="!settings.Communications.SMSGlobal.Enabled || !contact.Enabled" placeholder="Contact Number" />
<input matInput name="contactPassword" [(ngModel)]="contact.number" [disabled]="!settings.communications.smsGlobal.enabled || !contact.enabled" placeholder="Contact Number" />
</mat-form-field>
</div>
</form>
@@ -112,15 +112,15 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="slackEnabled" [(ngModel)]="settings.Communications.Slack.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="slackEnabled" [(ngModel)]="settings.communications.slack.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-checkbox name="slackVerbose" [disabled]="!settings?.Communications.Slack.Enabled" [(ngModel)]="settings.Communications.Slack.Verbose">Verbose</mat-checkbox>
<mat-checkbox name="slackVerbose" [disabled]="!settings?.communications.slack.enabled" [(ngModel)]="settings.communications.slack.verbose">Verbose</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="slackTargetChannel" [(ngModel)]="settings.Communications.Slack.TargetChannel" [disabled]="!settings?.Communications.Slack.Enabled" placeholder="Target Channel">
<input matInput name="slackTargetChannel" [(ngModel)]="settings.communications.slack.targetChannel" [disabled]="!settings?.communications.slack.enabled" placeholder="Target Channel">
</mat-form-field>
<mat-form-field>
<input matInput name="slackVerificationToken" type="password" [(ngModel)]="settings.Communications.Slack.VerificationToken" [disabled]="!settings?.Communications.Slack.Enabled" placeholder="Verification Token">
<input matInput name="slackVerificationToken" type="password" [(ngModel)]="settings.communications.slack.verificationToken" [disabled]="!settings?.communications.slack.enabled" placeholder="Verification Token">
</mat-form-field>
</form>
</mat-expansion-panel>
@@ -137,26 +137,26 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="smtpEnabled" [(ngModel)]="settings.Communications.SMTP.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="smtpEnabled" [(ngModel)]="settings.communications.smtp.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-checkbox name="smtpVerbose" [disabled]="!settings?.Communications.SMTP.Enabled" [(ngModel)]="settings.Communications.SMTP.Verbose">Verbose</mat-checkbox>
<mat-checkbox name="smtpVerbose" [disabled]="!settings?.communications.smtp.enabled" [(ngModel)]="settings.communications.smtp.verbose">Verbose</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="smtpHost" [(ngModel)]="settings.Communications.SMTP.Host" [disabled]="!settings?.Communications.SMTP.Enabled" placeholder="Host">
<input matInput name="smtpHost" [(ngModel)]="settings.communications.smtp.name" [disabled]="!settings?.communications.smtp.enabled" placeholder="Host">
</mat-form-field>
<mat-form-field>
<input matInput name="smtpPort" type="nunber" [(ngModel)]="settings.Communications.SMTP.Port" [disabled]="!settings?.Communications.SMTP.Enabled" placeholder="Verification Token">
<input matInput name="smtpPort" type="nunber" [(ngModel)]="settings.communications.smtp.port" [disabled]="!settings?.communications.smtp.enabled" placeholder="Verification Token">
</mat-form-field>
<mat-form-field>
<input matInput name="smtpAccountName" [(ngModel)]="settings.Communications.SMTP.AccountName" [disabled]="!settings?.Communications.SMTP.Enabled" placeholder="Account Name">
<input matInput name="smtpAccountName" [(ngModel)]="settings.communications.smtp.accountName" [disabled]="!settings?.communications.smtp.enabled" placeholder="Account Name">
</mat-form-field>
<mat-form-field>
<input matInput name="smtpPassword" type="password" [(ngModel)]="settings.Communications.SMTP.AccountPassword" [disabled]="!settings?.Communications.SMTP.Enabled" placeholder="Account Name">
<input matInput name="smtpPassword" type="password" [(ngModel)]="settings.communications.smtp.accountPassword" [disabled]="!settings?.communications.smtp.enabled" placeholder="Account Name">
</mat-form-field>
<mat-form-field>
<input matInput name="smtpRecipientList" [(ngModel)]="settings.Communications.SMTP.RecipientList" [disabled]="!settings?.Communications.SMTP.Enabled" placeholder="Recipient List (comma seperated)">
<input matInput name="smtpRecipientList" [(ngModel)]="settings.communications.smtp.recipientList" [disabled]="!settings?.communications.smtp.enabled" placeholder="Recipient List (comma seperated)">
</mat-form-field>
</form>
</mat-expansion-panel>
@@ -173,12 +173,12 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="telegramEnabled" [(ngModel)]="settings.Communications.Telegram.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="telegramEnabled" [(ngModel)]="settings.communications.telegram.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-checkbox name="telegramVerbose" [disabled]="!settings?.Communications.Telegram.Enabled" [(ngModel)]="settings.Communications.Telegram.Verbose">Verbose</mat-checkbox>
<mat-checkbox name="telegramVerbose" [disabled]="!settings?.communications.telegram.enabled" [(ngModel)]="settings.communications.telegram.verbose">Verbose</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="slackVerificationToken" type="password" [(ngModel)]="settings.Communications.Telegram.VerificationToken" [disabled]="!settings?.Communications.Telegram.Enabled" placeholder="Verification Token">
<input matInput name="slackVerificationToken" type="password" [(ngModel)]="settings.communications.telegram.verificationToken" [disabled]="!settings?.communications.telegram.enabled" placeholder="Verification Token">
</mat-form-field>
</form>
</mat-expansion-panel>
@@ -194,15 +194,15 @@
<mat-icon>account_balance_wallet</mat-icon>
</mat-panel-description>
</mat-expansion-panel-header>
<div *ngFor="let wallet of settings.PortfolioAddresses?.Addresses">
<div *ngFor="let wallet of settings.PortfolioAddresses?.addresses">
<mat-form-field class="long">
<input matInput name="wallet-address" [(ngModel)]="wallet.Address" placeholder="Address" />
<input matInput name="wallet-address" [(ngModel)]="wallet.address" placeholder="Address" />
</mat-form-field>
<mat-form-field>
<input matInput name="wallet-cointype" [(ngModel)]="wallet.CoinType" placeholder="Coin Type" />
<input matInput name="wallet-cointype" [(ngModel)]="wallet.coinType" placeholder="Coin Type" />
</mat-form-field>
<mat-form-field>
<input matInput name="wallet-description" [(ngModel)]="wallet.Description" placeholder="Description" />
<input matInput name="wallet-description" [(ngModel)]="wallet.description" placeholder="Description" />
</mat-form-field>
<button mat-button (click)="removeWallet(wallet)">REMOVE</button>
</div>
@@ -212,10 +212,10 @@
</mat-expansion-panel>
<!--EXCHANGE SETTINGS-->
<mat-expansion-panel *ngFor="let exchange of settings?.Exchanges">
<mat-expansion-panel *ngFor="let exchange of settings?.exchanges">
<mat-expansion-panel-header>
<mat-panel-title>
{{exchange.Name}}
{{exchange.name}}
</mat-panel-title>
<mat-panel-description>
Exchange Settings
@@ -223,23 +223,23 @@
</mat-panel-description>
</mat-expansion-panel-header>
<form class="form-content">
<mat-checkbox name="exchangeEnabled" [(ngModel)]="exchange.Enabled">Enabled</mat-checkbox>
<mat-checkbox name="exchangeEnabled" [(ngModel)]="exchange.enabled">Enabled</mat-checkbox>
<div mat-line></div>
<mat-form-field>
<input matInput name="apiKey" [(ngModel)]="exchange.APIKey" [disabled]="!exchange.Enabled" placeholder="API Key*">
<input matInput name="apiKey" [(ngModel)]="exchange.APIKey" [disabled]="!exchange.enabled" placeholder="API Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiSecretKey" type="password" [(ngModel)]="exchange.APISecret" [disabled]="!exchange.Enabled" placeholder="API Secret Key*">
<input matInput name="apiSecretKey" type="password" [(ngModel)]="exchange.APISecret" [disabled]="!exchange.enabled" placeholder="API Secret Key*">
</mat-form-field>
<mat-form-field>
<input matInput name="apiClientId" [(ngModel)]="exchange.ClientID" [disabled]="!exchange.Enabled" placeholder="API ClientID">
<input matInput name="apiClientId" [(ngModel)]="exchange.clientID" [disabled]="!exchange.enabled" placeholder="API ClientID">
</mat-form-field>
<div mat-line></div>
<h4>
Enabled currencies
</h4>
<p><span *ngFor="let pair of exchange.Pairs | enabledCurrencies; let isLast=last">{{pair.Name}}{{isLast ? '' : ', '}}</span> </p>
<button mat-button [disabled]="!exchange.Enabled" (click)="openModal(exchange.Pairs)">CHANGE</button>
<p><span *ngFor="let pair of exchange.pairs | enabledCurrencies; let isLast=last">{{pair.name}}{{isLast ? '' : ', '}}</span> </p>
<button mat-button [disabled]="!exchange.enabled" (click)="openModal(exchange.pairs)">CHANGE</button>
</form>
</mat-expansion-panel>

View File

@@ -1,5 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {MatProgressSpinnerModule} from '@angular/material';
import { SettingsComponent } from './settings.component';
describe('SettingsComponent', () => {
@@ -8,7 +8,7 @@ describe('SettingsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingsComponent ]
declarations: [ SettingsComponent, MatProgressSpinnerModule ]
})
.compileComponents();
}));

View File

@@ -8,7 +8,7 @@ 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>'
+ '<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 {
@@ -71,11 +71,11 @@ export class SettingsComponent implements OnInit {
}
public addWallet(): void {
this.settings.PortfolioAddresses.Addresses.push(<Wallet>{});
this.settings.portfolioAddresses.Addresses.push(<Wallet>{});
}
public removeWallet(wallet: any) {
this.settings.PortfolioAddresses.Addresses.splice(this.settings.PortfolioAddresses.Addresses.indexOf(wallet), 1);
this.settings.portfolioAddresses.Addresses.splice(this.settings.portfolioAddresses.Addresses.indexOf(wallet), 1);
}

View File

@@ -1,22 +1,157 @@
import { inherits } from 'util';
export interface ForexProvider {
name: string;
enabled: boolean;
verbose: boolean;
restPollingDelay: number;
apiKey: string;
apiKeyLvl: number;
primaryProvider: boolean;
}
export interface CurrencyPairFormat {
uppercase: boolean;
delimiter: string;
}
export interface CurrencyConfig {
forexProviders: ForexProvider[];
cryptocurrencies: string;
currencyPairFormat: CurrencyPairFormat;
fiatDisplayCurrency: string;
}
export interface Slack {
name: string;
enabled: boolean;
verbose: boolean;
targetChannel: string;
verificationToken: string;
}
export interface Contact {
name: string;
number: string;
enabled: boolean;
}
export interface SmsGlobal {
name: string;
enabled: boolean;
verbose: boolean;
username: string;
password: string;
contacts: Contact[];
}
export interface Smtp {
name: string;
enabled: boolean;
verbose: boolean;
host: string;
port: string;
accountName: string;
accountPassword: string;
recipientList: string;
}
export interface Telegram {
name: string;
enabled: boolean;
verbose: boolean;
verificationToken: string;
}
export interface Communications {
slack: Slack;
smsGlobal: SmsGlobal;
smtp: Smtp;
telegram: Telegram;
}
export interface Address {
Address: string;
CoinType: string;
Balance: number;
Description: string;
}
export interface Webserver {
enabled: boolean;
adminUsername: string;
adminPassword: string;
listenAddress: string;
websocketConnectionLimit: number;
websocketMaxAuthFailures: number;
websocketAllowInsecureOrigin: boolean;
}
export interface ConfigCurrencyPairFormat {
uppercase: boolean;
delimiter: string;
}
export interface RequestCurrencyPairFormat {
uppercase: boolean;
}
export interface BankAccount {
bankName: string;
bankAddress: string;
accountName: string;
accountNumber: string;
swiftCode: string;
iban: string;
supportedCurrencies: string;
}
export interface Exchange {
name: string;
enabled: boolean;
verbose: boolean;
websocket: boolean;
useSandbox: boolean;
restPollingDelay: number;
httpTimeout: number;
httpUserAgent: string;
authenticatedApiSupport: boolean;
apiKey: string;
apiSecret: string;
apiUrl: string;
apiUrlSecondary: string;
availablePairs: string;
enabledPairs: string;
baseCurrencies: string;
assetTypes: string;
supportsAutoPairUpdates: boolean;
configCurrencyPairFormat: ConfigCurrencyPairFormat;
requestCurrencyPairFormat: RequestCurrencyPairFormat;
bankAccounts: BankAccount[];
pairs: CurrencyPairRedux[];
}
export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
name: string;
parsedName: string;
enabled: boolean;
}
export class Config {
Name: string;
EncryptConfig?: number;
Cryptocurrencies: string;
CurrencyExchangeProvider: string;
CurrencyPairFormat: CurrencyPairFormat;
PortfolioAddresses: PortfolioAddresses;
Webserver: Webserver;
Exchanges: Exchange[];
Communications: Communcations;
CurrencyConfig: CurrencyConfig;
name: string;
encryptConfig: number;
globalHTTPTimeout: number;
currencyConfig: CurrencyConfig;
communications: Communications;
portfolioAddresses: PortfolioAddresses;
webserver: Webserver;
exchanges: Exchange[];
public isConfigCacheValid(): boolean {
const dateStored = +new Date(window.localStorage['configDate']);
@@ -33,20 +168,17 @@ export class Config {
public setConfig(data: any): void {
const configData = <Config>data;
this.Cryptocurrencies = configData.Cryptocurrencies;
this.CurrencyExchangeProvider = configData.CurrencyExchangeProvider;
this.Exchanges = configData.Exchanges;
this.CurrencyPairFormat = configData.CurrencyPairFormat;
this.EncryptConfig = configData.EncryptConfig;
this.Exchanges = configData.Exchanges;
this.Name = configData.Name;
this.PortfolioAddresses = configData.PortfolioAddresses;
this.Communications = configData.Communications;
this.CurrencyConfig = configData.CurrencyConfig;
this.Webserver = configData.Webserver;
if (configData.Exchanges.length > 0
&& configData.Exchanges[0].Pairs
&& configData.Exchanges[0].Pairs.length > 0) {
this.communications = configData.communications;
this.currencyConfig = configData.currencyConfig;
this.encryptConfig = configData.encryptConfig;
this.globalHTTPTimeout = configData.globalHTTPTimeout;
this.name = configData.name;
this.portfolioAddresses = configData.portfolioAddresses;
this.exchanges = configData.exchanges;
this.webserver = configData.webserver;
if (configData.exchanges.length > 0
&& configData.exchanges[0].pairs
&& configData.exchanges[0].pairs.length > 0) {
console.log('Successfully retrieved well-formed pairs');
return;
}
@@ -66,20 +198,20 @@ export class Config {
}
public fromArrayToRedux(): void {
for (let i = 0; i < this.Exchanges.length; i++) {
this.Exchanges[i].Pairs = new Array<CurrencyPairRedux>();
const avail = this.Exchanges[i].AvailablePairs.split(',');
const enabled = this.Exchanges[i].EnabledPairs.split(',');
for (let i = 0; i < this.exchanges.length; i++) {
this.exchanges[i].pairs = new Array<CurrencyPairRedux>();
const avail = this.exchanges[i].availablePairs.split(',');
const enabled = this.exchanges[i].enabledPairs.split(',');
for (let j = 0; j < avail.length; j++) {
const currencyPair = new CurrencyPairRedux();
currencyPair.Name = avail[j];
currencyPair.ParsedName = this.stripCurrencyCharacters(avail[j]);
currencyPair.name = avail[j];
currencyPair.parsedName = this.stripCurrencyCharacters(avail[j]);
if (enabled.indexOf(avail[j]) > 0) {
currencyPair.Enabled = true;
currencyPair.enabled = true;
} else {
currencyPair.Enabled = false;
currencyPair.enabled = false;
}
this.Exchanges[i].Pairs.push(currencyPair);
this.exchanges[i].pairs.push(currencyPair);
}
}
@@ -98,23 +230,23 @@ export class Config {
}
public fromReduxToArray(): void {
for (let i = 0; i < this.Exchanges.length; i++) {
for (let i = 0; i < this.exchanges.length; i++) {
// Step 1, iterate over the Pairs
const enabled = this.Exchanges[i].EnabledPairs.split(',');
for (let j = 0; j < this.Exchanges[i].Pairs.length; j++) {
if (this.Exchanges[i].Pairs[j].Enabled) {
if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) === -1) {
const enabled = this.exchanges[i].enabledPairs.split(',');
for (let j = 0; j < this.exchanges[i].pairs.length; j++) {
if (this.exchanges[i].pairs[j].enabled) {
if (enabled.indexOf(this.exchanges[i].pairs[j].name) === -1) {
// Step 3 if its not in the enabled list, add it
enabled.push(this.Exchanges[i].Pairs[j].Name);
enabled.push(this.exchanges[i].pairs[j].name);
}
} else {
if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) > -1) {
enabled.splice(enabled.indexOf(this.Exchanges[i].Pairs[j].Name), 1);
if (enabled.indexOf(this.exchanges[i].pairs[j].name) > -1) {
enabled.splice(enabled.indexOf(this.exchanges[i].pairs[j].name), 1);
}
}
}
// Step 4 JSONifiy the enabled list and set it to the this.settings.Exchanges[i].EnabledPairs
this.Exchanges[i].EnabledPairs = enabled.join();
this.exchanges[i].enabledPairs = enabled.join();
}
}
}
@@ -167,22 +299,22 @@ export class Config {
}
export interface Exchange {
Name: string;
Enabled: boolean;
Verbose: boolean;
Websocket: boolean;
name: string;
enabled: boolean;
verbose: boolean;
websocket: boolean;
RESTPollingDelay: number;
AuthenticatedAPISupport: boolean;
authenticatedAPISupport: boolean;
APIKey: string;
APISecret: string;
AvailablePairs: string;
EnabledPairs: string;
BaseCurrencies: string;
AssetTypes: string;
ConfigCurrencyPairFormat: ConfigCurrencyPairFormat;
RequestCurrencyPairFormat: RequestCurrencyPairFormat;
ClientID: string;
Pairs: CurrencyPairRedux[];
availablePairs: string;
enabledPairs: string;
baseCurrencies: string;
assetTypes: string;
configCurrencyPairFormat: ConfigCurrencyPairFormat;
requestCurrencyPairFormat: RequestCurrencyPairFormat;
clientID: string;
pairs: CurrencyPairRedux[];
}

View File

@@ -39,7 +39,7 @@ import { CurrencyPairRedux } from './../../shared/classes/config';
if (!items) {
return items;
}
return items.filter(item => item.Enabled === true);
return items.filter(item => item.enabled === true);
}
}