1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Add info panel to jobs #587

This commit is contained in:
Patrik J. Braun 2023-09-19 21:10:33 +02:00
parent 71c9df2d26
commit 07328a7ae2
6 changed files with 123 additions and 60 deletions

View File

@ -142,6 +142,7 @@ import {
ionHammerOutline,
ionImageOutline,
ionImagesOutline,
ionInformationCircleOutline,
ionInformationOutline,
ionLinkOutline,
ionLocationOutline,
@ -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,

View File

@ -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(() => {
@ -24,4 +26,17 @@ describe('BackendTextService', () => {
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);
}
}
));
});

View File

@ -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;
}
}
}

View File

@ -72,7 +72,7 @@
let-confPath="confPath">
<div class="alert alert-secondary" role="alert"
*ngIf="rStates.description && settingsService.configStyle == ConfigStyle.full">
{{rStates.description}}
<ng-icon size="1.3em" name="ionInformationCircleOutline"></ng-icon> {{rStates.description}}
<a *ngIf="rStates.tags?.githubIssue"
[href]="'https://github.com/bpatrik/pigallery2/issues/'+rStates.tags?.githubIssue">
<ng-container i18n>See</ng-container>
@ -130,7 +130,7 @@
<ng-container *ngFor="let job of uiJob; let i = index">
<div class="alert alert-secondary" role="alert"
*ngIf="job.description && settingsService.configStyle == ConfigStyle.full">
{{job.description}}
<ng-icon size="1.3em" name="ionInformationCircleOutline"></ng-icon> {{job.description}}
</div>
<app-settings-job-button
*ngIf="!job.relevant || job.relevant(settingsService.settings | async)"

View File

@ -40,6 +40,10 @@
<div class="row">
<div class="col-md-12">
<div class="alert alert-secondary" role="alert"
*ngIf="settingsService.configStyle == ConfigStyle.full">
<ng-icon size="1.3em" name="ionInformationCircleOutline"></ng-icon> {{getJobDescription(schedule.jobName)}}
</div>
<div class="mb-1 row">
<label class="col-md-2 control-label" i18n>Job:</label>
<div class="col-md-4">

View File

@ -282,6 +282,10 @@ export class WorkflowComponent implements ControlValueAccessor, Validator, OnIni
// empty
};
getJobDescription(jobName: string): string {
return this.backendTextService.getJobDescription(jobName);
}
public writeValue(obj: JobScheduleConfig[]): void {
this.schedules = obj;
}