Don't perform repo trigger if submission is closed

This commit is contained in:
nemunaire 2022-09-05 05:13:30 +02:00
parent 0b16676929
commit 0042d373f6
2 changed files with 34 additions and 4 deletions

View file

@ -17,9 +17,10 @@
function updatePullState(repo) {
repo_pull_state = repo.getBuildState();
show_logs = null;
repo_pull_state.then((state) => {
if (state.status == "pending" || state.status == "running") {
setTimeout(() => updatePullState(repo), state.status == "pending" ? 1000 : 2500);
setTimeout(() => updatePullState(repo), state.status == "pending" ? 1000 : 3000);
}
})
}
@ -53,6 +54,17 @@
});
});
}
function goRetrieveWork(repo) {
submitInProgress = true;
repo.retrieveWork().then(() => {
submitInProgress = false;
refresh_repo_work();
}, (error) => {
submitInProgress = false;
ToastsStore.addErrorToast({msg: "Une erreur s'est produite : " + error});
})
}
</script>
{#await repo_work}
@ -75,8 +87,8 @@
{#if state.status == "pending" || state.status == "running"}
<div
class="spinner-grow spinner-grow-sm mx-1"
class:text-secondary={state.status == "pending"}
class:text-warning={state.status == "running"}
class:text-primary={state.status == "pending"}
class:text-warning={state.status == "running"}
title="La récupération est en cours"
role="status"
></div>
@ -96,7 +108,7 @@
type="button"
class="btn btn-outline-info float-end mb-1"
disable={submitInProgress || readonly}
on:click={() => repo.retrieveWork().then(() => { refresh_repo_work() }, (error) => ToastsStore.addErrorToast({msg: "Une erreur s'est produite : " + error}))}
on:click={() => goRetrieveWork(repo)}
>
Récupérer mon travail
</button>