Add rerun workflow button and refactor to use SVG octicons (#24350)

Changes:
- Add rerun workflow button. Then users can rerun the whole workflow by
only one-click.
- Refactor to use SVG octicons in RepoActionView.vue

![image](https://user-images.githubusercontent.com/18380374/234736083-dea9b333-ec11-4095-a113-763f3716fba7.png)

![image](https://user-images.githubusercontent.com/18380374/234736107-d657d19c-f70a-42f4-985f-156a8c7efb7a.png)

![image](https://user-images.githubusercontent.com/18380374/234736160-9ad372df-7089-4d18-9bab-48bca3f01878.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
yp05327 2023-05-01 23:14:20 +09:00 committed by GitHub
parent 18fc4f5289
commit 5987f00523
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 25 deletions

View file

@ -6,11 +6,14 @@
<div class="action-title">
{{ run.title }}
</div>
<button class="run_approve" @click="approveRun()" v-if="run.canApprove">
<i class="play circle outline icon"/>
<button class="action-control-button text green" @click="approveRun()" v-if="run.canApprove">
<SvgIcon name="octicon-play" :size="20"/>
</button>
<button class="run_cancel" @click="cancelRun()" v-else-if="run.canCancel">
<i class="stop circle outline icon"/>
<button class="action-control-button text red" @click="cancelRun()" v-else-if="run.canCancel">
<SvgIcon name="octicon-x-circle-fill" :size="20"/>
</button>
<button class="action-control-button text green" @click="rerun()" v-else-if="run.canRerun">
<SvgIcon name="octicon-sync" :size="20"/>
</button>
</div>
<div class="action-commit-summary">
@ -106,6 +109,7 @@ const sfc = {
status: '',
canCancel: false,
canApprove: false,
canRerun: false,
done: false,
jobs: [
// {
@ -193,6 +197,11 @@ const sfc = {
await this.fetchPost(`${jobLink}/rerun`);
window.location.href = jobLink;
},
// rerun workflow
async rerun() {
await this.fetchPost(`${this.run.link}/rerun`);
window.location.href = this.run.link;
},
// cancel a run
cancelRun() {
this.fetchPost(`${this.run.link}/cancel`);
@ -366,26 +375,16 @@ export function ansiLogToHTML(line) {
margin: 0 20px 20px 20px;
}
.action-view-header .run_cancel {
.action-view-header .action-control-button {
border: none;
color: var(--color-red);
background-color: transparent;
outline: none;
cursor: pointer;
transition: transform 0.2s;
display: flex;
}
.action-view-header .run_approve {
border: none;
color: var(--color-green);
background-color: transparent;
outline: none;
cursor: pointer;
transition: transform 0.2s;
}
.action-view-header .run_cancel:hover,
.action-view-header .run_approve:hover {
.action-view-header .action-control-button:hover {
transform: scale(130%);
}

View file

@ -18,6 +18,7 @@ import octiconLink from '../../public/img/svg/octicon-link.svg';
import octiconLock from '../../public/img/svg/octicon-lock.svg';
import octiconMilestone from '../../public/img/svg/octicon-milestone.svg';
import octiconMirror from '../../public/img/svg/octicon-mirror.svg';
import octiconPlay from '../../public/img/svg/octicon-play.svg';
import octiconProject from '../../public/img/svg/octicon-project.svg';
import octiconRepo from '../../public/img/svg/octicon-repo.svg';
import octiconRepoForked from '../../public/img/svg/octicon-repo-forked.svg';
@ -79,6 +80,7 @@ const svgs = {
'octicon-milestone': octiconMilestone,
'octicon-mirror': octiconMirror,
'octicon-organization': octiconOrganization,
'octicon-play': octiconPlay,
'octicon-plus': octiconPlus,
'octicon-project': octiconProject,
'octicon-repo': octiconRepo,