New route to stop all running/pending tests for a given work
This commit is contained in:
parent
8b8f3947f8
commit
bcf76a2c86
4 changed files with 90 additions and 0 deletions
|
@ -95,6 +95,20 @@ export class Work {
|
|||
}
|
||||
}
|
||||
|
||||
async stopTests() {
|
||||
if (this.id) {
|
||||
const res = await fetch(`api/works/${this.id}/tests`, {
|
||||
method: 'DELETE',
|
||||
headers: {'Accept': 'application/json'},
|
||||
});
|
||||
if (res.status == 200) {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getSubmission(uid) {
|
||||
const res = await fetch(uid?`api/users/${uid}/works/${this.id}/submission`:`api/works/${this.id}/submission`, {
|
||||
headers: {'Accept': 'application/json'}
|
||||
|
|
|
@ -79,6 +79,13 @@
|
|||
<i class="bi bi-play"></i>
|
||||
{/if}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-sm btn-danger mr-1"
|
||||
title="Arrêter tous les tests en cours"
|
||||
on:click={() => w.stopTests()}
|
||||
>
|
||||
<i class="bi bi-stop"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Reference in a new issue