Skip to content

Commit

Permalink
use "link-action" in Vue
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Aug 18, 2023
1 parent fa7f631 commit 25d1a06
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<button class="ui basic small compact button red" @click="cancelRun()" v-else-if="run.canCancel">
{{ locale.cancel }}
</button>
<button class="ui basic small compact button gt-mr-0" @click="rerun()" v-else-if="run.canRerun">
<button class="ui basic small compact button gt-mr-0 link-action" :data-url="`${run.link}/rerun`" v-else-if="run.canRerun">
{{ locale.rerun_all }}
</button>
</div>
Expand All @@ -38,7 +38,7 @@
<span class="job-brief-name gt-mx-3 gt-ellipsis">{{ job.name }}</span>
</div>
<span class="job-brief-item-right">
<SvgIcon name="octicon-sync" role="button" :data-tooltip-content="locale.rerun" class="job-brief-rerun gt-mx-3" @click="rerunJob(index)" v-if="job.canRerun && onHoverRerunIndex === job.id"/>
<SvgIcon name="octicon-sync" role="button" :data-tooltip-content="locale.rerun" class="job-brief-rerun gt-mx-3 link-action" :data-url="`${run.link}/jobs/${index}/rerun`" v-if="job.canRerun && onHoverRerunIndex === job.id"/>
<span class="step-summary-duration">{{ job.duration }}</span>
</span>
</a>
Expand Down Expand Up @@ -126,7 +126,6 @@ import {createApp} from 'vue';
import {toggleElem} from '../utils/dom.js';
import {getCurrentLocale} from '../utils.js';
import {renderAnsi} from '../render/ansi.js';
import {showErrorToast} from '../modules/toast.js';
const {csrfToken} = window.config;
Expand Down Expand Up @@ -265,15 +264,6 @@ const sfc = {
this.loadJob(); // try to load the data immediately instead of waiting for next timer interval
}
},
// rerun a job
async rerunJob(idx) {
const jobLink = `${this.run.link}/jobs/${idx}`;
await this.fetchRerun(`${jobLink}/rerun`, jobLink);
},
// rerun workflow
async rerun() {
await this.fetchRerun(`${this.run.link}/rerun`, this.run.link);
},
// cancel a run
cancelRun() {
this.fetchPost(`${this.run.link}/cancel`);
Expand Down Expand Up @@ -341,16 +331,6 @@ const sfc = {
return await resp.json();
},
async fetchRerun(url, hrefURL) {
const resp = await this.fetchPost(url);
const results = await resp.json();
if (results.errorMessage) {
showErrorToast(results.errorMessage);
} else {
window.location.href = hrefURL;
}
},
async loadJob() {
if (this.loading) return;
try {
Expand Down

0 comments on commit 25d1a06

Please sign in to comment.