Skip to content

Commit 5e7543f

Browse files
HesterGwolfogre
andauthored
Use same action status svg icons on actions list as on action page (#24178)
Close #24020 After: These icons are the same now: <img width="1287" alt="截屏2023-04-18 13 52 11" src="https://user-images.githubusercontent.com/17645053/232684252-05ddc101-dc5b-41b5-b374-132c3d853a41.png"> <img width="1141" alt="截屏2023-04-18 13 54 48" src="https://user-images.githubusercontent.com/17645053/232684261-6ebd864a-a9aa-4982-af32-2cea91c35be8.png"> In this PR, didn't use `ActionRunStatus.vue` because the mounting of the component will cause flash of the icons like below: https://user-images.githubusercontent.com/17645053/232682646-713202dc-9023-4b9c-a849-c3a1ae6dd155.mov Instead, modified and used `status.tmpl` to make it the same as `ActionRunStatus.vue` to avoid the ui flash (Welcomed to show how to use `ActionRunStatus.vue` without flashing if there is a way). Added comments to both of them for reminding synchronization of these two files. --------- Co-authored-by: Jason Song <i@wolfogre.com>
1 parent 5fcf328 commit 5e7543f

File tree

3 files changed

+36
-19
lines changed

3 files changed

+36
-19
lines changed

templates/repo/actions/runs_list.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div class="issue list">
22
{{range .Runs}}
33
<li class="item gt-df gt-py-3 gt-ab">
4-
<div class="issue-item-left gt-df">
5-
{{template "repo/actions/status" .Status}}
4+
<div class="issue-item-left gt-df gt-mr-2">
5+
{{template "repo/actions/status" (dict "status" .Status.String)}}
66
</div>
77
<div class="issue-item-main action-item-main gt-f1 gt-fc gt-df gt-mr-3">
88
<div class="issue-item-top-row">

templates/repo/actions/status.tmpl

+25-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
{{if .IsWaiting}}
2-
<i class="commit-status circle icon gray"></i>
3-
{{end}}
4-
{{if .IsRunning}}
5-
<i class="commit-status circle icon yellow"></i>
6-
{{end}}
7-
{{if .IsSuccess}}
8-
<i class="commit-status check icon green"></i>
9-
{{end}}
10-
{{if .IsFailure}}
11-
<i class="commit-status warning icon red"></i>
1+
<!-- This template should be kept the same as web_src/js/components/ActionRunStatus.vue
2+
Please also update the vue file above if this template is modified.
3+
-->
4+
{{- $size := 16 -}}
5+
{{- if .size -}}
6+
{{- $size = .size -}}
7+
{{- end -}}
8+
9+
{{- $className := "" -}}
10+
{{- if .className -}}
11+
{{- $className = .className -}}
12+
{{- end -}}
13+
14+
{{if eq .status "success"}}
15+
{{svg "octicon-check-circle-fill" $size (printf "text green %s" $className)}}
16+
{{else if eq .status "skipped"}}
17+
{{svg "octicon-skip" $size (printf "text grey %s" $className)}}
18+
{{else if eq .status "waiting"}}
19+
{{svg "octicon-clock" $size (printf "text yellow %s" $className)}}
20+
{{else if eq .status "blocked"}}
21+
{{svg "octicon-blocked" $size (printf "text yellow %s" $className)}}
22+
{{else if eq .status "running"}}
23+
{{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}}
24+
{{else}}
25+
{{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}}
1226
{{end}}

web_src/js/components/ActionRunStatus.vue

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
<!-- This vue should be kept the same as templates/repo/actions/status.tmpl
2+
Please also update the template file above if this vue is modified.
3+
-->
14
<template>
2-
<SvgIcon name="octicon-check-circle-fill" class="ui text green" :size="size" :class-name="className" v-if="status === 'success'"/>
3-
<SvgIcon name="octicon-skip" class="ui text grey" :size="size" :class-name="className" v-else-if="status === 'skipped'"/>
4-
<SvgIcon name="octicon-clock" class="ui text yellow" :size="size" :class-name="className" v-else-if="status === 'waiting'"/>
5-
<SvgIcon name="octicon-blocked" class="ui text yellow" :size="size" :class-name="className" v-else-if="status === 'blocked'"/>
6-
<SvgIcon name="octicon-meter" class="ui text yellow" :size="size" :class-name="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
7-
<SvgIcon name="octicon-x-circle-fill" class="ui text red" :size="size" v-else/>
5+
<SvgIcon name="octicon-check-circle-fill" class="text green" :size="size" :class-name="className" v-if="status === 'success'"/>
6+
<SvgIcon name="octicon-skip" class="text grey" :size="size" :class-name="className" v-else-if="status === 'skipped'"/>
7+
<SvgIcon name="octicon-clock" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'waiting'"/>
8+
<SvgIcon name="octicon-blocked" class="text yellow" :size="size" :class-name="className" v-else-if="status === 'blocked'"/>
9+
<SvgIcon name="octicon-meter" class="text yellow" :size="size" :class-name="'job-status-rotate ' + className" v-else-if="status === 'running'"/>
10+
<SvgIcon name="octicon-x-circle-fill" class="text red" :size="size" v-else/>
811
</template>
912

1013
<script>

0 commit comments

Comments
 (0)