1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-10 04:07:35 +02:00

Fix item hiding in config #569

This commit is contained in:
Patrik J. Braun 2023-01-05 23:24:17 +01:00
parent 1753bad569
commit e8651a5210

View File

@ -60,7 +60,7 @@ export class TemplateComponent implements OnInit, OnChanges, OnDestroy, ISetting
public icon: string; public icon: string;
@Input() ConfigPath: string; @Input() ConfigPath: string;
@Input() enableNesting: boolean; @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}) @ViewChild('settingsForm', {static: true})
form: FormControl; 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) { if (state.isConfigArrayType) {
for (let i = 0; i < state.value?.length; ++i) { for (let i = 0; i < state.value?.length; ++i) {
if (state.value[i].__state && for (const k of Object.keys(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) { if (!Utils.equalsFilter(
return true; 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 && return ( !forcedVisibility &&
state.tags?.dockerSensitive && this.settingsService.settings.value.Environment.isDocker)) && //if this value should not change in Docker, lets hide it
Utils.equalsFilter(state.value, state.default, Utils.equalsFilter(state.value, state.default,
['__propPath', '__created', '__prototype', '__rootConfig']) && ['__propPath', '__created', '__prototype', '__rootConfig']) &&
Utils.equalsFilter(state.original, state.default, Utils.equalsFilter(state.original, state.default,