From 4271212172ebd3ff5b4196ecb4064f79f7d5e0de Mon Sep 17 00:00:00 2001 From: Julien Maulny Date: Fri, 27 Dec 2019 19:30:12 +0100 Subject: Enhance jobs list displaying on smaller screens --- client/src/app/+admin/system/jobs/job.service.ts | 8 ++-- .../src/app/+admin/system/jobs/jobs.component.html | 49 ++++++++++++---------- .../src/app/+admin/system/jobs/jobs.component.scss | 4 ++ .../src/app/+admin/system/jobs/jobs.component.ts | 5 ++- 4 files changed, 38 insertions(+), 28 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/system/jobs/job.service.ts b/client/src/app/+admin/system/jobs/job.service.ts index 120144dff..1e2291ad1 100644 --- a/client/src/app/+admin/system/jobs/job.service.ts +++ b/client/src/app/+admin/system/jobs/job.service.ts @@ -3,11 +3,11 @@ import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { SortMeta } from 'primeng/api' import { Observable } from 'rxjs' -import { JobType, ResultList } from '../../../../../../shared' -import { JobState } from '../../../../../../shared/models' +import { ResultList } from '../../../../../../shared' import { Job } from '../../../../../../shared/models/server/job.model' import { environment } from '../../../../environments/environment' import { RestExtractor, RestPagination, RestService } from '../../../shared' +import { JobStateClient } from '../../../../types/job-state-client.type' import { JobTypeClient } from '../../../../types/job-type-client.type' @Injectable() @@ -20,13 +20,13 @@ export class JobService { private restExtractor: RestExtractor ) {} - getJobs (state: JobState, jobType: JobTypeClient, pagination: RestPagination, sort: SortMeta): Observable> { + getJobs (jobState: JobStateClient, jobType: JobTypeClient, pagination: RestPagination, sort: SortMeta): Observable> { let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) if (jobType !== 'all') params = params.append('jobType', jobType) - return this.authHttp.get>(JobService.BASE_JOB_URL + '/' + state, { params }) + return this.authHttp.get>(JobService.BASE_JOB_URL + '/' + jobState, { params }) .pipe( map(res => { return this.restExtractor.convertResultListDateToHuman(res, [ 'createdAt', 'processedOn', 'finishedOn' ]) diff --git a/client/src/app/+admin/system/jobs/jobs.component.html b/client/src/app/+admin/system/jobs/jobs.component.html index de43b6448..af07a32a1 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.html +++ b/client/src/app/+admin/system/jobs/jobs.component.html @@ -2,7 +2,7 @@
Jobs list
- +
@@ -23,43 +23,48 @@ - - ID - Type - State - Created - Processed on - Finished on + ID + Type + Created + State - - - - - - - {{ job.id }} - {{ job.type }} - {{ job.state }} + + {{ job.id }} + {{ job.type }} {{ job.createdAt }} - {{ job.processedOn }} - {{ job.finishedOn }} + Delayed. + Will start soon... + Running... + Finished + Failed - + +
{{ [
+          'Job: ' + job.id,
+          'Type: ' + job.type,
+          'Processed on ' + (job.processedOn || '-'),
+          'Finished on ' + (job.finishedOn || '-')
+        ].join('\n') }}
+ + + +
{{ job.data }}
- +
{{ job.error }}
diff --git a/client/src/app/+admin/system/jobs/jobs.component.scss b/client/src/app/+admin/system/jobs/jobs.component.scss index ccc0b35ca..d07d5078b 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.scss +++ b/client/src/app/+admin/system/jobs/jobs.component.scss @@ -19,6 +19,10 @@ } } +td .glyphicon { + margin-right: 10px; +} + pre { font-size: 11px; } diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index c3211d71f..20c8ea71a 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -7,6 +7,7 @@ import { JobState } from '../../../../../../shared/models' import { RestPagination, RestTable } from '../../../shared' import { JobService } from './job.service' import { I18n } from '@ngx-translate/i18n-polyfill' +import { JobStateClient } from '../../../../types/job-state-client.type' import { JobTypeClient } from '../../../../types/job-type-client.type' @Component({ @@ -18,8 +19,8 @@ export class JobsComponent extends RestTable implements OnInit { private static JOB_STATE_LOCAL_STORAGE_STATE = 'jobs-list-state' private static JOB_STATE_LOCAL_STORAGE_TYPE = 'jobs-list-type' - jobState: JobState = 'waiting' - jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] + jobState: JobStateClient = 'waiting' + jobStates: JobStateClient[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] jobType: JobTypeClient = 'all' jobTypes: JobTypeClient[] = [ -- cgit v1.2.3