X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fsystem%2Fjobs%2Fjobs.component.ts;h=d5da1b743a835f4f4fe4abf2f4b3534c117fc074;hb=b1934b7e9cdece7c0c38e05b0f905dc2ccab9167;hp=f8e12d1b6108ed2966391832d83ac5fd45251880;hpb=97969c4edf51b37eee691adba43368bb0fbb729b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index f8e12d1b6..d5da1b743 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -16,25 +16,35 @@ export class JobsComponent extends RestTable implements OnInit { private static LOCAL_STORAGE_STATE = 'jobs-list-state' private static LOCAL_STORAGE_TYPE = 'jobs-list-type' - jobState: JobStateClient = 'waiting' + jobState?: JobStateClient | 'all' jobStates: JobStateClient[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] jobType: JobTypeClient = 'all' jobTypes: JobTypeClient[] = [ 'all', + + 'activitypub-cleaner', 'activitypub-follow', + 'activitypub-http-broadcast-parallel', 'activitypub-http-broadcast', 'activitypub-http-fetcher', 'activitypub-http-unicast', + 'activitypub-refresher', + 'actor-keys', + 'after-video-channel-import', 'email', - 'video-transcoding', + 'federate-video', + 'manage-video-torrent', + 'move-to-object-storage', + 'notify', + 'video-channel-import', 'video-file-import', 'video-import', - 'videos-views', - 'activitypub-refresher', 'video-live-ending', 'video-redundancy', - 'video-live-ending' + 'video-studio-edition', + 'video-transcoding', + 'videos-views-stats' ] jobs: Job[] = [] @@ -45,7 +55,7 @@ export class JobsComponent extends RestTable implements OnInit { constructor ( private notifier: Notifier, private jobsService: JobService - ) { + ) { super() } @@ -73,24 +83,61 @@ export class JobsComponent extends RestTable implements OnInit { } } + getColspan () { + if (this.jobState === 'all' && this.hasGlobalProgress()) return 7 + + if (this.jobState === 'all' || this.hasGlobalProgress()) return 6 + + return 5 + } + onJobStateOrTypeChanged () { this.pagination.start = 0 - this.loadData() + this.reloadData() this.saveJobStateAndType() } - protected loadData () { + hasGlobalProgress () { + return this.jobType === 'all' || this.jobType === 'video-transcoding' + } + + hasProgress (job: Job) { + return job.type === 'video-transcoding' + } + + getProgress (job: Job) { + if (job.state === 'active') return job.progress + '%' + + return '' + } + + refresh () { + this.jobs = [] + this.totalRecords = 0 + + this.reloadData() + } + + protected reloadData () { + let jobState = this.jobState as JobState + if (this.jobState === 'all') jobState = null + this.jobsService - .getJobs(this.jobState, this.jobType, this.pagination, this.sort) - .subscribe( - resultList => { + .getJobs({ + jobState, + jobType: this.jobType, + pagination: this.pagination, + sort: this.sort + }) + .subscribe({ + next: resultList => { this.jobs = resultList.data this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } private loadJobStateAndType () {