Skip to content

Commit 453b058

Browse files
committed
improved presenting duration of job steps
1 parent b5ab81b commit 453b058

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

server/kraken/server/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2022 The Kraken Authors
1+
# Copyright 2020-2023 The Kraken Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import logging
16+
import datetime
1617

1718
from flask_sqlalchemy import SQLAlchemy
1819
from sqlalchemy import Column, Boolean, DateTime, ForeignKey, Integer, Unicode, UnicodeText, String
@@ -569,6 +570,9 @@ class Step(db.Model, DatesMixin):
569570
# services
570571

571572
def get_json(self, with_fields=True, mask_secrets=False):
573+
if self.result and 'duration' in self.result:
574+
d = datetime.timedelta(seconds=self.result['duration'])
575+
self.result['duration'] = duration_to_txt(d)
572576
data = dict(id=self.id,
573577
index=self.index,
574578
tool=self.tool.name,

ui/src/app/logs-panel/logs-panel.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<span class="text-600">Status:</span> {{ getStepStatus(step) }}
3232
</span>
3333
<ng-container *ngIf="step.result">
34-
<span *ngIf="step.result.duration >= 0" class="mr-4">
35-
<span class="text-600">Duration:</span> {{ step.result.duration }}s
34+
<span *ngIf="step.result.duration" class="mr-4">
35+
<span class="text-600">Duration:</span> {{ step.result.duration }}
3636
</span>
3737
<ng-container *ngIf="step.result['reason']">
3838
<span class="mr-4">

0 commit comments

Comments
 (0)