diff --git a/web/package.json b/web/package.json index b2df9ba6..11dc321d 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "gocryptotrader-web", - "version": "0.3.0", + "version": "0.4.0", "description": "Front-end interface for GoCryptoTrader", "homepage": "https://github.com/thrasher-/gocryptotrader", "author": { @@ -9,13 +9,11 @@ "github": "https://github.com/gloriousCode/", "website": "https://www.gloriousedge.com" }, - "contributers": [ - { - "name": "Maxime GRIS", - "email": "maxime.gris@gmail.com", - "github": "https://github.com/maximegris/" - } - ], + "contributers": [{ + "name": "Maxime GRIS", + "email": "maxime.gris@gmail.com", + "github": "https://github.com/maximegris/" + }], "keywords": [ "angular", "electron", @@ -97,4 +95,4 @@ "webdriver-manager": "12.0.6", "zone.js": "0.8.26" } -} +} \ No newline at end of file diff --git a/web/src/app/pages/settings/settings.component.html b/web/src/app/pages/settings/settings.component.html index 9a806bff..66ec3041 100644 --- a/web/src/app/pages/settings/settings.component.html +++ b/web/src/app/pages/settings/settings.component.html @@ -4,6 +4,7 @@
+ @@ -19,16 +20,48 @@ - + - + Allow Insecure Websocket Origin - + - + + + + + + {{provider.Name}} + + + Forex Providers + attach_money + + +
+ Enabled +
+ Verbose +
+
+ + + + + + + + + + Primary Provider +
+ +
+ + @@ -40,23 +73,25 @@
- Enabled + Enabled +
+ Verbose
- + - + - -
- Enabled + +
+ Enabled
- + - +
@@ -65,34 +100,118 @@ - + - - - Wallets - - - Wallet Address Settings - account_balance_wallet - - -
- - - - - - - - - - -
- - - -
- + + + Slack Notifications + + + Notification Settings + apps + + +
+ Enabled +
+ Verbose +
+ + + + + + +
+ + + + + + + SMTP Notifications + + + Notification Settings + mail_outline + + +
+ Enabled +
+ Verbose +
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + Telegram Notifications + + + Notification Settings + send + + +
+ Enabled +
+ Verbose +
+ + + +
+
+ + + + + + Wallets + + + Wallet Address Settings + account_balance_wallet + + +
+ + + + + + + + + + +
+ + + +
+ + @@ -119,7 +238,7 @@

Enabled currencies

-

{{pair.Name}}{{isLast ? '' : ', '}}

+

{{pair.Name}}{{isLast ? '' : ', '}}

diff --git a/web/src/app/shared/classes/config.ts b/web/src/app/shared/classes/config.ts index 9f2970d4..5bedd701 100644 --- a/web/src/app/shared/classes/config.ts +++ b/web/src/app/shared/classes/config.ts @@ -1,14 +1,16 @@ +import { inherits } from "util"; - export class Config { +export class Config { Name: string; EncryptConfig?: number; Cryptocurrencies: string; CurrencyExchangeProvider: string; CurrencyPairFormat: CurrencyPairFormat; PortfolioAddresses: PortfolioAddresses; - SMSGlobal: SMSGlobal; Webserver: Webserver; Exchanges: Exchange[]; + Communications: Communcations; + CurrencyConfig: CurrencyConfig; public isConfigCacheValid() : boolean { let dateStored = +new Date(window.localStorage['configDate']); @@ -25,28 +27,29 @@ } } - public setConfig(data: any) : void { - var configData = 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.SMSGlobal = configData.SMSGlobal - 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; - } - this.fromArrayToRedux(); - //Rewrite to cache on parsing to redux array - this.saveToCache(); + public setConfig(data: any): void { + var configData = 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) { + console.log('Successfully retrieved well-formed pairs'); + return; } + this.fromArrayToRedux(); + //Rewrite to cache on parsing to redux array + this.saveToCache(); + } public saveToCache() : void { window.localStorage['config'] = JSON.stringify(this); @@ -135,18 +138,12 @@ export class CurrencyPairRedux { } - export interface Contact { + export class SMSGlobalContact { Name: string; Number: string; Enabled: boolean; } - export interface SMSGlobal { - Enabled: boolean; - Username: string; - Password: string; - Contacts: Contact[]; - } export interface Webserver { Enabled: boolean; @@ -187,7 +184,72 @@ export class CurrencyPairRedux { RequestCurrencyPairFormat: RequestCurrencyPairFormat; ClientID: string; Pairs: CurrencyPairRedux[]; - } +} + + +export class Communcations { + Slack: SlackCommunication; + SMSGlobal: SMSGlobalCommunication; + SMTP: SMTPCommunication; + Telegram: TelegramCommunication; +} + + +export class SlackCommunication { + Name: string; + Enabled: boolean; + Verbose: boolean; + TargetChannel: string; + VerificationToken: string; +} + +export class SMSGlobalCommunication { + Name: string; + Enabled: boolean; + Verbose: boolean; + Username: string; + Password: string; + Contacts: SMSGlobalContact[]; +} + +export class SMTPCommunication { + Name: string; + Enabled: boolean; + Verbose: boolean; + Host: string; + Port: number; + AccountName: string; + AccountPassword: string; + RecipentList: string; +} + +export class TelegramCommunication { + Name: string; + Enabled: boolean; + Verbose: boolean; + VerificationToken: string; +} + +export class CurrencyConfig { + ForexProviders: ForexProviders[]; + Cyptocurrencies: string; + CurrencyPairFormat: CurrencyPairFormat; + FiatDisplayCurrency: string; +} + +export class ForexProviders { + Name: string; + Enabled: boolean; + Verbose: boolean; + RESTPollingDelay: number; + APIKey: string; + PrimaryProvier: boolean; +} + +export class CurrencyPairFormat { + Uppercase: boolean; + Delimiter: string; +}