mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 00:01:55 +00:00
deb0b47a5f
* 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
44 lines
1.3 KiB
Svelte
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>
|