2019-12-29 17:24:47 +08:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import {I18n} from '@ngx-translate/i18n-polyfill';
|
|
|
|
import {backendText, backendTexts} from '../../../common/BackendTexts';
|
2019-12-31 00:10:01 +08:00
|
|
|
import {DefaultsJobs} from '../../../common/entities/job/JobDTO';
|
2019-12-29 17:24:47 +08:00
|
|
|
|
|
|
|
@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;
|
|
|
|
}
|
|
|
|
}
|
2019-12-31 00:10:01 +08:00
|
|
|
|
|
|
|
public getJobName(job: DefaultsJobs | string): string {
|
|
|
|
if (typeof job === 'string') {
|
|
|
|
job = DefaultsJobs[<any>job];
|
|
|
|
}
|
|
|
|
switch (job as DefaultsJobs) {
|
|
|
|
case DefaultsJobs.Indexing:
|
|
|
|
return this.i18n('Indexing');
|
|
|
|
case DefaultsJobs['Database Reset']:
|
|
|
|
return this.i18n('Database Reset');
|
|
|
|
case DefaultsJobs['Thumbnail Generation']:
|
|
|
|
return this.i18n('Thumbnail Generation');
|
|
|
|
case DefaultsJobs['Photo Converting']:
|
|
|
|
return this.i18n('Photo Converting');
|
|
|
|
case DefaultsJobs['Video Converting']:
|
|
|
|
return this.i18n('Video Converting');
|
|
|
|
case DefaultsJobs['Temp Folder Cleaning']:
|
|
|
|
return this.i18n('Temp Folder Cleaning');
|
|
|
|
default:
|
|
|
|
return DefaultsJobs[job as DefaultsJobs];
|
|
|
|
}
|
|
|
|
}
|
2019-12-29 17:24:47 +08:00
|
|
|
}
|