diff --git a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.html b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.html
index f0ebaeb7..13917cdf 100644
--- a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.html
+++ b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.html
@@ -25,6 +25,9 @@
@if (run.exit_code != null) {
· Exit {{ run.exit_code }}
}
+ @if (formatRunDuration(run); as dur) {
+ · {{ dur }}
+ }
}
@@ -41,6 +44,15 @@
{{ statusMeta(runStatus()!).label }}
}
+ @if (selectedRun(); as run) {
+ @if (runStatus() === 'running' || runStatus() === 'stopping') {
+ @if (formatRunElapsed(run, nowMs()); as elapsed) {
+ läuft seit {{ elapsed }}
+ }
+ } @else if (formatRunDuration(run); as dur) {
+ Dauer: {{ dur }}
+ }
+ }
zeigt letzte 200 Zeilen
diff --git a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.scss b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.scss
index f4b9b0ca..b65b114c 100644
--- a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.scss
+++ b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.scss
@@ -138,6 +138,11 @@
font-size: 12px;
}
+.run-duration {
+ font-size: 13px;
+ color: #475569;
+}
+
@media (max-width: 640px) {
.logs-header {
flex-direction: column;
diff --git a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.ts b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.ts
index 68c40815..7965cb9e 100644
--- a/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.ts
+++ b/webapp/src/app/modules/jobs/job-logs-dialog/job-logs-dialog.component.ts
@@ -4,6 +4,7 @@ import {
DestroyRef,
ElementRef,
OnInit,
+ computed,
inject,
signal,
viewChild,
@@ -22,7 +23,12 @@ import { MatSelectModule } from '@angular/material/select';
import { MatTooltipModule } from '@angular/material/tooltip';
import { finalize, timer } from 'rxjs';
import { BackgroundJobsService, BackgroundJobTask, JobRun } from '../../../api';
-import { formatUtcDateAsLocal, statusMeta } from '../jobs.utils';
+import {
+ formatRunDuration,
+ formatRunElapsed,
+ formatUtcDateAsLocal,
+ statusMeta,
+} from '../jobs.utils';
export interface JobLogsDialogData {
task: BackgroundJobTask;
@@ -52,6 +58,8 @@ export class JobLogsDialogComponent implements OnInit {
protected readonly statusMeta = statusMeta;
protected readonly formatUtcDateAsLocal = formatUtcDateAsLocal;
+ protected readonly formatRunDuration = formatRunDuration;
+ protected readonly formatRunElapsed = formatRunElapsed;
protected readonly runs = signal
([]);
protected readonly runsLoading = signal(false);
@@ -60,6 +68,11 @@ export class JobLogsDialogComponent implements OnInit {
protected readonly loading = signal(false);
protected readonly logs = signal('');
protected readonly runStatus = signal(null);
+ protected readonly nowMs = signal(Date.now());
+
+ protected readonly selectedRun = computed(
+ () => this.runs().find((run) => run.id === this.selectedRunId()) ?? null,
+ );
private readonly logsPanel = viewChild>('logsPanel');
@@ -74,6 +87,10 @@ export class JobLogsDialogComponent implements OnInit {
timer(5000, 5000)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => this.loadRuns());
+ // Ticks the live "läuft seit …" duration every second.
+ timer(1000, 1000)
+ .pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe(() => this.nowMs.set(Date.now()));
}
protected loadRuns(selectLatest = false): void {
diff --git a/webapp/src/app/modules/jobs/jobs.component.html b/webapp/src/app/modules/jobs/jobs.component.html
index dd5f8788..18a32526 100644
--- a/webapp/src/app/modules/jobs/jobs.component.html
+++ b/webapp/src/app/modules/jobs/jobs.component.html
@@ -108,6 +108,13 @@
@if (row.last_run) {
{{ formatUtcDateAsLocal(row.last_run.started_at) }}
+ @if (row.status === 'running' || row.status === 'stopping') {
+ @if (formatRunElapsed(row.last_run, nowMs()); as elapsed) {
+ läuft seit {{ elapsed }}
+ }
+ } @else if (formatRunDuration(row.last_run); as duration) {
+ Dauer: {{ duration }}
+ }
@if (row.last_run.exit_code != null) {
Exit-Code {{ row.last_run.exit_code }}(null);
protected readonly dockerHealthLoading = signal(false);
protected readonly deletingTaskIds = signal>(new Set());
+ protected readonly nowMs = signal(Date.now());
protected readonly statusMeta = statusMeta;
protected readonly formatScheduleCron = formatScheduleCron;
protected readonly formatUtcDateAsLocal = formatUtcDateAsLocal;
+ protected readonly formatRunDuration = formatRunDuration;
+ protected readonly formatRunElapsed = formatRunElapsed;
protected taskColumns: GenericColumn[] = [];
@@ -123,6 +128,11 @@ export class JobsComponent implements OnInit {
)
.subscribe((tasks) => this.setTasksPreservingPendingStops(tasks));
+ // Ticks the live "läuft seit …" duration in the last-run column.
+ timer(1000, 1000)
+ .pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe(() => this.nowMs.set(Date.now()));
+
this.taskColumns = [
{
id: 'name',
diff --git a/webapp/src/app/modules/jobs/jobs.utils.ts b/webapp/src/app/modules/jobs/jobs.utils.ts
index b3bc6a7f..8936ca77 100644
--- a/webapp/src/app/modules/jobs/jobs.utils.ts
+++ b/webapp/src/app/modules/jobs/jobs.utils.ts
@@ -39,9 +39,18 @@ export function formatScheduleCron(schedule: string | null): string {
return schedule ? `Cron: ${schedule}` : 'Nur manuell';
}
+// Backend timestamps are naive UTC without a timezone suffix, so add a "Z"
+// before parsing to keep them comparable with the (UTC-based) wall clock.
+function appendUtcZ(value: string): string {
+ return /(?:Z|[+-]\d{2}:\d{2})$/.test(value) ? value : `${value}Z`;
+}
+
+function toUtcMs(value: string): number {
+ return new Date(appendUtcZ(value)).getTime();
+}
+
export function formatUtcDateAsLocal(value: string | null | undefined): string {
if (!value) return '';
- const utcValue = /(?:Z|[+-]\d{2}:\d{2})$/.test(value) ? value : `${value}Z`;
return new Intl.DateTimeFormat('de-DE', {
day: '2-digit',
month: '2-digit',
@@ -49,18 +58,32 @@ export function formatUtcDateAsLocal(value: string | null | undefined): string {
hour: '2-digit',
minute: '2-digit',
hour12: false,
- }).format(new Date(utcValue));
+ }).format(new Date(appendUtcZ(value)));
}
+// Compact clock format: "00:05 min", "02:28 min", and "1:01:30 h" past an hour.
+export function formatDurationSeconds(totalSeconds: number): string {
+ const s = Math.max(0, Math.round(totalSeconds));
+ const pad = (n: number) => n.toString().padStart(2, '0');
+ const hours = Math.floor(s / 3600);
+ const minutes = Math.floor((s % 3600) / 60);
+ const seconds = s % 60;
+ if (hours > 0) {
+ return `${hours}:${pad(minutes)}:${pad(seconds)} h`;
+ }
+ return `${pad(minutes)}:${pad(seconds)} min`;
+}
+
+// Duration of a finished run, or null while it is still running.
export function formatRunDuration(run: JobRun): string | null {
if (!run.started_at || !run.finished_at) return null;
- const seconds = Math.max(
- 0,
- Math.round(
- (new Date(run.finished_at).getTime() -
- new Date(run.started_at).getTime()) /
- 1000,
- ),
+ return formatDurationSeconds(
+ (toUtcMs(run.finished_at) - toUtcMs(run.started_at)) / 1000,
);
- return `${seconds} s`;
+}
+
+// Live elapsed time since the run started, relative to the given "now" (ms).
+export function formatRunElapsed(run: JobRun, nowMs: number): string | null {
+ if (!run.started_at) return null;
+ return formatDurationSeconds((nowMs - toUtcMs(run.started_at)) / 1000);
}