Skip to content

Commit 25d1a06

Browse files
committed
use "link-action" in Vue
1 parent fa7f631 commit 25d1a06

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

web_src/js/components/RepoActionView.vue

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<button class="ui basic small compact button red" @click="cancelRun()" v-else-if="run.canCancel">
1515
{{ locale.cancel }}
1616
</button>
17-
<button class="ui basic small compact button gt-mr-0" @click="rerun()" v-else-if="run.canRerun">
17+
<button class="ui basic small compact button gt-mr-0 link-action" :data-url="`${run.link}/rerun`" v-else-if="run.canRerun">
1818
{{ locale.rerun_all }}
1919
</button>
2020
</div>
@@ -38,7 +38,7 @@
3838
<span class="job-brief-name gt-mx-3 gt-ellipsis">{{ job.name }}</span>
3939
</div>
4040
<span class="job-brief-item-right">
41-
<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"/>
41+
<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"/>
4242
<span class="step-summary-duration">{{ job.duration }}</span>
4343
</span>
4444
</a>
@@ -126,7 +126,6 @@ import {createApp} from 'vue';
126126
import {toggleElem} from '../utils/dom.js';
127127
import {getCurrentLocale} from '../utils.js';
128128
import {renderAnsi} from '../render/ansi.js';
129-
import {showErrorToast} from '../modules/toast.js';
130129
131130
const {csrfToken} = window.config;
132131
@@ -265,15 +264,6 @@ const sfc = {
265264
this.loadJob(); // try to load the data immediately instead of waiting for next timer interval
266265
}
267266
},
268-
// rerun a job
269-
async rerunJob(idx) {
270-
const jobLink = `${this.run.link}/jobs/${idx}`;
271-
await this.fetchRerun(`${jobLink}/rerun`, jobLink);
272-
},
273-
// rerun workflow
274-
async rerun() {
275-
await this.fetchRerun(`${this.run.link}/rerun`, this.run.link);
276-
},
277267
// cancel a run
278268
cancelRun() {
279269
this.fetchPost(`${this.run.link}/cancel`);
@@ -341,16 +331,6 @@ const sfc = {
341331
return await resp.json();
342332
},
343333
344-
async fetchRerun(url, hrefURL) {
345-
const resp = await this.fetchPost(url);
346-
const results = await resp.json();
347-
if (results.errorMessage) {
348-
showErrorToast(results.errorMessage);
349-
} else {
350-
window.location.href = hrefURL;
351-
}
352-
},
353-
354334
async loadJob() {
355335
if (this.loading) return;
356336
try {

0 commit comments

Comments
 (0)