Fix progress display

This commit is contained in:
Chocobozzz 2021-11-16 09:13:20 +01:00
parent 1740952b8c
commit e5830ac64b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 10 additions and 6 deletions

View File

@ -46,7 +46,7 @@
<th style="width: 200px" class="job-type" i18n>Type</th>
<th style="width: 200px" class="job-priority" i18n>Priority <small>(1 = highest priority)</small></th>
<th style="width: 200px" class="job-state" i18n *ngIf="jobState === 'all'">State</th>
<th style="width: 100px" class="job-progress" i18n *ngIf="hasProgress()">Progress</th>
<th style="width: 100px" class="job-progress" i18n *ngIf="hasGlobalProgress()">Progress</th>
<th style="width: 150px" class="job-date" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
</tr>
</ng-template>
@ -65,8 +65,8 @@
<span class="badge" [ngClass]="getJobStateClass(job.state)">{{ job.state }}</span>
</td>
<td class="job-progress c-hand" [pRowToggler]="job" *ngIf="hasProgress()">
{{ getProgress(job) }}
<td class="job-progress c-hand" [pRowToggler]="job">
<ng-container *ngIf="hasProgress(job)">{{ getProgress(job) }}</ng-container>
</td>
<td class="job-date c-hand" [pRowToggler]="job">{{ job.createdAt | date: 'short' }}</td>

View File

@ -77,9 +77,9 @@ export class JobsComponent extends RestTable implements OnInit {
}
getColspan () {
if (this.jobState === 'all' && this.hasProgress()) return 7
if (this.jobState === 'all' && this.hasGlobalProgress()) return 7
if (this.jobState === 'all' || this.hasProgress()) return 6
if (this.jobState === 'all' || this.hasGlobalProgress()) return 6
return 5
}
@ -91,10 +91,14 @@ export class JobsComponent extends RestTable implements OnInit {
this.saveJobStateAndType()
}
hasProgress () {
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 + '%'