Skip to content

Commit bc90d8f

Browse files
committed
Prevent reordering workflow task error
Closes #84
1 parent 13cb694 commit bc90d8f

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/routes/projects/[id]/workflows/[workflowId]/+page.svelte

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,21 +398,27 @@
398398
{#if workflow !== undefined && updatableWorkflowList.length == 0 }
399399
<p class="text-center mt-3">No workflow tasks yet, add one.</p>
400400
{:else if workflow !== undefined}
401-
<ul class="list-group list-group-flush">
402-
{#each updatableWorkflowList as workflowTask, i }
403-
<li class="list-group-item" data-fs-target={workflowTask.id}>
404-
<div class="d-flex justify-content-between align-items-center">
405-
<div>
406-
{workflowTask.task.name} #{workflowTask.id}
407-
</div>
408-
<div>
409-
<button class="btn btn-light" on:click|preventDefault={moveWorkflowTask.bind(this, i, 'up')}><i class="bi-arrow-up"></i></button>
410-
<button class="btn btn-light" on:click|preventDefault={moveWorkflowTask.bind(this, i, 'down')}><i class="bi-arrow-down"></i></button>
401+
{#key updatableWorkflowList }
402+
<ul class="list-group list-group-flush">
403+
{#each updatableWorkflowList as workflowTask, i }
404+
<li class="list-group-item" data-fs-target={workflowTask.id}>
405+
<div class="d-flex justify-content-between align-items-center">
406+
<div>
407+
{workflowTask.task.name} #{workflowTask.id}
408+
</div>
409+
<div>
410+
{#if i !== 0 }
411+
<button class="btn btn-light" on:click|preventDefault={moveWorkflowTask.bind(this, i, 'up')}><i class="bi-arrow-up"></i></button>
412+
{/if}
413+
{#if i !== updatableWorkflowList.length - 1 }
414+
<button class="btn btn-light" on:click|preventDefault={moveWorkflowTask.bind(this, i, 'down')}><i class="bi-arrow-down"></i></button>
415+
{/if}
416+
</div>
411417
</div>
412-
</div>
413-
</li>
414-
{/each}
415-
</ul>
418+
</li>
419+
{/each}
420+
</ul>
421+
{/key}
416422
{/if}
417423
418424
</div>

0 commit comments

Comments
 (0)