diff --git a/frontend/src/app.css b/frontend/src/app.css index 6f0bd1cddb..7b19f3ebf0 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -89,6 +89,30 @@ @apply text-sm; } + .default-secondary-button-v2 { + @apply text-gray-900; + @apply bg-white; + @apply border; + @apply border-gray-200; + @apply font-medium; + @apply rounded-lg; + @apply text-sm; + @apply px-5; + @apply py-2.5; + @apply text-center; + @apply inline-flex; + @apply items-center; + } + + .default-secondary-button-v2:focus { + @apply ring-4; + @apply outline-none; + @apply ring-gray-100; + } + .default-secondary-button-v2:hover { + @apply bg-gray-100 + } + .input-error { @apply border-red-500 !important; } diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte index e3421e4acc..6808f6f26e 100644 --- a/frontend/src/lib/components/FlowBuilder.svelte +++ b/frontend/src/lib/components/FlowBuilder.svelte @@ -2,11 +2,12 @@ import { goto } from '$app/navigation' import { page } from '$app/stores' import { FlowService, ScriptService, type Flow } from '$lib/gen' - import { clearPreviewResults, workspaceStore, hubScripts } from '$lib/stores' + import { clearPreviewResults, hubScripts, workspaceStore } from '$lib/stores' import { sendUserToast } from '$lib/utils' import { onMount } from 'svelte' import SvelteMarkdown from 'svelte-markdown' import FlowEditor from './FlowEditor.svelte' + import { flowStore, initFlow } from './flows/flowStore' import Path from './Path.svelte' import Required from './Required.svelte' import ScriptSchema from './ScriptSchema.svelte' @@ -26,7 +27,7 @@ } async function saveFlow(): Promise { - if (initialPath == '') { + if (initialPath === '') { await FlowService.createFlow({ workspace: $workspaceStore!, requestBody: { @@ -40,7 +41,7 @@ } else { await FlowService.updateFlow({ workspace: $workspaceStore!, - path: initialPath, + path: flow.path, requestBody: { path: flow.path, summary: flow.summary, @@ -58,10 +59,12 @@ goto(`?step=${step}`) } - $: { + flowStore.subscribe((flow: Flow) => { $page.url.searchParams.set('state', btoa(JSON.stringify(flow))) history.replaceState({}, '', $page.url) - } + }) + + $: flow && initFlow(flow) onMount(() => { loadSearchData() @@ -107,12 +110,14 @@ class="default-button px-6 max-h-8" on:click={() => { changeStep(step + 1) - }}>Next + Next + {#if step == 2} - + {/if} {:else} @@ -187,7 +192,7 @@ {:else if step === 2} - + {:else if step === 3} - import type { Schema } from '$lib/common' - import { FlowModuleValue, type Flow } from '$lib/gen' - import { loadSchema } from '$lib/scripts' - import { emptySchema } from '$lib/utils' import { faPlus } from '@fortawesome/free-solid-svg-icons' import Icon from 'svelte-awesome' import FlowPreview from './FlowPreview.svelte' + import CopyFirstStepSchema from './flows/CopyFirstStepSchema.svelte' + import { addModule, flowStore } from './flows/flowStore' import ModuleStep from './ModuleStep.svelte' import SchemaEditor from './SchemaEditor.svelte' - import type SchemaForm from './SchemaForm.svelte' - - export let flow: Flow let args: Record = {} - let schemas: Schema[] = [] - let schemaForms: (SchemaForm | undefined)[] = [] - - function addModule() { - schemaForms.push(undefined) - - let newModule = { - value: { type: FlowModuleValue.type.SCRIPT, path: '' }, - input_transform: {} - } - flow.value.modules = flow.value.modules.concat(newModule) - schemas.push(emptySchema()) - } + $: numberOfSteps = $flowStore?.value.modules.length - 1 -