]> source.dussan.org Git - gitea.git/commitdiff
Add run status in action view page (#23212)
authoryp05327 <576951401@qq.com>
Sat, 4 Mar 2023 05:41:37 +0000 (14:41 +0900)
committerGitHub <noreply@github.com>
Sat, 4 Mar 2023 05:41:37 +0000 (00:41 -0500)
Before:

![image](https://user-images.githubusercontent.com/18380374/222084932-a7643fbe-2d9f-48db-b25d-74ace49e03f4.png)

![image](https://user-images.githubusercontent.com/18380374/222084887-fde3500d-dad3-4902-9c82-c4f71f23f83b.png)

After:

![image](https://user-images.githubusercontent.com/18380374/222084565-eeef1110-9d9d-40b4-a26b-fbd5a307f14e.png)

![image](https://user-images.githubusercontent.com/18380374/222084728-6c96d7c1-a399-43d5-8369-392ad5017b7f.png)

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
routers/web/repo/actions/view.go
web_src/js/components/RepoActionView.vue

index dd2750f905883546e273fbdf03201e755d6c2200..5569709368ce8a5a8d47350e34d0f57ed2431bf7 100644 (file)
@@ -51,6 +51,7 @@ type ViewResponse struct {
                Run struct {
                        Link       string     `json:"link"`
                        Title      string     `json:"title"`
+                       Status     string     `json:"status"`
                        CanCancel  bool       `json:"canCancel"`
                        CanApprove bool       `json:"canApprove"` // the run needs an approval and the doer has permission to approve
                        Done       bool       `json:"done"`
@@ -111,6 +112,7 @@ func ViewPost(ctx *context_module.Context) {
        resp.State.Run.CanApprove = run.NeedApproval && ctx.Repo.CanWrite(unit.TypeActions)
        resp.State.Run.Done = run.Status.IsDone()
        resp.State.Run.Jobs = make([]*ViewJob, 0, len(jobs)) // marshal to '[]' instead fo 'null' in json
+       resp.State.Run.Status = run.Status.String()
        for _, v := range jobs {
                resp.State.Run.Jobs = append(resp.State.Run.Jobs, &ViewJob{
                        ID:       v.ID,
index 762067f52388bd736a01fc287766ac47480d4b84..a5c12c754ece83da3560500e01b2247a6bb50537 100644 (file)
@@ -2,7 +2,13 @@
   <div class="action-view-container">
     <div class="action-view-header">
       <div class="action-info-summary">
-        {{ run.title }}
+        <SvgIcon name="octicon-check-circle-fill" size="20" class="green" v-if="run.status === 'success'"/>
+        <SvgIcon name="octicon-clock" size="20" class="ui text yellow" v-else-if="run.status === 'waiting'"/>
+        <SvgIcon name="octicon-meter" size="20" class="ui text yellow" class-name="job-status-rotate" v-else-if="run.status === 'running'"/>
+        <SvgIcon name="octicon-x-circle-fill" size="20" class="red" v-else/>
+        <div class="action-title">
+          {{ run.title }}
+        </div>
         <button class="run_approve" @click="approveRun()" v-if="run.canApprove">
           <i class="play circle outline icon"/>
         </button>
@@ -99,6 +105,7 @@ const sfc = {
       run: {
         link: '',
         title: '',
+        status: '',
         canCancel: false,
         canApprove: false,
         done: false,
@@ -327,7 +334,11 @@ export function initRepositoryActionView() {
 .action-info-summary {
   font-size: 150%;
   height: 20px;
-  padding: 0 10px;
+  display: flex;
+
+  .action-title {
+    padding: 0 5px;
+  }
 }
 
 // ================