diff --git a/src/backend/model/jobs/jobs/FileJob.ts b/src/backend/model/jobs/jobs/FileJob.ts index 69cb8d9e..b6e0d55d 100644 --- a/src/backend/model/jobs/jobs/FileJob.ts +++ b/src/backend/model/jobs/jobs/FileJob.ts @@ -11,6 +11,7 @@ import {SQLConnection} from '../../database/sql/SQLConnection'; import {MediaEntity} from '../../database/sql/enitites/MediaEntity'; import {PhotoEntity} from '../../database/sql/enitites/PhotoEntity'; import {VideoEntity} from '../../database/sql/enitites/VideoEntity'; +import {backendTexts} from '../../../../common/BackendTexts'; import DatabaseType = ServerConfig.DatabaseType; declare var global: NodeJS.Global; @@ -31,7 +32,8 @@ export abstract class FileJob; + protected abstract async processFile(file: FileDTO): Promise; protected async step(): Promise { @@ -79,7 +82,7 @@ export abstract class FileJob { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ + {provide: I18n, useValue: () => 'ok'}, + BackendtextService + ] + }); + }); + + + it('should call UserDTO service login', inject([BackendtextService], + (backendTextService: BackendtextService) => { + const getTexts = (obj: any) => { + for (const key of Object.keys(obj)) { + if (typeof obj[key] === 'object') { + getTexts(obj[key]); + continue; + } + expect(backendTextService.get(obj[key])).not.toBe(null); + } + }; + getTexts(backendTexts); + })); + +}); diff --git a/src/frontend/app/model/backendtext.service.ts b/src/frontend/app/model/backendtext.service.ts new file mode 100644 index 00000000..6d4b8827 --- /dev/null +++ b/src/frontend/app/model/backendtext.service.ts @@ -0,0 +1,26 @@ +import {Injectable} from '@angular/core'; +import {I18n} from '@ngx-translate/i18n-polyfill'; +import {backendText, backendTexts} from '../../../common/BackendTexts'; + +@Injectable() +export class BackendtextService { + + + constructor(private i18n: I18n) { + } + + public get(id: backendText): string { + switch (id) { + case backendTexts.sizeToGenerate.name: + return this.i18n('Size to generate'); + case backendTexts.sizeToGenerate.description: + return this.i18n('These thumbnails will be generated. The list should be a subset of the enabled thumbnail sizes'); + case backendTexts.indexedFilesOnly.name: + return this.i18n('Indexed only'); + case backendTexts.indexedFilesOnly.description: + return this.i18n('Only checks indexed files.'); + default: + return null; + } + } +} diff --git a/src/frontend/app/ui/settings/jobs/jobs.settings.component.html b/src/frontend/app/ui/settings/jobs/jobs.settings.component.html index 84be0acc..375fee97 100644 --- a/src/frontend/app/ui/settings/jobs/jobs.settings.component.html +++ b/src/frontend/app/ui/settings/jobs/jobs.settings.component.html @@ -138,17 +138,18 @@
- - -
- -
+ +
+ +
+ + -
-
- - -
- -
- + + + -
-
-
- -
- -
- + + + -
-
-
- -
- -
+ + + - - ';' separated integers. - -
-
-
- + + + + ';' separated integers. + {{backendtextService.get(configEntry.description)}} + +
+
+
diff --git a/src/frontend/app/ui/settings/jobs/jobs.settings.component.ts b/src/frontend/app/ui/settings/jobs/jobs.settings.component.ts index e7a7a5d7..9fb52f68 100644 --- a/src/frontend/app/ui/settings/jobs/jobs.settings.component.ts +++ b/src/frontend/app/ui/settings/jobs/jobs.settings.component.ts @@ -21,6 +21,7 @@ import {ConfigTemplateEntry, JobDTO} from '../../../../../common/entities/job/Jo import {Job} from '../../../../../backend/model/jobs/jobs/Job'; import {ModalDirective} from 'ngx-bootstrap/modal'; import {JobProgressStates} from '../../../../../common/entities/job/JobProgressDTO'; +import {BackendtextService} from '../../../model/backendtext.service'; @Component({ selector: 'app-settings-jobs', @@ -52,6 +53,7 @@ export class JobsSettingsComponent extends SettingsComponent { + it('should all number be unique', () => { + const numbers: number[] = []; + const getNumbers = (obj: any) => { + for (const key of Object.keys(obj)) { + if (typeof obj[key] === 'object') { + getNumbers(obj[key]); + continue; + } + expect(numbers.indexOf(obj[key])).to.be.equal(-1, 'duplicate backend number id found:' + obj[key]); + numbers.push(obj[key]); + } + }; + getNumbers(backendTexts); + }); +});