|
20 | 20 | <SvgIcon name="octicon-meter" class="ui text yellow" class-name="job-status-rotate" v-else-if="job.status === 'running'"/> |
21 | 21 | <SvgIcon name="octicon-x-circle-fill" class="red" v-else/> |
22 | 22 | {{ job.name }} |
23 | | - <button class="job-brief-rerun" @click="rerunJob(index)" v-if="job.canRerun"> |
| 23 | + <!-- TODO: it will be a better idea to move "button" out from "a", and the ".prevent" will not be needed. But it needs some work with CSS --> |
| 24 | + <button class="job-brief-rerun" @click.prevent="rerunJob(index)" v-if="job.canRerun"> |
24 | 25 | <SvgIcon name="octicon-sync" class="ui text black"/> |
25 | 26 | </button> |
26 | 27 | </a> |
@@ -162,12 +163,14 @@ const sfc = { |
162 | 163 | } |
163 | 164 | }, |
164 | 165 | // rerun a job |
165 | | - rerunJob(idx) { |
166 | | - this.fetch(`${this.run.link}/jobs/${idx}/rerun`); |
| 166 | + async rerunJob(idx) { |
| 167 | + const jobLink = `${this.run.link}/jobs/${idx}`; |
| 168 | + await this.fetchPost(`${jobLink}/rerun`); |
| 169 | + window.location.href = jobLink; |
167 | 170 | }, |
168 | 171 | // cancel a run |
169 | 172 | cancelRun() { |
170 | | - this.fetch(`${this.run.link}/cancel`); |
| 173 | + this.fetchPost(`${this.run.link}/cancel`); |
171 | 174 | }, |
172 | 175 |
|
173 | 176 | createLogLine(line) { |
@@ -205,7 +208,7 @@ const sfc = { |
205 | 208 | // for example: make cursor=null means the first time to fetch logs, cursor=eof means no more logs, etc |
206 | 209 | return {step: idx, cursor: it.cursor, expanded: it.expanded}; |
207 | 210 | }); |
208 | | - const resp = await this.fetch( |
| 211 | + const resp = await this.fetchPost( |
209 | 212 | `${this.actionsURL}/runs/${this.runIndex}/jobs/${this.jobIndex}`, |
210 | 213 | JSON.stringify({logCursors}), |
211 | 214 | ); |
@@ -245,7 +248,7 @@ const sfc = { |
245 | 248 | } |
246 | 249 | }, |
247 | 250 |
|
248 | | - fetch(url, body) { |
| 251 | + fetchPost(url, body) { |
249 | 252 | return fetch(url, { |
250 | 253 | method: 'POST', |
251 | 254 | headers: { |
|
0 commit comments