From 5908bed64f74d63570d51b040b709f047c5df25d Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 6 Feb 2020 22:46:45 +0100 Subject: [PATCH] fixing settings saving bug --- package-lock.json | 6 +++--- package.json | 2 +- src/common/config/private/Config.ts | 1 + src/common/config/private/WebConfig.ts | 2 +- .../_abstract/settings-entry/settings-entry.component.ts | 2 +- .../ui/settings/indexing/indexing.settings.component.html | 6 ++---- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86ec140..7b9f13a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18721,9 +18721,9 @@ } }, "typeconfig": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.6.tgz", - "integrity": "sha512-OnXPXSDaK1mzH6dJ1HB9Q70ruJYngEhemwL9Y8+nG5E40Je4MMODuEY+tfjMtIiFIN772DU5Q+NebulLZNDjpw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.7.tgz", + "integrity": "sha512-aShKfhwvPQFnMwBBFWsJhl1QQmDsdkx/vs7aKgxbGnLMW7W2djucEPGlUsmK3isMrTJAErmsr5CElacO/YFA6A==", "requires": { "optimist": "0.6.1" } diff --git a/package.json b/package.json index 5c635a9..dd5d0b9 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "sqlite3": "4.1.1", "ts-exif-parser": "0.1.4", "ts-node-iptc": "1.0.11", - "typeconfig": "2.0.6", + "typeconfig": "2.0.7", "typeorm": "0.2.21", "winston": "2.4.4" }, diff --git a/src/common/config/private/Config.ts b/src/common/config/private/Config.ts index 1dd5632..dbfe7a6 100644 --- a/src/common/config/private/Config.ts +++ b/src/common/config/private/Config.ts @@ -11,6 +11,7 @@ import {ConfigProperty, IConfigClass} from 'typeconfig/common'; saveIfNotExist: true, attachDescription: true, enumsAsString: true, + softReadonly: true, cli: { enable: { configPath: true, diff --git a/src/common/config/private/WebConfig.ts b/src/common/config/private/WebConfig.ts index 75ee740..aff2844 100644 --- a/src/common/config/private/WebConfig.ts +++ b/src/common/config/private/WebConfig.ts @@ -6,7 +6,7 @@ import {WebConfigClass} from 'typeconfig/web'; import {ConfigProperty, ConfigState} from 'typeconfig/common'; -@WebConfigClass() +@WebConfigClass({softReadonly: true}) export class WebConfig { @ConfigState() State: any; diff --git a/src/frontend/app/ui/settings/_abstract/settings-entry/settings-entry.component.ts b/src/frontend/app/ui/settings/_abstract/settings-entry/settings-entry.component.ts index 234e0dd..df6e539 100644 --- a/src/frontend/app/ui/settings/_abstract/settings-entry/settings-entry.component.ts +++ b/src/frontend/app/ui/settings/_abstract/settings-entry/settings-entry.component.ts @@ -99,7 +99,7 @@ export class SettingsEntryComponent implements ControlValueAccessor, Validator, (this.state.arrayType === 'string' || this.isNumberArray)) { value = value.replace(new RegExp(',', 'g'), ';'); value = value.replace(new RegExp(' ', 'g'), ';'); - this.state.value = value.split(';'); + this.state.value = value.split(';').filter((v: string) => v !== ''); if (this.isNumberArray) { this.state.value = this.state.value.map((v: string) => parseFloat(v)).filter((v: number) => !isNaN(v)); } diff --git a/src/frontend/app/ui/settings/indexing/indexing.settings.component.html b/src/frontend/app/ui/settings/indexing/indexing.settings.component.html index 54d1ecf..0b6fc4d 100644 --- a/src/frontend/app/ui/settings/indexing/indexing.settings.component.html +++ b/src/frontend/app/ui/settings/indexing/indexing.settings.component.html @@ -37,8 +37,7 @@ name="Exclude Folder List" i18n-name placeholder="/media/images/family/private;private;family/private" - [ngModel]="states.excludeFolderList" - required="true"> + [ngModel]="states.excludeFolderList"> Folders to exclude from indexing
@@ -54,8 +53,7 @@ name="Exclude File List" i18n-name placeholder=".ignore;.pg2ignore" - [ngModel]="states.excludeFileList" - required="true"> + [ngModel]="states.excludeFileList"> Files that mark a folder to be excluded from indexing