From e8651a52106a8283296dccea2cd0dd64af3bed30 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 5 Jan 2023 23:24:17 +0100 Subject: [PATCH] Fix item hiding in config #569 --- .../settings/template/template.component.ts | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/frontend/app/ui/settings/template/template.component.ts b/src/frontend/app/ui/settings/template/template.component.ts index d03b45f6..37375604 100644 --- a/src/frontend/app/ui/settings/template/template.component.ts +++ b/src/frontend/app/ui/settings/template/template.component.ts @@ -60,7 +60,7 @@ export class TemplateComponent implements OnInit, OnChanges, OnDestroy, ISetting public icon: string; @Input() ConfigPath: string; @Input() enableNesting: boolean; - nestedConfigs: { id: string, name: string, visible: () => boolean,icon:string }[] = []; + nestedConfigs: { id: string, name: string, visible: () => boolean, icon: string }[] = []; @ViewChild('settingsForm', {static: true}) form: FormControl; @@ -182,20 +182,28 @@ export class TemplateComponent implements OnInit, OnChanges, OnDestroy, ISetting } } + const forcedVisibility = !(state.tags?.priority > this.settingsService.configPriority || + //if this value should not change in Docker, lets hide it + (this.settingsService.configPriority === ConfigPriority.basic && + state.tags?.dockerSensitive && this.settingsService.settings.value.Environment.isDocker)); if (state.isConfigArrayType) { for (let i = 0; i < state.value?.length; ++i) { - if (state.value[i].__state && - Object.keys(state.value[i].__state).findIndex(k => !(st.value[i].__state[k].shouldHide && st.value[i].__state[k].shouldHide())) === -1) { - return true; + for (const k of Object.keys(state.value[i].__state)) { + if (!Utils.equalsFilter( + state.value[i]?.__state[k]?.value, + state.default[i] ? state.default[i][k] : undefined, + ['default', '__propPath', '__created', '__prototype', '__rootConfig'])) { + + return false; + } } } - return false; + return !forcedVisibility; } - return ( - (state.tags?.priority > this.settingsService.configPriority || - (this.settingsService.configPriority === ConfigPriority.basic && - state.tags?.dockerSensitive && this.settingsService.settings.value.Environment.isDocker)) && //if this value should not change in Docker, lets hide it + + + return ( !forcedVisibility && Utils.equalsFilter(state.value, state.default, ['__propPath', '__created', '__prototype', '__rootConfig']) && Utils.equalsFilter(state.original, state.default,