fix(jobs): auto-refresh logs and improve job table layout

This commit is contained in:
2026-07-17 13:54:59 +02:00
parent 0f65a0f589
commit d005162a80
4 changed files with 17 additions and 5 deletions
@@ -55,7 +55,7 @@
<button
mat-stroked-button
type="button"
[disabled]="loading()"
[disabled]="loading() || runsLoading()"
(click)="loadRuns()">
<mat-icon>refresh</mat-icon>
Aktualisieren
@@ -1,5 +1,6 @@
import { CommonModule } from '@angular/common';
import { Component, OnInit, inject, signal } from '@angular/core';
import { Component, DestroyRef, OnInit, inject, signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatButtonModule } from '@angular/material/button';
import {
MAT_DIALOG_DATA,
@@ -10,7 +11,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { finalize } from 'rxjs';
import { finalize, timer } from 'rxjs';
import { BackgroundJobsService, BackgroundJobTask, JobRun } from '../../../api';
import { statusMeta } from '../jobs.utils';
@@ -36,6 +37,7 @@ export interface JobLogsDialogData {
export class JobLogsDialogComponent implements OnInit {
private readonly dialogRef = inject(MatDialogRef<JobLogsDialogComponent>);
private readonly backgroundJobsService = inject(BackgroundJobsService);
private readonly destroyRef = inject(DestroyRef);
protected readonly data = inject<JobLogsDialogData>(MAT_DIALOG_DATA);
protected readonly statusMeta = statusMeta;
@@ -50,9 +52,13 @@ export class JobLogsDialogComponent implements OnInit {
ngOnInit(): void {
this.loadRuns(true);
timer(5000, 5000)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => this.loadRuns());
}
protected loadRuns(selectLatest = false): void {
if (this.runsLoading() || this.loading()) return;
this.runsLoading.set(true);
this.runsError.set(null);
this.backgroundJobsService
@@ -96,6 +96,10 @@ mat-paginator {
text-align: center;
}
:host ::ng-deep .mat-mdc-cell.mat-column-schedule {
text-align: center;
}
.task-name-cell {
display: flex;
flex-direction: column;
@@ -120,6 +124,8 @@ mat-paginator {
.task-schedule-cell {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 4px;
}
@@ -100,7 +100,7 @@ export class JobsComponent implements OnInit {
})
.pipe(
catchError(() => {
this.showError('Tasks konnten nicht aktualisiert werden.');
this.showError('Jobs konnten nicht aktualisiert werden.');
return EMPTY;
}),
),
@@ -112,7 +112,7 @@ export class JobsComponent implements OnInit {
this.taskColumns = [
{
id: 'name',
header: 'Task',
header: 'Job',
type: 'display',
cellTemplate: this.taskNameTmp(),
},