Make survey duplication synchronous (to avoid proposals randomization)
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
0cab193d6c
commit
8f5e2f380f
2 changed files with 38 additions and 25 deletions
|
|
@ -34,10 +34,14 @@
|
|||
})
|
||||
}
|
||||
|
||||
let duplicateInProgress = false;
|
||||
function duplicateSurvey() {
|
||||
duplicateInProgress = true;
|
||||
survey.duplicate().then((response) => {
|
||||
duplicateInProgress = false;
|
||||
goto(`surveys/${response.id}`);
|
||||
}).catch((error) => {
|
||||
duplicateInProgress = false;
|
||||
ToastsStore.addErrorToast({
|
||||
msg: error,
|
||||
});
|
||||
|
|
@ -157,14 +161,19 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-sm-10">
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
{#if survey.id}
|
||||
<button type="button" class="btn btn-danger" on:click={deleteSurvey} disabled={deleteInProgress}>
|
||||
{#if survey.id || duplicateInProgress}
|
||||
<button type="button" class="btn btn-danger" on:click={deleteSurvey} disabled={deleteInProgress || duplicateInProgress}>
|
||||
{#if deleteInProgress}
|
||||
<div class="spinner-border spinner-border-sm text-light me-1" role="status"></div>
|
||||
{/if}
|
||||
Supprimer
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" on:click={duplicateSurvey}>Dupliquer avec ces nouveaux paramètres</button>
|
||||
<button type="button" class="btn btn-secondary" on:click={duplicateSurvey} disabled={duplicateInProgress}>
|
||||
{#if duplicateInProgress}
|
||||
<div class="spinner-border spinner-border-sm text-dark me-1" role="status"></div>
|
||||
{/if}
|
||||
Dupliquer avec ces nouveaux paramètres
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue