From be2cfbdd4bf77c996e56491cde9d6a8acbcdd33f Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 6 Jan 2023 20:16:33 +0100 Subject: [PATCH] Add restart/reset warnings #569 --- src/common/config/private/PrivateConfig.ts | 21 ++++++++++++ src/common/config/public/ClientConfig.ts | 33 +++++++++++++++---- .../settings-entry.component.html | 16 ++++++--- .../settings-entry.component.ts | 8 +++++ 4 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index 60b67c50..09baf59a 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -98,6 +98,7 @@ export class MySQLConfig { tags: { name: $localize`Host`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced }, }) @@ -107,6 +108,7 @@ export class MySQLConfig { tags: { name: $localize`Port`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced }, }) @@ -116,6 +118,7 @@ export class MySQLConfig { tags: { name: $localize`Database`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced }, }) @@ -125,6 +128,7 @@ export class MySQLConfig { tags: { name: $localize`Username`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced }, }) @@ -134,6 +138,7 @@ export class MySQLConfig { tags: { name: $localize`Password`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced } }) @@ -146,6 +151,7 @@ export class SQLiteConfig { tags: { name: $localize`Sqlite db filename`, + uiResetNeeded: {server: true}, priority: ConfigPriority.underTheHood }, description: $localize`Sqlite will save the db with this filename.`, @@ -224,6 +230,7 @@ export class ServerDataBaseConfig { { name: $localize`Type`, priority: ConfigPriority.advanced, + uiResetNeeded: {db: true}, githubIssue: 573 } as TAGS, description: $localize`SQLite is recommended.` @@ -234,6 +241,7 @@ export class ServerDataBaseConfig { tags: { name: $localize`Database folder`, + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced }, description: $localize`All file-based data will be stored here (sqlite database, user database in case of memory db, job history data).`, @@ -244,6 +252,7 @@ export class ServerDataBaseConfig { tags: { name: $localize`SQLite`, + uiResetNeeded: {db: true}, relevant: (c: any) => c.type === DatabaseType.sqlite, } }) @@ -253,6 +262,7 @@ export class ServerDataBaseConfig { tags: { name: $localize`MySQL`, + uiResetNeeded: {db: true}, relevant: (c: any) => c.type === DatabaseType.mysql, } }) @@ -270,6 +280,7 @@ export class ServerUserConfig extends ClientUserConfig { { name: $localize`Enforced users`, priority: ConfigPriority.underTheHood, + uiResetNeeded: {server: true}, uiOptional: true, githubIssue: 575 } as TAGS, @@ -411,6 +422,7 @@ export class ServerIndexingConfig { { name: $localize`Exclude Folder List`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true, db: true}, uiOptional: true, uiAllowSpaces: true } as TAGS, @@ -423,6 +435,7 @@ export class ServerIndexingConfig { { name: $localize`Exclude File List`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true, db: true}, uiOptional: true, hint: $localize`.ignore;.pg2ignore` } as TAGS, @@ -437,6 +450,7 @@ export class ServerThreadingConfig { tags: { name: $localize`Threading`, + uiResetNeeded: {server: true}, priority: ConfigPriority.underTheHood }, description: $localize`Runs directory scanning and thumbnail generation in a different thread.` @@ -446,6 +460,7 @@ export class ServerThreadingConfig { tags: { name: $localize`Thumbnail threads`, + uiResetNeeded: {server: true}, priority: ConfigPriority.underTheHood }, description: $localize`Number of threads that are used to generate thumbnails. If 0, number of 'CPU cores -1' threads will be used.`, @@ -819,6 +834,7 @@ export class ServerPreviewConfig { type: 'object', tags: { name: $localize`Preview Filter query`, + uiResetNeeded: {db: true}, priority: ConfigPriority.advanced, uiType: 'SearchQuery' }, @@ -832,6 +848,7 @@ export class ServerPreviewConfig { arrayType: SortingMethods, tags: { name: $localize`Preview Sorting`, + uiResetNeeded: {db: true}, priority: ConfigPriority.advanced }, description: $localize`If multiple preview is available sorts them by these methods and selects the first one.`, @@ -848,6 +865,7 @@ export class ServerMediaConfig extends ClientMediaConfig { tags: { name: $localize`Images folder`, priority: ConfigPriority.basic, + uiResetNeeded: {server: true}, dockerSensitive: true }, description: $localize`Images are loaded from this folder (read permission required)`, @@ -857,6 +875,7 @@ export class ServerMediaConfig extends ClientMediaConfig { @ConfigProperty({ tags: { name: $localize`Temp folder`, + uiResetNeeded: {server: true}, priority: ConfigPriority.basic, dockerSensitive: true }, @@ -940,6 +959,7 @@ export class ServerServiceConfig extends ClientServiceConfig { tags: { name: $localize`Port`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true}, dockerSensitive: true }, description: $localize`Port number. Port 80 is usually what you need.`, @@ -951,6 +971,7 @@ export class ServerServiceConfig extends ClientServiceConfig { tags: { name: $localize`Host`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true}, dockerSensitive: true }, description: $localize`Server will accept connections from this IPv6 or IPv4 address.`, diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index df9593b0..a1c45c7b 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -45,7 +45,11 @@ export type TAGS = { hideProgress: boolean, relevant?: (c: ClientConfig) => boolean, description: string - }[] + }[], + uiResetNeeded?: { + server?: boolean, + db?: boolean + } }; @SubConfigClass({tags: {client: true}, softReadonly: true}) @@ -533,6 +537,7 @@ export class ClientVideoConfig { tags: { name: $localize`Enable`, priority: ConfigPriority.advanced, + uiResetNeeded: {db: true} } }) enabled: boolean = true; @@ -541,7 +546,8 @@ export class ClientVideoConfig { tags: { name: $localize`Supported formats with transcoding`, priority: ConfigPriority.underTheHood, - uiDisabled: (sb: ClientVideoConfig) => !sb.enabled + uiDisabled: (sb: ClientVideoConfig) => !sb.enabled, + uiResetNeeded: {db: true} } as TAGS, description: $localize`Video formats that are supported after transcoding (with the build-in ffmpeg support).` }) @@ -553,7 +559,8 @@ export class ClientVideoConfig { tags: { name: $localize`Supported formats without transcoding`, priority: ConfigPriority.underTheHood, - uiDisabled: (sb: ClientVideoConfig) => !sb.enabled + uiDisabled: (sb: ClientVideoConfig) => !sb.enabled, + uiResetNeeded: {db: true} }, description: $localize`Video formats that are supported also without transcoding. Browser supported formats: https://www.w3schools.com/html/html5_video.asp` }) @@ -597,7 +604,8 @@ export class ClientPhotoConfig { arrayType: 'string', tags: { name: $localize`Supported photo formats`, - priority: ConfigPriority.underTheHood + priority: ConfigPriority.underTheHood, + uiResetNeeded: {db: true} }, description: $localize`Photo formats that are supported. Browser needs to support these formats natively. Also sharp (libvips) package should be able to convert these formats.`, }) @@ -649,6 +657,7 @@ export class ClientMetaFileConfig { tags: { name: $localize`*.gpx files`, priority: ConfigPriority.advanced, + uiResetNeeded: {db: true}, uiDisabled: (sb, c) => !c.Map.enabled } as TAGS, description: $localize`Reads *.gpx files and renders them on the map.` @@ -667,6 +676,7 @@ export class ClientMetaFileConfig { @ConfigProperty({ tags: { name: $localize`Markdown files`, + uiResetNeeded: {db: true}, priority: ConfigPriority.advanced }, description: $localize`Reads *.md files in a directory and shows the next to the map.` @@ -676,6 +686,7 @@ export class ClientMetaFileConfig { @ConfigProperty({ tags: { name: $localize`*.pg2conf files`, + uiResetNeeded: {db: true}, priority: ConfigPriority.advanced }, description: $localize`Reads *.pg2conf files (You can use it for custom sorting and saved search (albums)).` @@ -685,6 +696,7 @@ export class ClientMetaFileConfig { arrayType: 'string', tags: { name: $localize`Supported formats`, + uiResetNeeded: {db: true}, priority: ConfigPriority.underTheHood }, description: $localize`The app will read and process these files.` @@ -697,15 +709,17 @@ export class ClientFacesConfig { @ConfigProperty({ tags: { name: $localize`Enabled`, - priority: ConfigPriority.advanced + priority: ConfigPriority.advanced, + uiResetNeeded: {db: true} } }) enabled: boolean = true; @ConfigProperty({ tags: { name: $localize`Override keywords`, - priority: ConfigPriority.underTheHood - }, + priority: ConfigPriority.underTheHood, + uiResetNeeded: {db: true} + } as TAGS, description: $localize`If a photo has the same face (person) name and keyword, the app removes the duplicate, keeping the face only.` }) keywordsToPersons: boolean = true; @@ -752,6 +766,7 @@ export class ClientServiceConfig { tags: { name: $localize`Url Base`, hint: '/myGallery', + uiResetNeeded: {server: true}, priority: ConfigPriority.advanced, uiOptional: true } @@ -762,6 +777,7 @@ export class ClientServiceConfig { description: 'PiGallery api path.', tags: { name: $localize`Api path`, + uiResetNeeded: {server: true}, priority: ConfigPriority.underTheHood } }) @@ -775,6 +791,7 @@ export class ClientServiceConfig { tags: { name: $localize`Custom HTML Head`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true}, githubIssue: 404, uiOptional: true } @@ -792,6 +809,7 @@ export class ClientUserConfig { } }, tags: { + uiResetNeeded: {server: true}, name: $localize`Password protection`, }, description: $localize`Enables user management with login to password protect the gallery.`, @@ -802,6 +820,7 @@ export class ClientUserConfig { type: UserRoles, tags: { name: $localize`Default user right`, priority: ConfigPriority.advanced, + uiResetNeeded: {server: true}, relevant: (c: any) => c.authenticationRequired === false }, description: $localize`Default user right when password protection is disabled.`, diff --git a/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.html b/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.html index 3cbb6fd0..ec68eaa7 100644 --- a/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.html +++ b/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.html @@ -284,25 +284,33 @@ -
+
+ class="oi oi-warning text-warning warning-icon ms-2" >
- + [Experimental] - {{description}} + {{description}} ';' separated list. See #{{state.tags?.githubIssue}}. + +
+ Reset database after changing this settings! +
+ +
+ Restart server after changing this settings! +
diff --git a/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.ts b/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.ts index be5ee1a2..0036b2bc 100644 --- a/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.ts +++ b/src/frontend/app/ui/settings/template/settings-entry/settings-entry.component.ts @@ -96,6 +96,14 @@ export class SettingsEntryComponent return !Utils.equalsFilter(this.state.value, this.state.default); } + + get isOriginal(): boolean { + if (this.Disabled) { + return true; + } + return Utils.equalsFilter(this.state.value, this.state.original); + } + get shouldHide(): boolean { return this.state.shouldHide && this.state.shouldHide(); }