Skip to content

Commit 95c2cb4

Browse files
authored
Add run status in action view page (#24223)
Backport #23212
1 parent 7d717e2 commit 95c2cb4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

routers/web/repo/actions/view.go

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type ViewResponse struct {
5151
Run struct {
5252
Link string `json:"link"`
5353
Title string `json:"title"`
54+
Status string `json:"status"`
5455
CanCancel bool `json:"canCancel"`
5556
Done bool `json:"done"`
5657
Jobs []*ViewJob `json:"jobs"`
@@ -109,6 +110,7 @@ func ViewPost(ctx *context_module.Context) {
109110
resp.State.Run.CanCancel = !run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions)
110111
resp.State.Run.Done = run.Status.IsDone()
111112
resp.State.Run.Jobs = make([]*ViewJob, 0, len(jobs)) // marshal to '[]' instead fo 'null' in json
113+
resp.State.Run.Status = run.Status.String()
112114
for _, v := range jobs {
113115
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &ViewJob{
114116
ID: v.ID,

web_src/js/components/RepoActionView.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
<div class="action-view-container">
33
<div class="action-view-header">
44
<div class="action-info-summary">
5-
{{ run.title }}
5+
<SvgIcon name="octicon-check-circle-fill" size="20" class="green" v-if="run.status === 'success'"/>
6+
<SvgIcon name="octicon-clock" size="20" class="ui text yellow" v-else-if="run.status === 'waiting'"/>
7+
<SvgIcon name="octicon-meter" size="20" class="ui text yellow" class-name="job-status-rotate" v-else-if="run.status === 'running'"/>
8+
<SvgIcon name="octicon-x-circle-fill" size="20" class="red" v-else/>
9+
<div class="action-title">
10+
{{ run.title }}
11+
</div>
612
<button class="run_cancel" @click="cancelRun()" v-if="run.canCancel">
713
<i class="stop circle outline icon"/>
814
</button>
@@ -95,6 +101,7 @@ const sfc = {
95101
run: {
96102
link: '',
97103
title: '',
104+
status: '',
98105
canCancel: false,
99106
done: false,
100107
jobs: [

0 commit comments

Comments
 (0)