diff --git a/src/app/layouts/tasks-executor/tasks-executor.ts b/src/app/layouts/tasks-executor/tasks-executor.ts
index 2b60b39..5b14f93 100644
--- a/src/app/layouts/tasks-executor/tasks-executor.ts
+++ b/src/app/layouts/tasks-executor/tasks-executor.ts
@@ -79,12 +79,28 @@ export class TasksExecutor {
}
private formatDuration(startTime: number | null, endTime: number | null): string {
- if (!startTime || !endTime) return '00:00:00';
+ if (!startTime || !endTime) return '0 sec';
const diffMs = Math.max(0, endTime - startTime);
const totalSeconds = Math.floor(diffMs / 1000);
- const hh = String(Math.floor(totalSeconds / 3600)).padStart(2, '0');
- const mm = String(Math.floor((totalSeconds % 3600) / 60)).padStart(2, '0');
- const ss = String(totalSeconds % 60).padStart(2, '0');
- return `${hh}:${mm}:${ss}`;
+ const totalMinutes = Math.floor(totalSeconds / 60);
+ const totalHours = Math.floor(totalMinutes / 60);
+ const totalDays = Math.floor(totalHours / 24);
+
+ if (totalSeconds < 60) {
+ return `${totalSeconds} sec`;
+ }
+
+ if (totalMinutes < 60) {
+ const seconds = totalSeconds % 60;
+ return seconds > 0 ? `${totalMinutes} min ${seconds} sec` : `${totalMinutes} min`;
+ }
+
+ if (totalHours < 24) {
+ const minutes = totalMinutes % 60;
+ return minutes > 0 ? `${totalHours} h ${minutes} min` : `${totalHours} h`;
+ }
+
+ const hours = totalHours % 24;
+ return hours > 0 ? `${totalDays} gg ${hours} h` : `${totalDays} gg`;
}
}
diff --git a/src/app/shared/task-execution-viewer/task-execution-viewer.html b/src/app/shared/task-execution-viewer/task-execution-viewer.html
index fd77e84..f8e421a 100644
--- a/src/app/shared/task-execution-viewer/task-execution-viewer.html
+++ b/src/app/shared/task-execution-viewer/task-execution-viewer.html
@@ -33,7 +33,7 @@
Duration
-
{{ durationMs() != null ? durationMs() + ' ms' : '-' }}
+
{{ formattedDuration() }}
Steps
diff --git a/src/app/shared/task-execution-viewer/task-execution-viewer.ts b/src/app/shared/task-execution-viewer/task-execution-viewer.ts
index 855a388..b655092 100644
--- a/src/app/shared/task-execution-viewer/task-execution-viewer.ts
+++ b/src/app/shared/task-execution-viewer/task-execution-viewer.ts
@@ -65,10 +65,10 @@ export class TaskExecutionViewerComponent implements OnDestroy {
return { blocks, connections };
});
- readonly durationMs = computed(() => {
+ readonly formattedDuration = computed(() => {
const context = this.execution()?.context;
- if (!context?.startTime || !context?.endTime) return null;
- return Math.max(0, context.endTime - context.startTime);
+ if (!context?.startTime || !context?.endTime) return '-';
+ return this.formatDuration(context.startTime, context.endTime);
});
readonly inputsReadOnly = computed(() => {
@@ -239,6 +239,31 @@ export class TaskExecutionViewerComponent implements OnDestroy {
this.textInputDebounceTimers.delete(timerKey);
}
+ private formatDuration(startTime: number, endTime: number): string {
+ const diffMs = Math.max(0, endTime - startTime);
+ const totalSeconds = Math.floor(diffMs / 1000);
+ const totalMinutes = Math.floor(totalSeconds / 60);
+ const totalHours = Math.floor(totalMinutes / 60);
+ const totalDays = Math.floor(totalHours / 24);
+
+ if (totalSeconds < 60) {
+ return `${totalSeconds} sec`;
+ }
+
+ if (totalMinutes < 60) {
+ const seconds = totalSeconds % 60;
+ return seconds > 0 ? `${totalMinutes} min ${seconds} sec` : `${totalMinutes} min`;
+ }
+
+ if (totalHours < 24) {
+ const minutes = totalMinutes % 60;
+ return minutes > 0 ? `${totalHours} h ${minutes} min` : `${totalHours} h`;
+ }
+
+ const hours = totalHours % 24;
+ return hours > 0 ? `${totalDays} gg ${hours} h` : `${totalDays} gg`;
+ }
+
private inferConnections(steps: TaskExecutionStep[]) {
const connections: FlowData['connections'] = [];