1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improving config change detection on switches

This commit is contained in:
Patrik J. Braun 2020-02-06 23:57:59 +01:00
parent f4e93c07c8
commit c13e90dca6
7 changed files with 16 additions and 26 deletions

View File

@ -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})

View File

@ -6,8 +6,7 @@ export enum UserRoles {
Guest = 2,
User = 3,
Admin = 4,
Developer = 5,
Developer = 5
}
export interface UserDTO {

View File

@ -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};

View File

@ -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">
</app-settings-entry>
@ -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">
</app-settings-entry>
<app-settings-entry
name="Lazy image rendering"
description="Shows only the required amount of photos at once. Renders more if page bottom is reached."
i18n-description i18n-name
[ngModel]="states.Client.enableOnScrollRendering"
required="true">
[ngModel]="states.Client.enableOnScrollRendering">
</app-settings-entry>
<app-settings-entry
name="Cache"
description="Caches directory contents and search results for better performance."
i18n-description i18n-name
[ngModel]="states.Client.enableCache"
required="true">
[ngModel]="states.Client.enableCache">
</app-settings-entry>
<app-settings-entry
name="Caption first naming"
description="Show the caption (IPTC 120) tags from the EXIF data instead of the filenames."
i18n-description i18n-name
[ngModel]="states.Client.captionFirstNaming"
required="true">
[ngModel]="states.Client.captionFirstNaming">
</app-settings-entry>

View File

@ -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">
</app-settings-entry>
<app-settings-entry
@ -49,8 +48,7 @@
i18n-description i18n-name
[ngModel]="states.server.Converting.onTheFly"
[simplifiedMode]="simplifiedMode"
[disabled]="!states.client.Converting.enabled.value"
required="true">
[disabled]="!states.client.Converting.enabled.value">
</app-settings-entry>
<app-settings-entry

View File

@ -32,16 +32,14 @@
name="Autocomplete"
description="Show hints while typing search query."
i18n-description i18n-name
[ngModel]="states.AutoComplete.enabled"
required="true">
[ngModel]="states.AutoComplete.enabled">
</app-settings-entry>
<app-settings-entry
name="Instant search"
description="Enables showing search results, while typing search query."
i18n-description i18n-name
[ngModel]="states.instantSearchEnabled"
required="true">
[ngModel]="states.instantSearchEnabled">
</app-settings-entry>

View File

@ -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">
</app-settings-entry>