diff --git a/client/src/app/ctl/config/config-context/config-context.component.html b/client/src/app/ctl/config/config-context/config-context.component.html index 01012a7..800f4c6 100644 --- a/client/src/app/ctl/config/config-context/config-context.component.html +++ b/client/src/app/ctl/config/config-context/config-context.component.html @@ -4,22 +4,32 @@

{{context.name}}

- ContextKubeconf: + - - - Manifest: - - - - EncryptionConfig: - - - - ManagementConfiguration: - - - + Kubeconfig Context + +
+ + Manifest + + {{m}} + +
+ + Encryption Config + + + None + {{e}} + +
+ + Management Config + + {{m}} + +
- +

diff --git a/client/src/app/ctl/config/config-encryption/config-encryption.component.ts b/client/src/app/ctl/config/config-encryption/config-encryption.component.ts index 14293bb..433dff7 100644 --- a/client/src/app/ctl/config/config-encryption/config-encryption.component.ts +++ b/client/src/app/ctl/config/config-encryption/config-encryption.component.ts @@ -13,7 +13,7 @@ */ import { Component, OnInit, Input } from '@angular/core'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormGroup, Validators, AbstractControl } from '@angular/forms'; import { EncryptionConfig, EncryptionConfigOptions } from '../config.models'; import { WsService } from 'src/services/ws/ws.service'; import { WsMessage, WsConstants } from 'src/services/ws/ws.models'; @@ -29,26 +29,35 @@ export class ConfigEncryptionComponent implements OnInit { component = WsConstants.CONFIG; locked = true; - name = new FormControl({value: '', disabled: true}); - encryptionKeyPath = new FormControl({value: '', disabled: true}); - decryptionKeyPath = new FormControl({value: '', disabled: true}); - keySecretName = new FormControl({value: '', disabled: true}); - keySecretNamespace = new FormControl({value: '', disabled: true}); + group: FormGroup; - controlsArray = [this.encryptionKeyPath, this.decryptionKeyPath, this.keySecretName, this.keySecretNamespace]; + configOptions: AbstractControl[] = []; constructor(private websocketService: WsService) {} ngOnInit(): void { - this.name.setValue(this.config.name); - this.encryptionKeyPath.setValue(this.config.encryptionKeyPath); - this.decryptionKeyPath.setValue(this.config.decryptionKeyPath); - this.keySecretName.setValue(this.config.keySecretName); - this.keySecretNamespace.setValue(this.config.keySecretNamespace); + this.group = new FormGroup({ + encryptionKeyPath: new FormControl({value: this.config.encryptionKeyPath, disabled: true}, + Validators.required), + decryptionKeyPath: new FormControl({value: this.config.decryptionKeyPath, disabled: true}, + Validators.required), + keySecretName: new FormControl({value: this.config.keySecretName, disabled: true}, + Validators.required), + keySecretNamespace: new FormControl({value: this.config.keySecretNamespace, disabled: true}, + Validators.required) + }); + + if (this.config.hasOwnProperty('encryptionKeyPath')) { + this.configOptions.push(this.group.controls.encryptionKeyPath); + this.configOptions.push(this.group.controls.decryptionKeyPath); + } else { + this.configOptions.push(this.group.controls.keySecretName); + this.configOptions.push(this.group.controls.keySecretNamespace); + } } toggleLock(): void { - for (const control of this.controlsArray) { + for (const control of this.configOptions) { if (this.locked) { control.enable(); } else { @@ -61,16 +70,16 @@ export class ConfigEncryptionComponent implements OnInit { setEncryptionConfig(): void { const opts: EncryptionConfigOptions = { - Name: this.name.value, - EncryptionKeyPath: this.encryptionKeyPath.value, - DecryptionKeyPath: this.decryptionKeyPath.value, - KeySecretName: this.keySecretName.value, - KeySecretNamespace: this.keySecretNamespace.value, + Name: this.config.name, + EncryptionKeyPath: this.group.controls.encryptionKeyPath.value, + DecryptionKeyPath: this.group.controls.decryptionKeyPath.value, + KeySecretName: this.group.controls.keySecretName.value, + KeySecretNamespace: this.group.controls.keySecretNamespace.value, }; const msg = new WsMessage(this.type, this.component, WsConstants.SET_ENCRYPTION_CONFIG); msg.data = JSON.parse(JSON.stringify(opts)); - msg.name = this.name.value; + msg.name = this.config.name; this.websocketService.sendMessage(msg); this.toggleLock(); diff --git a/client/src/app/ctl/config/config-management/config-management.component.html b/client/src/app/ctl/config/config-management/config-management.component.html index baa42dc..7994969 100644 --- a/client/src/app/ctl/config/config-management/config-management.component.html +++ b/client/src/app/ctl/config/config-management/config-management.component.html @@ -4,24 +4,26 @@

{{config.Name}}

+

- Insecure: + Insecure

- SystemActionRetries: - - - SystemRebootDelay: + System Action Retries + +
- - - Type: + System Reboot Delay + +
- + Type +

- UseProxy: + UseProxy

+
- +

diff --git a/client/src/app/ctl/config/config-management/config-management.component.ts b/client/src/app/ctl/config/config-management/config-management.component.ts index 062c6a1..e77d18b 100644 --- a/client/src/app/ctl/config/config-management/config-management.component.ts +++ b/client/src/app/ctl/config/config-management/config-management.component.ts @@ -14,7 +14,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { ManagementConfig } from '../config.models'; -import { FormControl, Validators } from '@angular/forms'; +import { FormControl, FormGroup, Validators, AbstractControl } from '@angular/forms'; import { WsService } from 'src/services/ws/ws.service'; import { WsMessage, WsConstants } from 'src/services/ws/ws.models'; @@ -30,50 +30,43 @@ export class ConfigManagementComponent implements OnInit { locked = true; - name = new FormControl({value: '', disabled: true}); - insecure = new FormControl({value: false, disabled: true}); - systemActionRetries = new FormControl({value: '', disabled: true}, Validators.pattern('[0-9]*')); - systemRebootDelay = new FormControl({value: '', disabled: true}, Validators.pattern('[0-9]*')); - type = new FormControl({value: '', disabled: true}); - useproxy = new FormControl({value: false, disabled: true}); - - controlsArray = [this.name, this.insecure, this.systemRebootDelay, this.systemActionRetries, this.type, this.useproxy]; + group: FormGroup; constructor(private websocketService: WsService) { } ngOnInit(): void { - this.name.setValue(this.config.Name); - this.insecure.setValue(this.config.insecure); - this.systemActionRetries.setValue(this.config.systemActionRetries); - this.systemRebootDelay.setValue(this.config.systemRebootDelay); - this.type.setValue(this.config.type); - this.useproxy.setValue(this.config.useproxy); + this.group = new FormGroup({ + name: new FormControl({value: this.config.Name, disabled: true}), + insecure: new FormControl({value: this.config.insecure, disabled: true}), + systemActionRetries: new FormControl({value: this.config.systemActionRetries, disabled: true}, + Validators.pattern('^[0-9]*$')), + systemRebootDelay: new FormControl({value: this.config.systemRebootDelay, disabled: true}, + Validators.pattern('^[0-9]*$')), + type: new FormControl({value: this.config.type, disabled: true}), + useproxy: new FormControl({value: this.config.useproxy, disabled: true}) + }); } toggleLock(): void { - for (const control of this.controlsArray) { - if (this.locked) { - control.enable(); - } else { - control.disable(); - } + if (this.group.disabled) { + this.group.enable(); + } else { + this.group.disable(); } - this.locked = !this.locked; } setManagementConfig(): void { const msg = new WsMessage(this.msgType, this.component, WsConstants.SET_MANAGEMENT_CONFIG); - msg.name = this.name.value; + msg.name = this.group.controls.name.value; const cfg: ManagementConfig = { - Name: this.name.value, - insecure: this.insecure.value, - // TODO(mfuller): need to validate these are numerical values in the form - systemActionRetries: +this.systemActionRetries.value, - systemRebootDelay: +this.systemRebootDelay.value, - type: this.type.value, - useproxy: this.useproxy.value + Name: this.group.controls.name.value, + insecure: this.group.controls.insecure.value, + systemActionRetries: +this.group.controls.systemActionRetries.value, + systemRebootDelay: +this.group.controls.systemRebootDelay.value, + type: this.group.controls.type.value, + useproxy: this.group.controls.useproxy.value }; msg.data = JSON.parse(JSON.stringify(cfg)); diff --git a/client/src/app/ctl/config/config.component.html b/client/src/app/ctl/config/config.component.html index ef88267..e66fde4 100755 --- a/client/src/app/ctl/config/config.component.html +++ b/client/src/app/ctl/config/config.component.html @@ -12,7 +12,7 @@ - +