Saves settings

This commit is contained in:
gloriousCode
2017-09-17 17:35:03 +10:00
parent 65722afdd7
commit ae14811303
5 changed files with 125 additions and 108 deletions

View File

@@ -60,7 +60,7 @@ import * as Rx from 'rxjs/Rx';
MdFormFieldModule,
MdInputModule,
MdCheckboxModule,
MdGridListModule,
MdGridListModule
],
providers: [ElectronService,WebsocketService,WebsocketHandlerService],
bootstrap: [AppComponent]

View File

@@ -1,4 +1,5 @@
<div *ngIf="settings !== null">
<button (click)="saveSettings()" md-fab color="accent" class="md-fab md-fab-bottom-right">Save</button>
<form *ngIf="settings.SMSGlobal != null">
<md-card class="exchange-card">
<md-card-header>
@@ -26,7 +27,7 @@
</md-grid-list>
<md-grid-list cols="3" rowHeight="2:1" *ngFor="let contact of settings.SMSGlobal?.Contacts">
<md-grid-tile>
<md-checkbox name="contactEnabled" [(ngModel)]="contact.Enabled">Enabled</md-checkbox>
<md-checkbox name="contactEnabled" [disabled]="!settings?.SMSGlobal.Enabled" [(ngModel)]="contact.Enabled">Enabled</md-checkbox>
</md-grid-tile>
<md-grid-tile>
<md-form-field>
@@ -85,7 +86,7 @@
</md-grid-list>
</md-card-content>
</md-card>
</form>
</div>

View File

@@ -10,4 +10,11 @@
.exchange-card {
margin-bottom: 20px;
width: 1000px;
}
.md-fab {
margin: 0;
position: fixed;
bottom: 5%;
right: 2%;
}

View File

@@ -45,6 +45,15 @@ export class SettingsComponent implements OnInit {
}
private saveSettings(): void {
//Send the message
var settingsSave = {
Event: 'SaveConfig',
data: this.settings
}
this.ws.messages.next(settingsSave);
}
private resendMessageIfPageRefreshed(): void {
if (this.failCount <= 5) {