X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fjobs%2Fjobs-list%2Fjobs-list.component.ts;h=44778ab5668253ef8ade3897ffcffc521992523d;hb=24b9417cec5cc785a57b2fe169a1ae88b88801a4;hp=e3f317e6de940f3e231a7f8134d47613239b8df2;hpb=5e4b6992ab818238758a9919f4c5a288398861b6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts index e3f317e6d..44778ab56 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts @@ -1,12 +1,12 @@ import { Component, OnInit } from '@angular/core' +import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/primeng' import { Job } from '../../../../../../shared/index' import { JobState } from '../../../../../../shared/models' import { RestPagination, RestTable } from '../../../shared' -import { viewportHeight } from '../../../shared/misc/utils' import { JobService } from '../shared' -import { RestExtractor } from '../../../shared/rest/rest-extractor.service' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-jobs-list', @@ -16,8 +16,8 @@ import { RestExtractor } from '../../../shared/rest/rest-extractor.service' export class JobsListComponent extends RestTable implements OnInit { private static JOB_STATE_LOCAL_STORAGE_STATE = 'jobs-list-state' - jobState: JobState = 'inactive' - jobStates: JobState[] = [ 'active', 'complete', 'failed', 'inactive', 'delayed' ] + jobState: JobState = 'waiting' + jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] jobs: Job[] = [] totalRecords: number rowsPerPage = 10 @@ -26,18 +26,20 @@ export class JobsListComponent extends RestTable implements OnInit { constructor ( private notificationsService: NotificationsService, - private restExtractor: RestExtractor, - private jobsService: JobService + private jobsService: JobService, + private i18n: I18n ) { super() } ngOnInit () { this.loadJobState() - this.loadSort() + this.initialize() } onJobStateChanged () { + this.pagination.start = 0 + this.loadData() this.saveJobState() } @@ -51,17 +53,17 @@ export class JobsListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error('Error', err.message) + err => this.notificationsService.error(this.i18n('Error'), err.message) ) } private loadJobState () { - const result = localStorage.getItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE) + const result = peertubeLocalStorage.getItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE) if (result) this.jobState = result as JobState } private saveJobState () { - localStorage.setItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE, this.jobState) + peertubeLocalStorage.setItem(JobsListComponent.JOB_STATE_LOCAL_STORAGE_STATE, this.jobState) } }