From 68aac691c1941da1fe69eaa457d18662192a7602 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Sat, 8 Apr 2023 07:20:50 +0900
Subject: [PATCH] Add job.duration in web ui (#23963)


Maybe we can change the location of it.
---
 routers/web/repo/actions/view.go         | 2 ++
 web_src/js/components/RepoActionView.vue | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index b2b625ea2..c553aef9a 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -75,6 +75,7 @@ type ViewJob struct {
 	Name     string `json:"name"`
 	Status   string `json:"status"`
 	CanRerun bool   `json:"canRerun"`
+	Duration string `json:"duration"`
 }
 
 type ViewCommit struct {
@@ -144,6 +145,7 @@ func ViewPost(ctx *context_module.Context) {
 			Name:     v.Name,
 			Status:   v.Status.String(),
 			CanRerun: v.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions),
+			Duration: v.Duration().String(),
 		})
 	}
 
diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue
index fa09d2fb9..6fcd6ce88 100644
--- a/web_src/js/components/RepoActionView.vue
+++ b/web_src/js/components/RepoActionView.vue
@@ -32,6 +32,7 @@
                 
                 {{ job.name }}
               
+              {{ job.duration }}
               
@@ -57,7 +58,7 @@
               
 
               {{ jobStep.summary }}
-              {{ jobStep.duration }}
+              {{ jobStep.duration }}
             
 
             
@@ -112,6 +113,7 @@ const sfc = {
           //   name: '',
           //   status: '',
           //   canRerun: false,
+          //   duration: '',
           // },
         ],
         commit: {
@@ -492,7 +494,7 @@ export function ansiLogToHTML(line) {
   flex: 1;
 }
 
-.job-step-container .job-step-summary .step-summary-dur {
+.job-step-container .job-step-summary .step-summary-duration {
   margin-left: 16px;
 }