From c13e90dca67fd04b60419bc8a8e6ed1d6a512ec3 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 6 Feb 2020 23:57:59 +0100 Subject: [PATCH] improving config change detection on switches --- src/common/config/public/ClientConfig.ts | 4 +--- src/common/entities/UserDTO.ts | 3 +-- .../settings-entry/settings-entry.component.ts | 5 ++++- .../settings/other/other.settings.component.html | 15 +++++---------- .../settings/photo/photo.settings.component.html | 6 ++---- .../search/search.settings.component.html | 6 ++---- .../thumbnail/thumbnail.settings.component.html | 3 +-- 7 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index 13a9d4a1..444c48fa 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -2,8 +2,7 @@ import 'reflect-metadata'; import {SortingMethods} from '../../entities/SortingMethods'; import {UserRoles} from '../../entities/UserDTO'; -import {SubConfigClass} from 'typeconfig/src/decorators/class/SubConfigClass'; -import {ConfigProperty} from 'typeconfig/src/decorators/property/ConfigPropoerty'; +import {ConfigProperty, SubConfigClass} from 'typeconfig/common'; export module ClientConfig { @@ -155,7 +154,6 @@ export module ClientConfig { @SubConfigClass() export class Config { - @ConfigProperty({volatile: true}) upTime: string; @ConfigProperty({volatile: true}) diff --git a/src/common/entities/UserDTO.ts b/src/common/entities/UserDTO.ts index 7ce11adc..7e4456ff 100644 --- a/src/common/entities/UserDTO.ts +++ b/src/common/entities/UserDTO.ts @@ -6,8 +6,7 @@ export enum UserRoles { Guest = 2, User = 3, Admin = 4, - Developer = 5, - + Developer = 5 } export interface UserDTO { 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 df6e539d..43fff9b7 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 @@ -156,7 +156,10 @@ export class SettingsEntryComponent implements ControlValueAccessor, Validator, } validate(control: FormControl): ValidationErrors { - if (!this.required || (this.state && this.state.value && this.state.value !== '')) { + if (!this.required || (this.state && + typeof this.state.value !== 'undefined' && + this.state.value !== null && + this.state.value !== '')) { return null; } return {required: true}; diff --git a/src/frontend/app/ui/settings/other/other.settings.component.html b/src/frontend/app/ui/settings/other/other.settings.component.html index 361ed2db..2610288b 100644 --- a/src/frontend/app/ui/settings/other/other.settings.component.html +++ b/src/frontend/app/ui/settings/other/other.settings.component.html @@ -14,8 +14,7 @@ name="Threading" description="Runs directory scanning and thumbnail generation (only for Jimp) in a different thread." i18n-description i18n-name - [ngModel]="states.Server.enabled" - required="true"> + [ngModel]="states.Server.enabled"> @@ -37,32 +36,28 @@ name="Scroll based thumbnail generation" description="Those thumbnails get higher priority that are visible on the screen." i18n-description i18n-name - [ngModel]="states.Client.enableOnScrollThumbnailPrioritising" - required="true"> + [ngModel]="states.Client.enableOnScrollThumbnailPrioritising"> + [ngModel]="states.Client.enableOnScrollRendering"> + [ngModel]="states.Client.enableCache"> + [ngModel]="states.Client.captionFirstNaming"> diff --git a/src/frontend/app/ui/settings/photo/photo.settings.component.html b/src/frontend/app/ui/settings/photo/photo.settings.component.html index fab6c8f2..27ac8043 100644 --- a/src/frontend/app/ui/settings/photo/photo.settings.component.html +++ b/src/frontend/app/ui/settings/photo/photo.settings.component.html @@ -39,8 +39,7 @@ name="Converting" description="Downsizes photos for faster preview loading. (Zooming in to the photo loads the original)." i18n-description i18n-name - [ngModel]="states.client.Converting.enabled" - required="true"> + [ngModel]="states.client.Converting.enabled"> + [disabled]="!states.client.Converting.enabled.value"> + [ngModel]="states.AutoComplete.enabled"> + [ngModel]="states.instantSearchEnabled"> diff --git a/src/frontend/app/ui/settings/thumbnail/thumbnail.settings.component.html b/src/frontend/app/ui/settings/thumbnail/thumbnail.settings.component.html index 89e0c836..7f011bd4 100644 --- a/src/frontend/app/ui/settings/thumbnail/thumbnail.settings.component.html +++ b/src/frontend/app/ui/settings/thumbnail/thumbnail.settings.component.html @@ -12,8 +12,7 @@ description="High quality may be slow. Especially with Jimp." i18n-description i18n-name [ngModel]="states.server.qualityPriority" - [simplifiedMode]="simplifiedMode" - required="true"> + [simplifiedMode]="simplifiedMode">