This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit df779e3cd560c5d9ebb4282694b1f0eb6d94ff79
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Nov 4 22:47:12 2022 +0000

    fix error on increasing duration
---
 .../app-inspector/app/components/task-list/task-list.directive.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js 
b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js
index 2b9c7c58..26c8fb9d 100644
--- a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js
+++ b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js
@@ -127,12 +127,18 @@ export function taskListDirective() {
 
         $scope.isScheduled = isScheduled;
 
+        function roundChangingMillis(x) {
+            if (x<100) return "-";
+            if (x<1000) return Math.round(x/100)*100;
+            return Math.round(x/1000)*1000;
+        }
+
         $scope.getTaskDuration = function(task) {
             if (!task.startTimeUtc) {
                 return null;
             }
             if (!_.isNil(task.endTimeUtc) && task.endTimeUtc <= 0) return null;
-            return (task.endTimeUtc === null ? new Date().getTime() : 
task.endTimeUtc) - task.startTimeUtc;
+            return (task.endTimeUtc === null ? roundChangingMillis(new 
Date().getTime() - task.startTimeUtc) : task.endTimeUtc - task.startTimeUtc);
         }
         $scope.getTaskWorkflowId = task => {
             const tag = getTaskWorkflowTag(task);

Reply via email to