Block deletion of workflow trigger unless it's the only step left

This commit is contained in:
Andrew Kingston 2020-09-17 14:04:45 +01:00
parent d31f4f5c34
commit 48f13af109
1 changed files with 11 additions and 3 deletions

View File

@ -10,8 +10,10 @@
let selectedTab = "SETUP" let selectedTab = "SETUP"
$: workflow = $: workflow = $workflowStore.selectedWorkflow?.workflow
$workflowStore.selectedWorkflow && $workflowStore.selectedWorkflow.workflow $: allowDeleteBlock =
$workflowStore.selectedBlock?.type !== "TRIGGER" ||
!workflow?.definition?.steps?.length
function deleteWorkflow() { function deleteWorkflow() {
open( open(
@ -60,7 +62,13 @@
<Button green wide data-cy="save-workflow-setup" on:click={saveWorkflow}> <Button green wide data-cy="save-workflow-setup" on:click={saveWorkflow}>
Save Workflow Save Workflow
</Button> </Button>
<Button red wide on:click={deleteWorkflowBlock}>Delete Block</Button> <Button
disabled={!allowDeleteBlock}
red
wide
on:click={deleteWorkflowBlock}>
Delete Block
</Button>
</div> </div>
{:else if $workflowStore.selectedWorkflow} {:else if $workflowStore.selectedWorkflow}
<div class="panel"> <div class="panel">