diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-08-27 17:27:37 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2020-09-28 13:25:50 +0200 |
commit | 7f0d85616944681ed447f4342d86eee8141c7612 (patch) | |
tree | dc51b7dd989f7bcdff37ef1332a61d05a652ab53 /client/src/app/+admin/system/jobs | |
parent | cd372e840b6a291a56e0d5135548d05a98415155 (diff) | |
download | PeerTube-7f0d85616944681ed447f4342d86eee8141c7612.tar.gz PeerTube-7f0d85616944681ed447f4342d86eee8141c7612.tar.zst PeerTube-7f0d85616944681ed447f4342d86eee8141c7612.zip |
jobs/logs view select and empty state visual improvements
Diffstat (limited to 'client/src/app/+admin/system/jobs')
-rw-r--r-- | client/src/app/+admin/system/jobs/jobs.component.html | 56 | ||||
-rw-r--r-- | client/src/app/+admin/system/jobs/jobs.component.scss | 12 | ||||
-rw-r--r-- | client/src/app/+admin/system/jobs/jobs.component.ts | 15 |
3 files changed, 59 insertions, 24 deletions
diff --git a/client/src/app/+admin/system/jobs/jobs.component.html b/client/src/app/+admin/system/jobs/jobs.component.html index 185fae220..e06156a9e 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.html +++ b/client/src/app/+admin/system/jobs/jobs.component.html | |||
@@ -10,45 +10,48 @@ | |||
10 | 10 | ||
11 | <div class="select-filter-block"> | 11 | <div class="select-filter-block"> |
12 | <label for="jobState" i18n>Job state</label> | 12 | <label for="jobState" i18n>Job state</label> |
13 | <div class="peertube-select-container"> | 13 | <ng-select |
14 | <select id="jobState" name="jobState" [(ngModel)]="jobState" (ngModelChange)="onJobStateOrTypeChanged()" class="form-control"> | 14 | class="select-job-state" |
15 | <option *ngFor="let state of jobStates" [value]="state">{{ state }}</option> | 15 | [(ngModel)]="jobState" |
16 | </select> | 16 | (ngModelChange)="onJobStateOrTypeChanged()" |
17 | </div> | 17 | [clearable]="false" |
18 | [searchable]="false" | ||
19 | > | ||
20 | <ng-option *ngFor="let state of jobStates" [value]="state"> | ||
21 | <span class="badge" [ngClass]="getJobStateClass(state)">{{ state }}</span> | ||
22 | </ng-option> | ||
23 | </ng-select> | ||
18 | </div> | 24 | </div> |
19 | </div> | 25 | </div> |
20 | 26 | ||
21 | <p-table | 27 | <p-table |
22 | [value]="jobs" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" dataKey="uniqId" | 28 | [value]="jobs" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" |
23 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" [first]="pagination.start" | 29 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="uniqId" [first]="pagination.start" |
24 | [tableStyle]="{'table-layout':'auto'}" (onPage)="onPage($event)" [expandedRowKeys]="expandedRows" | 30 | [tableStyle]="{'table-layout':'auto'}" (onPage)="onPage($event)" |
31 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate | ||
32 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} jobs" | ||
33 | (onPage)="onPage($event)" [expandedRowKeys]="expandedRows" | ||
25 | > | 34 | > |
26 | <ng-template pTemplate="header"> | 35 | <ng-template pTemplate="header"> |
27 | <tr> | 36 | <tr> |
28 | <th style="width: 40px"></th> | 37 | <th style="width: 40px"></th> |
29 | <th style="width: 100%" class="job-id" i18n>ID</th> | 38 | <th style="width: calc(100% - 390px)" class="job-id" i18n>ID</th> |
30 | <th style="width: 200px" class="job-type" i18n>Type</th> | 39 | <th style="width: 200px" class="job-type" i18n>Type</th> |
31 | <th style="width: 150px" class="job-date" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> | 40 | <th style="width: 150px" class="job-date" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> |
32 | <th style="width: 150px" class="job-state" i18n>State</th> | ||
33 | </tr> | 41 | </tr> |
34 | </ng-template> | 42 | </ng-template> |
35 | 43 | ||
36 | <ng-template pTemplate="body" let-expanded="expanded" let-job> | 44 | <ng-template pTemplate="body" let-expanded="expanded" let-job> |
37 | <tr> | 45 | <tr> |
38 | <td class="expand-cell"> | 46 | <td class="expand-cell" [pRowToggler]="job" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body"> |
39 | <span class="expander" [pRowToggler]="job" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body"> | 47 | <span class="expander"> |
40 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> | 48 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> |
41 | </span> | 49 | </span> |
42 | </td> | 50 | </td> |
43 | 51 | ||
44 | <td class="job-id" [title]="job.id">{{ job.id }}</td> | 52 | <td class="job-id" [pRowToggler]="job" [title]="job.id">{{ job.id }}</td> |
45 | <td class="job-type">{{ job.type }}</td> | 53 | <td class="job-type" [pRowToggler]="job">{{ job.type }}</td> |
46 | <td class="job-date">{{ job.createdAt | date: 'short' }}</td> | 54 | <td class="job-date" [pRowToggler]="job">{{ job.createdAt | date: 'short' }}</td> |
47 | <td class="job-state" *ngIf="job.state === 'delayed'" class="text-muted"><span class="glyphicon glyphicon-repeat"></span> <span i18n>Delayed</span></td> | ||
48 | <td class="job-state" *ngIf="job.state === 'waiting'" class="text-warning"><span class="glyphicon glyphicon-hourglass"></span> <span i18n>Will start soon...</span></td> | ||
49 | <td class="job-state" *ngIf="job.state === 'active'" class="text-warning"><span class="glyphicon glyphicon-cog"></span> <span i18n>Running...</span></td> | ||
50 | <td class="job-state" *ngIf="job.state === 'completed'" class="text-success"><span class="glyphicon glyphicon-ok"></span> <span i18n>Finished</span></td> | ||
51 | <td class="job-state" *ngIf="job.state === 'failed'" class="text-danger"><span class="glyphicon glyphicon-remove"></span> <span i18n>Failed</span></td> | ||
52 | </tr> | 55 | </tr> |
53 | </ng-template> | 56 | </ng-template> |
54 | 57 | ||
@@ -74,5 +77,18 @@ | |||
74 | </td> | 77 | </td> |
75 | </tr> | 78 | </tr> |
76 | </ng-template> | 79 | </ng-template> |
80 | |||
81 | <ng-template pTemplate="emptymessage"> | ||
82 | <tr> | ||
83 | <td colspan="4"> | ||
84 | <div class="no-results"> | ||
85 | <div class="d-block"> | ||
86 | <ng-container *ngIf="jobType === 'all'" i18n>No <span class="badge" [ngClass]="getJobStateClass(jobState)">{{ jobState }}</span> jobs found.</ng-container> | ||
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> | ||
88 | </div> | ||
89 | </div> | ||
90 | </td> | ||
91 | </tr> | ||
92 | </ng-template> | ||
77 | </p-table> | 93 | </p-table> |
78 | 94 | ||
diff --git a/client/src/app/+admin/system/jobs/jobs.component.scss b/client/src/app/+admin/system/jobs/jobs.component.scss index c33e14292..784ec4572 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.scss +++ b/client/src/app/+admin/system/jobs/jobs.component.scss | |||
@@ -1,6 +1,10 @@ | |||
1 | @import '_variables'; | 1 | @import '_variables'; |
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | 3 | ||
4 | .select-job-state { | ||
5 | min-width: 120px; | ||
6 | } | ||
7 | |||
4 | .job-id { | 8 | .job-id { |
5 | max-width: 30vw !important; | 9 | max-width: 30vw !important; |
6 | } | 10 | } |
@@ -13,10 +17,6 @@ | |||
13 | width: 170px !important; | 17 | width: 170px !important; |
14 | } | 18 | } |
15 | 19 | ||
16 | .job-state { | ||
17 | max-width: 60px; | ||
18 | } | ||
19 | |||
20 | .admin-sub-header { | 20 | .admin-sub-header { |
21 | flex-direction: row !important; | 21 | flex-direction: row !important; |
22 | justify-content: flex-end; | 22 | justify-content: flex-end; |
@@ -47,3 +47,7 @@ pre { | |||
47 | .job-error { | 47 | .job-error { |
48 | color: red; | 48 | color: red; |
49 | } | 49 | } |
50 | |||
51 | .badge { | ||
52 | @include table-badge; | ||
53 | } | ||
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index 96e0f25b0..25d75aed2 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts | |||
@@ -56,6 +56,21 @@ export class JobsComponent extends RestTable implements OnInit { | |||
56 | return 'JobsComponent' | 56 | return 'JobsComponent' |
57 | } | 57 | } |
58 | 58 | ||
59 | getJobStateClass (state: JobStateClient) { | ||
60 | switch (state) { | ||
61 | case 'active': | ||
62 | return 'badge-blue' | ||
63 | case 'completed': | ||
64 | return 'badge-green' | ||
65 | case 'delayed': | ||
66 | return 'badge-brown' | ||
67 | case 'failed': | ||
68 | return 'badge-red' | ||
69 | case 'waiting': | ||
70 | return 'badge-yellow' | ||
71 | } | ||
72 | } | ||
73 | |||
59 | onJobStateOrTypeChanged () { | 74 | onJobStateOrTypeChanged () { |
60 | this.pagination.start = 0 | 75 | this.pagination.start = 0 |
61 | 76 | ||