From 07328a7ae2e376614095b404e70ec47c8a5d4065 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 19 Sep 2023 21:10:33 +0200 Subject: [PATCH] Add info panel to jobs #587 --- src/frontend/app/app.module.ts | 10 ++- .../app/model/backendtext.service.spec.ts | 37 +++++--- src/frontend/app/model/backendtext.service.ts | 44 +++++++++- .../settings/template/template.component.html | 4 +- .../settings/workflow/workflow.component.html | 4 + .../settings/workflow/workflow.component.ts | 84 ++++++++++--------- 6 files changed, 123 insertions(+), 60 deletions(-) diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 1353e2ed..34f24d03 100644 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -142,6 +142,7 @@ import { ionHammerOutline, ionImageOutline, ionImagesOutline, + ionInformationCircleOutline, ionInformationOutline, ionLinkOutline, ionLocationOutline, @@ -204,7 +205,7 @@ export class MyHammerConfig extends HammerGestureConfig { export class CustomUrlSerializer implements UrlSerializer { private defaultUrlSerializer: DefaultUrlSerializer = - new DefaultUrlSerializer(); + new DefaultUrlSerializer(); parse(url: string): UrlTree { // Encode parentheses @@ -215,9 +216,9 @@ export class CustomUrlSerializer implements UrlSerializer { serialize(tree: UrlTree): string { return this.defaultUrlSerializer - .serialize(tree) - .replace(/%28/g, '(') - .replace(/%29/g, ')'); + .serialize(tree) + .replace(/%28/g, '(') + .replace(/%29/g, ')'); } } @@ -245,6 +246,7 @@ Marker.prototype.options.icon = MarkerFactory.defIcon; ionTextOutline, ionFolderOutline, ionDocumentOutline, ionImageOutline, ionPricetagOutline, ionLocationOutline, ionSunnyOutline, ionMoonOutline, ionVideocamOutline, + ionInformationCircleOutline, ionInformationOutline, ionContractOutline, ionExpandOutline, ionCloseOutline, ionTimerOutline, ionPlayOutline, ionPauseOutline, ionVolumeMediumOutline, ionVolumeMuteOutline, diff --git a/src/frontend/app/model/backendtext.service.spec.ts b/src/frontend/app/model/backendtext.service.spec.ts index 8006e735..5eb05a25 100644 --- a/src/frontend/app/model/backendtext.service.spec.ts +++ b/src/frontend/app/model/backendtext.service.spec.ts @@ -1,6 +1,8 @@ import {inject, TestBed} from '@angular/core/testing'; import {BackendtextService} from './backendtext.service'; import {backendTexts} from '../../../common/BackendTexts'; +import {Utils} from '../../../common/Utils'; +import {DefaultsJobs} from '../../../common/entities/job/JobDTO'; describe('BackendTextService', () => { beforeEach(() => { @@ -10,18 +12,31 @@ describe('BackendTextService', () => { }); it('should have valid text for all keys', 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.toEqual(null, 'Error for key: ' + obj[key] + ', ' + key); + [BackendtextService], + (backendTextService: BackendtextService) => { + const getTexts = (obj: any) => { + for (const key of Object.keys(obj)) { + if (typeof obj[key] === 'object') { + getTexts(obj[key]); + continue; } - }; - getTexts(backendTexts); + expect(backendTextService.get(obj[key])).not.toEqual(null, 'Error for key: ' + obj[key] + ', ' + key); + } + }; + getTexts(backendTexts); + } + )); + + it('should have valid text for all jobs', inject( + [BackendtextService], + (backendTextService: BackendtextService) => { + + const allJobs = Utils.enumToArray(DefaultsJobs); + + for (let i = 0; i < allJobs.length; ++i){ + expect(backendTextService.getJobName(allJobs[i].value)).not.toEqual(null, 'Cant find job name: ' + allJobs[i].value); + expect(backendTextService.getJobDescription(allJobs[i].value)).not.toEqual(null, 'Cant find job name: ' + allJobs[i].value); } + } )); }); diff --git a/src/frontend/app/model/backendtext.service.ts b/src/frontend/app/model/backendtext.service.ts index 46a2fadf..84c3e144 100644 --- a/src/frontend/app/model/backendtext.service.ts +++ b/src/frontend/app/model/backendtext.service.ts @@ -60,13 +60,51 @@ export class BackendtextService { case DefaultsJobs['Temp Folder Cleaning']: return $localize`Temp folder cleaning`; case DefaultsJobs['Album Cover Filling']: - return $localize`Album cover filling`; + return $localize`Cover filling`; case DefaultsJobs['Album Cover Reset']: - return $localize`Album cover reset`; + return $localize`Cover reset`; case DefaultsJobs['GPX Compression']: return $localize`GPX compression`; + case DefaultsJobs['Delete Compressed GPX']: + return $localize`Delete Compressed GPX`; + case DefaultsJobs['Top Pick Sending']: + return $localize`Top Pick Sending`; default: - return DefaultsJobs[job as DefaultsJobs]; + return null; + } + } + + public getJobDescription(job: DefaultsJobs | string): string { + if (typeof job === 'string') { + job = DefaultsJobs[job as any]; + } + switch (job as DefaultsJobs) { + case DefaultsJobs.Indexing: + return $localize`Scans the whole gallery from disk and indexes it to the DB.`; + case DefaultsJobs['Gallery Reset']: + return $localize`Deletes all directories, photos and videos from the DB.`; + case DefaultsJobs['Album Reset']: + return $localize`Removes all albums from the DB`; + case DefaultsJobs['Thumbnail Generation']: + return $localize`Generates thumbnails from all media files and stores them in the tmp folder.`; + case DefaultsJobs['Photo Converting']: + return $localize`Generates high res photos from all media files and stores them in the tmp folder.`; + case DefaultsJobs['Video Converting']: + return $localize`Transcodes all videos and stores them in the tmp folder.`; + case DefaultsJobs['Temp Folder Cleaning']: + return $localize`Removes unnecessary files from the tmp folder.`; + case DefaultsJobs['Album Cover Filling']: + return $localize`Updates the cover photo of all albums (both directories and saved searches) and and faces.`; + case DefaultsJobs['Album Cover Reset']: + return $localize`Deletes the cover photo of all albums and faces`; + case DefaultsJobs['GPX Compression']: + return $localize`Compresses all gpx files`; + case DefaultsJobs['Delete Compressed GPX']: + return $localize`Deletes all compressed GPX files`; + case DefaultsJobs['Top Pick Sending']: + return $localize`Gets the top photos of the selected search queries and sends them over email. You need to set up the SMTP server connection send e-mails.`; + default: + return null; } } } diff --git a/src/frontend/app/ui/settings/template/template.component.html b/src/frontend/app/ui/settings/template/template.component.html index fe437a5f..35f7fd8d 100644 --- a/src/frontend/app/ui/settings/template/template.component.html +++ b/src/frontend/app/ui/settings/template/template.component.html @@ -72,7 +72,7 @@ let-confPath="confPath">