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 'reflect-metadata';
import {SortingMethods} from '../../entities/SortingMethods'; import {SortingMethods} from '../../entities/SortingMethods';
import {UserRoles} from '../../entities/UserDTO'; import {UserRoles} from '../../entities/UserDTO';
import {SubConfigClass} from 'typeconfig/src/decorators/class/SubConfigClass'; import {ConfigProperty, SubConfigClass} from 'typeconfig/common';
import {ConfigProperty} from 'typeconfig/src/decorators/property/ConfigPropoerty';
export module ClientConfig { export module ClientConfig {
@ -155,7 +154,6 @@ export module ClientConfig {
@SubConfigClass() @SubConfigClass()
export class Config { export class Config {
@ConfigProperty({volatile: true}) @ConfigProperty({volatile: true})
upTime: string; upTime: string;
@ConfigProperty({volatile: true}) @ConfigProperty({volatile: true})

View File

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

View File

@ -156,7 +156,10 @@ export class SettingsEntryComponent implements ControlValueAccessor, Validator,
} }
validate(control: FormControl): ValidationErrors { 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 null;
} }
return {required: true}; return {required: true};

View File

@ -14,8 +14,7 @@
name="Threading" name="Threading"
description="Runs directory scanning and thumbnail generation (only for Jimp) in a different thread." description="Runs directory scanning and thumbnail generation (only for Jimp) in a different thread."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.Server.enabled" [ngModel]="states.Server.enabled">
required="true">
</app-settings-entry> </app-settings-entry>
@ -37,32 +36,28 @@
name="Scroll based thumbnail generation" name="Scroll based thumbnail generation"
description="Those thumbnails get higher priority that are visible on the screen." description="Those thumbnails get higher priority that are visible on the screen."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.Client.enableOnScrollThumbnailPrioritising" [ngModel]="states.Client.enableOnScrollThumbnailPrioritising">
required="true">
</app-settings-entry> </app-settings-entry>
<app-settings-entry <app-settings-entry
name="Lazy image rendering" name="Lazy image rendering"
description="Shows only the required amount of photos at once. Renders more if page bottom is reached." description="Shows only the required amount of photos at once. Renders more if page bottom is reached."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.Client.enableOnScrollRendering" [ngModel]="states.Client.enableOnScrollRendering">
required="true">
</app-settings-entry> </app-settings-entry>
<app-settings-entry <app-settings-entry
name="Cache" name="Cache"
description="Caches directory contents and search results for better performance." description="Caches directory contents and search results for better performance."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.Client.enableCache" [ngModel]="states.Client.enableCache">
required="true">
</app-settings-entry> </app-settings-entry>
<app-settings-entry <app-settings-entry
name="Caption first naming" name="Caption first naming"
description="Show the caption (IPTC 120) tags from the EXIF data instead of the filenames." description="Show the caption (IPTC 120) tags from the EXIF data instead of the filenames."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.Client.captionFirstNaming" [ngModel]="states.Client.captionFirstNaming">
required="true">
</app-settings-entry> </app-settings-entry>

View File

@ -39,8 +39,7 @@
name="Converting" name="Converting"
description="Downsizes photos for faster preview loading. (Zooming in to the photo loads the original)." description="Downsizes photos for faster preview loading. (Zooming in to the photo loads the original)."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.client.Converting.enabled" [ngModel]="states.client.Converting.enabled">
required="true">
</app-settings-entry> </app-settings-entry>
<app-settings-entry <app-settings-entry
@ -49,8 +48,7 @@
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.server.Converting.onTheFly" [ngModel]="states.server.Converting.onTheFly"
[simplifiedMode]="simplifiedMode" [simplifiedMode]="simplifiedMode"
[disabled]="!states.client.Converting.enabled.value" [disabled]="!states.client.Converting.enabled.value">
required="true">
</app-settings-entry> </app-settings-entry>
<app-settings-entry <app-settings-entry

View File

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

View File

@ -12,8 +12,7 @@
description="High quality may be slow. Especially with Jimp." description="High quality may be slow. Especially with Jimp."
i18n-description i18n-name i18n-description i18n-name
[ngModel]="states.server.qualityPriority" [ngModel]="states.server.qualityPriority"
[simplifiedMode]="simplifiedMode" [simplifiedMode]="simplifiedMode">
required="true">
</app-settings-entry> </app-settings-entry>