1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-25 02:04:15 +02:00

Improving config cloning performance #569

This commit is contained in:
Patrik J. Braun 2023-01-04 23:07:50 +01:00
parent b7584dbc85
commit a902cdcdfc
8 changed files with 29 additions and 31 deletions

14
package-lock.json generated
View File

@ -27,7 +27,7 @@
"sharp": "0.31.2",
"ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11",
"typeconfig": "2.0.29",
"typeconfig": "2.0.32",
"typeorm": "0.3.10",
"xml2js": "0.4.23"
},
@ -20825,9 +20825,9 @@
}
},
"node_modules/typeconfig": {
"version": "2.0.29",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.29.tgz",
"integrity": "sha512-0eQ4QkRUTxG1sy6aFuQV/uxpFamFShhdVQFVkMqhLUpNCAcgNS8VJkY4ZxVp09RnDdoR+L/Oj/3f655XyeNcPQ==",
"version": "2.0.32",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.32.tgz",
"integrity": "sha512-hbdt3SG0q9Sv6aqPMdmubY/513YokbiLRpqiAOY1HgaROTTw+3QdqYh4uKBoeKVHFgGgT66zBu1tyUkU8xO1lA==",
"dependencies": {
"minimist": "1.2.7"
}
@ -38126,9 +38126,9 @@
}
},
"typeconfig": {
"version": "2.0.29",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.29.tgz",
"integrity": "sha512-0eQ4QkRUTxG1sy6aFuQV/uxpFamFShhdVQFVkMqhLUpNCAcgNS8VJkY4ZxVp09RnDdoR+L/Oj/3f655XyeNcPQ==",
"version": "2.0.32",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.32.tgz",
"integrity": "sha512-hbdt3SG0q9Sv6aqPMdmubY/513YokbiLRpqiAOY1HgaROTTw+3QdqYh4uKBoeKVHFgGgT66zBu1tyUkU8xO1lA==",
"requires": {
"minimist": "1.2.7"
}

View File

@ -49,7 +49,7 @@
"sharp": "0.31.2",
"ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11",
"typeconfig": "2.0.29",
"typeconfig": "2.0.32",
"xml2js": "0.4.23",
"typeorm": "0.3.10"
},

View File

@ -612,13 +612,18 @@ export class ServerJobConfig {
description: $localize`Jobs load this many photos or videos form the DB for processing at once.`
})
mediaProcessingBatchSize: number = 1000;
@ConfigProperty({arrayType: JobScheduleConfig})
@ConfigProperty({
arrayType: JobScheduleConfig,
tags: {
name: $localize`Scheduled jobs`,
priority: ConfigPriority.advanced}
})
scheduled: JobScheduleConfig[] = [
new JobScheduleConfig(
DefaultsJobs[DefaultsJobs.Indexing],
DefaultsJobs[DefaultsJobs.Indexing],
new NeverJobTriggerConfig(),
{indexChangesOnly: true} // set config explicitly so it is not undefined on the UI
{indexChangesOnly: true} // set config explicitly, so it is not undefined on the UI
),
new JobScheduleConfig(
DefaultsJobs[DefaultsJobs['Preview Filling']],

View File

@ -3,19 +3,10 @@ import 'reflect-metadata';
import {ServerConfig} from './PrivateConfig';
import {WebConfigClass} from 'typeconfig/web';
import {ConfigState} from 'typeconfig/common';
import {WebConfigClassBuilder} from '../../../../node_modules/typeconfig/src/decorators/builders/WebConfigClassBuilder';
import {IWebConfigClassPrivate} from '../../../../node_modules/typeconfig/src/decorators/class/IWebConfigClass';
import {TAGS} from '../public/ClientConfig';
@WebConfigClass({softReadonly: true})
export class WebConfig extends ServerConfig {
@ConfigState()
State: any;
clone(): IWebConfigClassPrivate<TAGS> & WebConfig {
const wcg = WebConfigClassBuilder.attachPrivateInterface(new WebConfig());
wcg.load(WebConfigClassBuilder.attachPrivateInterface(this).toJSON());
return wcg;
}
}

View File

@ -482,11 +482,10 @@ export class ClientGalleryConfig {
})
enableOnScrollThumbnailPrioritising: boolean = true;
@ConfigProperty({
type: NavBarConfig,
tags: {
name: $localize`Navigation bar`,
priority: ConfigPriority.advanced,
}
} as TAGS
})
NavBar: NavBarConfig = new NavBarConfig();
@ConfigProperty({

View File

@ -7,7 +7,6 @@ import {NavigationService} from '../../model/navigation.service';
import {PageHelper} from '../../model/page.helper';
import {SettingsService} from '../settings/settings.service';
import {ConfigPriority} from '../../../../common/config/public/ClientConfig';
import {Utils} from '../../../../common/Utils';
import {WebConfig} from '../../../../common/config/private/WebConfig';
import {ISettingsComponent} from '../settings/template/ISettingsComponent';
import {WebConfigClassBuilder} from '../../../../../node_modules/typeconfig/src/decorators/builders/WebConfigClassBuilder';

View File

@ -83,8 +83,9 @@ export class SettingsEntryComponent
for (const k of Object.keys(this.state.value[i].__state)) {
if (!Utils.equalsFilter(
this.state.value[i]?.__state[k]?.value,
this.state.default[i]?.__state[k]?.value,
this.state.default[i] ? this.state.default[i][k] : undefined,
['default', '__propPath', '__created', '__prototype', '__rootConfig'])) {
return true;
}
}

View File

@ -1,4 +1,4 @@
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {Component, Input, OnChanges, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {AuthenticationService} from '../../../model/network/authentication.service';
import {NavigationService} from '../../../model/navigation.service';
import {NotificationService} from '../../../model/notification.service';
@ -55,7 +55,7 @@ export interface RecursiveState extends ConfigState {
templateUrl: './template.component.html',
styleUrls: ['./template.component.css']
})
export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent {
export class TemplateComponent implements OnInit, OnChanges, OnDestroy, ISettingsComponent {
public icon: string;
@Input() ConfigPath: string;
@ -83,6 +83,14 @@ export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent
) {
}
ngOnChanges(): void {
if (!this.ConfigPath) {
this.setSliceFN(c => ({value: c as any, isConfigType: true, type: WebConfig} as any));
} else {
this.setSliceFN(c => c.__state[this.ConfigPath]);
}
this.name = this.states.tags?.name || this.ConfigPath;
}
ngOnInit(): void {
@ -100,12 +108,7 @@ export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent
this.onOptionChange();
});
if (!this.ConfigPath) {
this.setSliceFN(c => ({value: c as any, isConfigType: true, type: WebConfig} as any));
} else {
this.setSliceFN(c => c.__state[this.ConfigPath]);
}
this.name = this.states.tags?.name || this.ConfigPath;
}