From 946d4c6c1d461dac302982b22dde550aeb4d33cb Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 9 Sep 2021 08:55:13 -0600 Subject: [PATCH] fix form display for services with no config --- ui/src/app/modals/app-config/app-config.page.html | 11 +++++++---- ui/src/app/modals/app-config/app-config.page.ts | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/src/app/modals/app-config/app-config.page.html b/ui/src/app/modals/app-config/app-config.page.html index f59c2a427..3db4fa6e1 100644 --- a/ui/src/app/modals/app-config/app-config.page.html +++ b/ui/src/app/modals/app-config/app-config.page.html @@ -6,7 +6,7 @@ Config - + Reset Defaults @@ -24,7 +24,7 @@ - + To use the default config for {{ pkg.manifest.title }}, click "Save" below. @@ -66,7 +66,7 @@ -
+ - + Save + + Close + diff --git a/ui/src/app/modals/app-config/app-config.page.ts b/ui/src/app/modals/app-config/app-config.page.ts index 5e332c4a5..e77777cd3 100644 --- a/ui/src/app/modals/app-config/app-config.page.ts +++ b/ui/src/app/modals/app-config/app-config.page.ts @@ -72,18 +72,18 @@ export class AppConfigPage { this.configForm.markAllAsTouched() if (depConfig) { - this.markDirtyRecursive(this.configForm, depConfig) + this.alterConfigRecursive(this.configForm, depConfig) } } - markDirtyRecursive (group: FormGroup, config: object) { + alterConfigRecursive (group: FormGroup, config: object) { Object.keys(config).forEach(key => { const next = group.get(key) if (!next) throw new Error('Dependency config not compatible with service version. Please contact support') const newVal = config[key] // check if val is an object if (newVal && typeof newVal === 'object' && !Array.isArray(newVal)) { - this.markDirtyRecursive(next as FormGroup, newVal) + this.alterConfigRecursive(next as FormGroup, newVal) } else { let val1 = group.get(key).value let val2 = config[key] @@ -98,7 +98,7 @@ export class AppConfigPage { resetDefaults () { this.configForm = this.formService.createForm(this.configSpec) - this.markDirtyRecursive(this.configForm, this.current) + this.alterConfigRecursive(this.configForm, this.current) } dismissRec () {