refactor(ui): replace link-action with async methods for job reruns
All checks were successful
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 3m23s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m19s
Build and Release / Lint (push) Successful in 5m22s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been skipped
Build and Release / Build Binary (linux/arm64) (push) Has been skipped
All checks were successful
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 3m23s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m19s
Build and Release / Lint (push) Successful in 5m22s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been skipped
Build and Release / Build Binary (linux/arm64) (push) Has been skipped
Replace link-action class with proper async methods (rerunJob and rerunAll) for handling job and workflow reruns in RepoActionView. This provides better control over the rerun flow and ensures proper page reload after the POST request completes.
This commit is contained in:
@@ -292,6 +292,16 @@ export default defineComponent({
|
||||
approveRun() {
|
||||
POST(`${this.run.link}/approve`);
|
||||
},
|
||||
// rerun a specific job
|
||||
async rerunJob(jobIndex: number) {
|
||||
await POST(`${this.run.link}/jobs/${jobIndex}/rerun`);
|
||||
window.location.reload();
|
||||
},
|
||||
// rerun all jobs
|
||||
async rerunAll() {
|
||||
await POST(`${this.run.link}/rerun`);
|
||||
window.location.reload();
|
||||
},
|
||||
|
||||
createLogLine(stepIndex: number, startTime: number, line: LogLine) {
|
||||
const lineNum = createElementFromAttrs('a', {class: 'line-num muted', href: `#jobstep-${stepIndex}-${line.index}`},
|
||||
@@ -497,7 +507,7 @@ export default defineComponent({
|
||||
<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 link-action tw-shrink-0" :data-url="`${run.link}/rerun`" v-else-if="run.canRerun">
|
||||
<button class="ui basic small compact button tw-shrink-0" @click="rerunAll()" v-else-if="run.canRerun">
|
||||
{{ locale.rerun_all }}
|
||||
</button>
|
||||
<a v-if="canAdmin" class="ui basic small compact button tw-shrink-0" :href="runnersUrl">
|
||||
@@ -531,7 +541,7 @@ export default defineComponent({
|
||||
<span class="job-brief-name tw-mx-2 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 tw-mx-2 link-action interact-fg" :data-url="`${run.link}/jobs/${index}/rerun`" v-if="job.canRerun"/>
|
||||
<SvgIcon name="octicon-sync" role="button" :data-tooltip-content="locale.rerun" class="job-brief-rerun tw-mx-2 interact-fg" @click.stop.prevent="rerunJob(index)" v-if="job.canRerun"/>
|
||||
<span class="step-summary-duration">{{ job.duration }}</span>
|
||||
</span>
|
||||
</a>
|
||||
@@ -580,7 +590,7 @@ export default defineComponent({
|
||||
<SvgIcon name="octicon-gear" :size="18"/>
|
||||
</button>
|
||||
<div class="menu transition action-job-menu" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
|
||||
<a class="item link-action" :data-url="`${run.link}/jobs/${jobIndex}/rerun`" v-if="run.jobs[Number(jobIndex)]?.canRerun">
|
||||
<a class="item" @click="rerunJob(Number(jobIndex))" v-if="run.jobs[Number(jobIndex)]?.canRerun">
|
||||
<i class="icon"><SvgIcon name="octicon-sync"/></i>
|
||||
{{ locale.rerun }}
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user