aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-13 19:27:25 +0100
committerRigel Kent <sendmemail@rigelk.eu>2020-12-13 19:27:25 +0100
commit040d6896a3cd5622e78cccdedd8cce2afcf49a31 (patch)
tree1c4a1503e1886ce411e008fd0b367ef0d12088e9 /client/src/app
parent7aebd32f8396827012aab5ea196158606c0611e3 (diff)
downloadPeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.tar.gz
PeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.tar.zst
PeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.zip
add display of logs matching any state
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/system/jobs/job.service.ts11
-rw-r--r--client/src/app/+admin/system/jobs/jobs.component.html33
-rw-r--r--client/src/app/+admin/system/jobs/jobs.component.ts16
3 files changed, 46 insertions, 14 deletions
diff --git a/client/src/app/+admin/system/jobs/job.service.ts b/client/src/app/+admin/system/jobs/job.service.ts
index 1ac50f050..4b4a8914f 100644
--- a/client/src/app/+admin/system/jobs/job.service.ts
+++ b/client/src/app/+admin/system/jobs/job.service.ts
@@ -19,13 +19,20 @@ export class JobService {
19 private restExtractor: RestExtractor 19 private restExtractor: RestExtractor
20 ) {} 20 ) {}
21 21
22 getJobs (jobState: JobStateClient, jobType: JobTypeClient, pagination: RestPagination, sort: SortMeta): Observable<ResultList<Job>> { 22 getJobs (options: {
23 jobState?: JobStateClient,
24 jobType: JobTypeClient,
25 pagination: RestPagination,
26 sort: SortMeta
27 }): Observable<ResultList<Job>> {
28 const { jobState, jobType, pagination, sort } = options
29
23 let params = new HttpParams() 30 let params = new HttpParams()
24 params = this.restService.addRestGetParams(params, pagination, sort) 31 params = this.restService.addRestGetParams(params, pagination, sort)
25 32
26 if (jobType !== 'all') params = params.append('jobType', jobType) 33 if (jobType !== 'all') params = params.append('jobType', jobType)
27 34
28 return this.authHttp.get<ResultList<Job>>(JobService.BASE_JOB_URL + '/' + jobState, { params }) 35 return this.authHttp.get<ResultList<Job>>(JobService.BASE_JOB_URL + `/${jobState ? jobState : ''}`, { params })
29 .pipe( 36 .pipe(
30 map(res => { 37 map(res => {
31 return this.restExtractor.convertResultListDateToHuman(res, [ 'createdAt', 'processedOn', 'finishedOn' ]) 38 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 e06156a9e..2d60e7b9e 100644
--- a/client/src/app/+admin/system/jobs/jobs.component.html
+++ b/client/src/app/+admin/system/jobs/jobs.component.html
@@ -17,6 +17,9 @@
17 [clearable]="false" 17 [clearable]="false"
18 [searchable]="false" 18 [searchable]="false"
19 > 19 >
20 <ng-option value="all">
21 <span i18n="Selector for the list displaying jobs, filtering by their state">any</span>
22 </ng-option>
20 <ng-option *ngFor="let state of jobStates" [value]="state"> 23 <ng-option *ngFor="let state of jobStates" [value]="state">
21 <span class="badge" [ngClass]="getJobStateClass(state)">{{ state }}</span> 24 <span class="badge" [ngClass]="getJobStateClass(state)">{{ state }}</span>
22 </ng-option> 25 </ng-option>
@@ -37,27 +40,31 @@
37 <th style="width: 40px"></th> 40 <th style="width: 40px"></th>
38 <th style="width: calc(100% - 390px)" class="job-id" i18n>ID</th> 41 <th style="width: calc(100% - 390px)" class="job-id" i18n>ID</th>
39 <th style="width: 200px" class="job-type" i18n>Type</th> 42 <th style="width: 200px" class="job-type" i18n>Type</th>
43 <th style="width: 200px" class="job-type" i18n *ngIf="jobState === 'all'">State</th>
40 <th style="width: 150px" class="job-date" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 44 <th style="width: 150px" class="job-date" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
41 </tr> 45 </tr>
42 </ng-template> 46 </ng-template>
43 47
44 <ng-template pTemplate="body" let-expanded="expanded" let-job> 48 <ng-template pTemplate="body" let-expanded="expanded" let-job>
45 <tr> 49 <tr>
46 <td class="expand-cell" [pRowToggler]="job" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body"> 50 <td class="expand-cell c-hand" [pRowToggler]="job" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body">
47 <span class="expander"> 51 <span class="expander">
48 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> 52 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
49 </span> 53 </span>
50 </td> 54 </td>
51 55
52 <td class="job-id" [pRowToggler]="job" [title]="job.id">{{ job.id }}</td> 56 <td class="job-id c-hand" [pRowToggler]="job" [title]="job.id">{{ job.id }}</td>
53 <td class="job-type" [pRowToggler]="job">{{ job.type }}</td> 57 <td class="job-type c-hand" [pRowToggler]="job">{{ job.type }}</td>
54 <td class="job-date" [pRowToggler]="job">{{ job.createdAt | date: 'short' }}</td> 58 <td class="job-type c-hand" [pRowToggler]="job" *ngIf="jobState === 'all'">
59 <span class="badge" [ngClass]="getJobStateClass(job.state)">{{ job.state }}</span>
60 </td>
61 <td class="job-date c-hand" [pRowToggler]="job">{{ job.createdAt | date: 'short' }}</td>
55 </tr> 62 </tr>
56 </ng-template> 63 </ng-template>
57 64
58 <ng-template pTemplate="rowexpansion" let-job> 65 <ng-template pTemplate="rowexpansion" let-job>
59 <tr> 66 <tr>
60 <td colspan="4"> 67 <td [attr.colspan]="getColspan()">
61 <pre>{{ [ 68 <pre>{{ [
62 'Job: ' + job.id, 69 'Job: ' + job.id,
63 'Type: ' + job.type, 70 'Type: ' + job.type,
@@ -67,12 +74,12 @@
67 </td> 74 </td>
68 </tr> 75 </tr>
69 <tr> 76 <tr>
70 <td colspan="4"> 77 <td [attr.colspan]="getColspan()">
71 <pre>{{ job.data }}</pre> 78 <pre>{{ job.data }}</pre>
72 </td> 79 </td>
73 </tr> 80 </tr>
74 <tr class="job-error" *ngIf="job.error"> 81 <tr class="job-error" *ngIf="job.error">
75 <td colspan="4"> 82 <td [attr.colspan]="getColspan()">
76 <pre>{{ job.error }}</pre> 83 <pre>{{ job.error }}</pre>
77 </td> 84 </td>
78 </tr> 85 </tr>
@@ -80,11 +87,17 @@
80 87
81 <ng-template pTemplate="emptymessage"> 88 <ng-template pTemplate="emptymessage">
82 <tr> 89 <tr>
83 <td colspan="4"> 90 <td [attr.colspan]="getColspan()">
84 <div class="no-results"> 91 <div class="no-results">
85 <div class="d-block"> 92 <div class="d-block">
86 <ng-container *ngIf="jobType === 'all'" i18n>No <span class="badge" [ngClass]="getJobStateClass(jobState)">{{ jobState }}</span> jobs found.</ng-container> 93 <ng-container *ngIf="jobState === 'all'">
87 <ng-container *ngIf="jobType !== 'all'" i18n>No <code>{{ jobType }}</code> jobs found that are <span class="badge" [ngClass]="getJobStateClass(jobState)">{{ jobState }}</span>.</ng-container> 94 <ng-container *ngIf="jobType === 'all'" i18n>No jobs found.</ng-container>
95 <ng-container *ngIf="jobType !== 'all'" i18n>No <code>{{ jobType }}</code> jobs found.</ng-container>
96 </ng-container>
97 <ng-container *ngIf="jobState !== 'all'">
98 <ng-container *ngIf="jobType === 'all'" i18n>No <span class="badge" [ngClass]="getJobStateClass(jobState)">{{ jobState }}</span> jobs found.</ng-container>
99 <ng-container *ngIf="jobType !== 'all'" i18n>No <code>{{ jobType }}</code> jobs found that are <span class="badge" [ngClass]="getJobStateClass(jobState)">{{ jobState }}</span>.</ng-container>
100 </ng-container>
88 </div> 101 </div>
89 </div> 102 </div>
90 </td> 103 </td>
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts
index f8e12d1b6..b7f18067b 100644
--- a/client/src/app/+admin/system/jobs/jobs.component.ts
+++ b/client/src/app/+admin/system/jobs/jobs.component.ts
@@ -16,7 +16,7 @@ export class JobsComponent extends RestTable implements OnInit {
16 private static LOCAL_STORAGE_STATE = 'jobs-list-state' 16 private static LOCAL_STORAGE_STATE = 'jobs-list-state'
17 private static LOCAL_STORAGE_TYPE = 'jobs-list-type' 17 private static LOCAL_STORAGE_TYPE = 'jobs-list-type'
18 18
19 jobState: JobStateClient = 'waiting' 19 jobState?: JobStateClient | 'all'
20 jobStates: JobStateClient[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] 20 jobStates: JobStateClient[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
21 21
22 jobType: JobTypeClient = 'all' 22 jobType: JobTypeClient = 'all'
@@ -73,6 +73,10 @@ export class JobsComponent extends RestTable implements OnInit {
73 } 73 }
74 } 74 }
75 75
76 getColspan () {
77 return this.jobState === 'all' ? 5 : 4
78 }
79
76 onJobStateOrTypeChanged () { 80 onJobStateOrTypeChanged () {
77 this.pagination.start = 0 81 this.pagination.start = 0
78 82
@@ -81,8 +85,16 @@ export class JobsComponent extends RestTable implements OnInit {
81 } 85 }
82 86
83 protected loadData () { 87 protected loadData () {
88 let jobState = this.jobState as JobState
89 if (this.jobState === 'all') jobState = null
90
84 this.jobsService 91 this.jobsService
85 .getJobs(this.jobState, this.jobType, this.pagination, this.sort) 92 .getJobs({
93 jobState,
94 jobType: this.jobType,
95 pagination: this.pagination,
96 sort: this.sort
97 })
86 .subscribe( 98 .subscribe(
87 resultList => { 99 resultList => {
88 this.jobs = resultList.data 100 this.jobs = resultList.data