Files
windmill/frontend/src/lib/components/flows/content/FlowModuleHeader.svelte
T
Faton Ramadani deb0b47a5f fix(frontend): Hide the editor panel when we are editing a PathScript (#631)
* fix(frontend): Hide the editor panel when we are editing a PathScript

* feat(front): Remove viewCode action and display the code in the Editor panel
2022-09-27 17:52:02 +02:00

44 lines
1.3 KiB
Svelte

<script lang="ts">
import { isEmptyFlowModule } from '$lib/components/flows/flowStateUtils'
import type { FlowModule } from '$lib/gen'
import { faCodeBranch, faSave, faTrashAlt } from '@fortawesome/free-solid-svg-icons'
import { Button } from 'flowbite-svelte'
import { createEventDispatcher, getContext } from 'svelte'
import Icon from 'svelte-awesome'
import type { FlowEditorContext } from '../types'
export let module: FlowModule
$: shouldPick = isEmptyFlowModule(module)
const dispatch = createEventDispatcher()
const { selectedId } = getContext<FlowEditorContext>('FlowEditorContext')
</script>
<div class="flex flex-row space-x-2" on:click|stopPropagation={() => undefined}>
{#if module.value.type === 'script' && !shouldPick}
<Button size="xs" color="alternative" on:click={() => dispatch('fork')}>
<Icon data={faCodeBranch} class="mr-2" />
Fork
</Button>
{/if}
{#if module.value.type === 'rawscript' && !shouldPick}
<Button size="xs" color="alternative" on:click={() => dispatch('createScriptFromInlineScript')}>
<Icon data={faSave} class="mr-2" />
Save to workspace
</Button>
{/if}
<Button
size="xs"
color="alternative"
on:click={() => {
dispatch('delete')
}}
>
<Icon data={faTrashAlt} class="mr-2" />
{$selectedId.includes('failure') ? 'Delete error handler' : 'Remove step'}
</Button>
</div>