Skip to content

Commit

Permalink
Adds object for settings Jsoin
Browse files Browse the repository at this point in the history
  • Loading branch information
gloriousCode committed Sep 13, 2017
1 parent dfc6b0e commit 9d6f266
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 6 deletions.
4 changes: 3 additions & 1 deletion web/src/app/pages/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<md-form-field class="example-full-width">
<input mdInput placeholder="Favorite food" value="{{Settings?.Name}}">
</md-form-field>
</form>
</form>

{{settings?.EncryptConfig}}
94 changes: 89 additions & 5 deletions web/src/app/pages/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,103 @@
import { Component, OnInit } from '@angular/core';
import { WebsocketHandlerService } from './../../services/websocket-handler/websocket-handler.service';


export interface CurrencyPairFormat {
Uppercase: boolean;
Delimiter: string;
}

export interface PortfolioAddresses {
Addresses?: any;
}

export interface Contact {
Name: string;
Number: string;
Enabled: boolean;
}

export interface SMSGlobal {
Enabled: boolean;
Username: string;
Password: string;
Contacts: Contact[];
}

export interface Webserver {
Enabled: boolean;
AdminUsername: string;
AdminPassword: string;
ListenAddress: string;
WebsocketConnectionLimit: number;
WebsocketAllowInsecureOrigin: boolean;
}

export interface ConfigCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
}

export interface RequestCurrencyPairFormat {
Uppercase: boolean;
Index: string;
Delimiter: string;
Separator: string;
}

export interface Exchange {
Name: string;
Enabled: boolean;
Verbose: boolean;
Websocket: boolean;
RESTPollingDelay: number;
AuthenticatedAPISupport: boolean;
APIKey: string;
APISecret: string;
AvailablePairs: string;
EnabledPairs: string;
BaseCurrencies: string;
AssetTypes: string;
ConfigCurrencyPairFormat: ConfigCurrencyPairFormat;
RequestCurrencyPairFormat: RequestCurrencyPairFormat;
ClientID: string;
}

export interface RootObject {
Name: string;
EncryptConfig?: number;
Cryptocurrencies: string;
CurrencyExchangeProvider: string;
CurrencyPairFormat: CurrencyPairFormat;
PortfolioAddresses: PortfolioAddresses;
SMSGlobal: SMSGlobal;
Webserver: Webserver;
Exchanges: Exchange[];
}


@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
})


export class SettingsComponent implements OnInit {
private settings:any = null;
private settings:RootObject = null;
private ws: WebsocketHandlerService;

constructor(private websocketHandler: WebsocketHandlerService) {
this.ws = websocketHandler;
this.ws.messages.subscribe(msg => {
if(msg.Event == "GetConfig") {
this.settings = msg.data;
} else if (msg.Event == "SaveConfig") {
if(msg.Event === "GetConfig") {
console.log("lol");
this.settings = <RootObject>msg.data;
}
else if (msg.Event === "SaveConfig") {
//something!
}
}
});
}

Expand Down Expand Up @@ -45,4 +125,8 @@ export class SettingsComponent implements OnInit {
}, 1000);
}



}


0 comments on commit 9d6f266

Please sign in to comment.