diff --git a/frontend/CaddyfileRemote b/frontend/CaddyfileRemote index 8879353951..fceb5be316 100644 --- a/frontend/CaddyfileRemote +++ b/frontend/CaddyfileRemote @@ -1,7 +1,3 @@ -{ - auto_https off -} - http://localhost { bind {$ADDRESS} reverse_proxy /api/* https://app.windmill.dev { diff --git a/frontend/src/lib/components/Editor.svelte b/frontend/src/lib/components/Editor.svelte index 2714936103..226f4509a1 100644 --- a/frontend/src/lib/components/Editor.svelte +++ b/frontend/src/lib/components/Editor.svelte @@ -143,7 +143,7 @@ } } - function format() { + export function format() { if (editor) { code = getCode() editor.getAction('editor.action.formatDocument').run() diff --git a/frontend/src/lib/components/EditorBar.svelte b/frontend/src/lib/components/EditorBar.svelte index 96d1a340f2..9675add119 100644 --- a/frontend/src/lib/components/EditorBar.svelte +++ b/frontend/src/lib/components/EditorBar.svelte @@ -7,6 +7,7 @@ import { getScriptByPath, sendUserToast } from '$lib/utils' import { + faBroom, faCube, faDollarSign, faEye, @@ -307,6 +308,20 @@ +
+
diff --git a/frontend/src/lib/components/SimpleEditor.svelte b/frontend/src/lib/components/SimpleEditor.svelte index 8e1af88a60..df142b4551 100644 --- a/frontend/src/lib/components/SimpleEditor.svelte +++ b/frontend/src/lib/components/SimpleEditor.svelte @@ -130,6 +130,15 @@ }, 200) }) + editor.onDidFocusEditorText(() => { + dispatch('focus') + + editor.addCommand(KeyMod.CtrlCmd | KeyCode.KeyS, function () { + code = getCode() + shouldBindKey && format && format() + }) + }) + if (autoHeight) { let ignoreEvent = false const updateHeight = () => { diff --git a/frontend/src/lib/components/apps/components/dataDisplay/AppScatterChart.svelte b/frontend/src/lib/components/apps/components/dataDisplay/AppScatterChart.svelte index d4bb7e09da..d21784a0ee 100644 --- a/frontend/src/lib/components/apps/components/dataDisplay/AppScatterChart.svelte +++ b/frontend/src/lib/components/apps/components/dataDisplay/AppScatterChart.svelte @@ -16,11 +16,15 @@ import RunnableWrapper from '../helpers/RunnableWrapper.svelte' import type { AppInput } from '../../inputType' import Scatter from 'svelte-chartjs/Scatter.svelte' + import InputValue from '../helpers/InputValue.svelte' export let id: string export let componentInput: AppInput | undefined export let configuration: Record + let zoomable = false + let pannable = false + export const staticOutputs: string[] = ['loading', 'result'] ChartJS.register( @@ -35,28 +39,26 @@ zoomPlugin ) - const zoomOptions = { - pan: { - enabled: true - }, - zoom: { - drag: { - enabled: false - }, - wheel: { - enabled: true - } - } - } - let result: { data: { x: any[]; y: string[] } } | undefined = undefined - const options = { + $: options = { responsive: true, animation: false, maintainAspectRatio: false, plugins: { - zoom: zoomOptions + zoom: { + pan: { + enabled: pannable + }, + zoom: { + drag: { + enabled: false + }, + wheel: { + enabled: zoomable + } + } + } } } @@ -65,6 +67,9 @@ } + + + {#if result} diff --git a/frontend/src/lib/components/apps/components/dataDisplay/AppTimeseries.svelte b/frontend/src/lib/components/apps/components/dataDisplay/AppTimeseries.svelte index b253b6d68a..39a8db5a48 100644 --- a/frontend/src/lib/components/apps/components/dataDisplay/AppTimeseries.svelte +++ b/frontend/src/lib/components/apps/components/dataDisplay/AppTimeseries.svelte @@ -28,6 +28,8 @@ export const staticOutputs: string[] = ['loading', 'result'] let logarithmicScale = false + let zoomable = false + let pannable = false ChartJS.register( Title, @@ -43,20 +45,6 @@ LogarithmicScale ) - const zoomOptions = { - pan: { - enabled: true - }, - zoom: { - drag: { - enabled: false - }, - wheel: { - enabled: true - } - } - } - let result: { data: { x: any[]; y: string[] } } | undefined = undefined $: options = { @@ -64,7 +52,19 @@ animation: false, maintainAspectRatio: false, plugins: { - zoom: zoomOptions + zoom: { + pan: { + enabled: pannable + }, + zoom: { + drag: { + enabled: false + }, + wheel: { + enabled: zoomable + } + } + } }, scales: { x: { @@ -82,6 +82,8 @@ + + {#if result} diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte index 8355c933c3..f55c439027 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte @@ -22,7 +22,7 @@ export let result: any = undefined export let forceSchemaDisplay: boolean = false - const { worldStore, runnableComponents, workspace, appPath, isEditor } = + const { worldStore, runnableComponents, workspace, appPath, isEditor, jobs } = getContext('AppEditorContext') onMount(() => { @@ -180,7 +180,7 @@ outputs?.loading?.set(true) - await testJobLoader?.abstractRun(() => { + let njob = await testJobLoader?.abstractRun(() => { const nonStaticRunnableInputs = {} const staticRunnableInputs = {} Object.keys(fields ?? {}).forEach((k) => { @@ -220,6 +220,9 @@ requestBody }) }) + if (njob) { + $jobs = [...$jobs, { job: njob, component: id }] + } } export async function runComponent() { diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index 9a51b71df1..efa67aefb4 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -68,7 +68,8 @@ appPath: path, workspace: $workspaceStore ?? '', onchange: () => saveDraft(), - isEditor: true + isEditor: true, + jobs: writable([]) }) let timeout: NodeJS.Timeout | undefined = undefined @@ -120,7 +121,7 @@ {#if previewing} import { goto } from '$app/navigation' import { page } from '$app/stores' - import { Alert, Drawer, DrawerContent } from '$lib/components/common' + import { Alert, Badge, Drawer, DrawerContent } from '$lib/components/common' import Button from '$lib/components/common/button/Button.svelte' import { dirtyStore } from '$lib/components/common/confirmationModal/dirtyStore' + import Skeleton from '$lib/components/common/skeleton/Skeleton.svelte' import ToggleButton from '$lib/components/common/toggleButton/ToggleButton.svelte' import ToggleButtonGroup from '$lib/components/common/toggleButton/ToggleButtonGroup.svelte' + import DisplayResult from '$lib/components/DisplayResult.svelte' + import FlowJobResult from '$lib/components/FlowJobResult.svelte' + import FlowProgressBar from '$lib/components/flows/FlowProgressBar.svelte' + import FlowStatusViewer from '$lib/components/FlowStatusViewer.svelte' + import JobArgs from '$lib/components/JobArgs.svelte' + import LogViewer from '$lib/components/LogViewer.svelte' import Path from '$lib/components/Path.svelte' + import SplitPanesWrapper from '$lib/components/splitPanes/SplitPanesWrapper.svelte' + import TestJobLoader from '$lib/components/TestJobLoader.svelte' import Toggle from '$lib/components/Toggle.svelte' import Tooltip from '$lib/components/Tooltip.svelte' - import { AppService, Policy } from '$lib/gen' + import { AppService, Job, Policy } from '$lib/gen' import { userStore, workspaceStore } from '$lib/stores' - import { faClipboard, faExternalLink, faSave } from '@fortawesome/free-solid-svg-icons' + import { faBug, faClipboard, faExternalLink, faSave } from '@fortawesome/free-solid-svg-icons' import { AlignHorizontalSpaceAround, Expand, Eye, Laptop2, + Loader2, Pencil, Smartphone } from 'lucide-svelte' import { getContext } from 'svelte' import { Icon } from 'svelte-awesome' - import { copyToClipboard, sendUserToast } from '../../../utils' + import { Pane, Splitpanes } from 'svelte-splitpanes' + import { classNames, copyToClipboard, sendUserToast } from '../../../utils' import type { AppComponent, AppEditorContext } from '../types' import AppExportButton from './AppExportButton.svelte' + import PanelSection from './settingsPanel/common/PanelSection.svelte' async function hash(message) { const msgUint8 = new TextEncoder().encode(message) // encode as (utf-8) Uint8Array @@ -36,7 +48,7 @@ export let policy: Policy - const { app, summary, mode, breakpoint, appPath } = + const { app, summary, mode, breakpoint, appPath, jobs } = getContext('AppEditorContext') const loading = { publish: false, @@ -47,6 +59,7 @@ let pathError: string | undefined = undefined let saveDrawerOpen = false + let jobsDrawerOpen = false let publishDrawerOpen = false function closeSaveDrawer() { @@ -144,8 +157,17 @@ loading.save = false sendUserToast('App saved') } + + let selectedJobId: string | undefined = undefined + let testJobLoader: TestJobLoader + let job: Job | undefined = undefined + let testIsLoading = false + + $: selectedJobId && testJobLoader?.watchJob(selectedJobId) + + closeSaveDrawer()}> + + (jobsDrawerOpen = false)}> + + + +
+ {#if $jobs.length > 0} +
+ {#each $jobs ?? [] as { job, component } (job)} + +
(selectedJobId = job)} + > + {job} + {component} +
+ {/each} +
+ {:else} +
No items
+ {/if} +
+
+
+ +
+ {#if selectedJobId} + {#if !job} + + {:else} +
+ {#if job?.['running']} +
+
+ {/if} +
+ +
+ {#if job?.job_kind !== 'flow' && job?.job_kind !== 'flowpreview'} + + + + + + {#if job != undefined && 'result' in job && job.result != undefined} +
+ {:else if testIsLoading} +
+ {/if} +
+
+ {:else} +
+ +
+ { + job = detail + }} + /> +
+ {/if} +
+ {/if} + {:else} +
Select a job to see its details
+ {/if} +
+ + + + + (publishDrawerOpen = false)}> {#if appPath == ''} @@ -267,6 +374,15 @@
+ diff --git a/frontend/src/lib/components/apps/editor/AppPreview.svelte b/frontend/src/lib/components/apps/editor/AppPreview.svelte index cb608b7847..d524763c57 100644 --- a/frontend/src/lib/components/apps/editor/AppPreview.svelte +++ b/frontend/src/lib/components/apps/editor/AppPreview.svelte @@ -52,7 +52,8 @@ appPath, workspace, onchange: undefined, - isEditor + isEditor, + jobs: writable([]) }) let mounted = false diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte index 5a89e47154..9cf45a3536 100644 --- a/frontend/src/lib/components/apps/editor/GridEditor.svelte +++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte @@ -127,7 +127,6 @@ rowHeight={36} cols={columnConfiguration} fastStart={true} - on:pointerup={({ detail }) => selectComponent(detail.id)} gap={[4, 2]} > {#each $lazyGrid as gridComponent (gridComponent.id)} @@ -148,11 +147,14 @@ > {/if}
{ + selectComponent(dataItem.data.id) + }} class={classNames( 'h-full w-full flex justify-center align-center items-center', gridComponent.data.card ? 'border border-gray-100' : '' )} - on:click|preventDefault|capture|once + on:click|preventDefault|capture|once|stopPropagation > import { classNames } from '$lib/utils' import { getContext } from 'svelte' + import { key } from 'svelte-awesome/icons' import type { AppEditorContext } from '../../types' import { displayData } from '../../utils' import PanelSection from '../settingsPanel/common/PanelSection.svelte' @@ -85,16 +86,19 @@ $connectingInput.hoveredComponent === componentId ? 'outline outline-blue-500' : '' )} > - - { - connectInput(componentId, detail) - }} - /> + {#key $selectedComponent} + {#key $connectingInput?.opened} + { + connectInput(componentId, detail) + }} + /> + {/key} + {/key}
{/if} diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte index f2f83f690f..9067459edd 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte @@ -73,6 +73,16 @@ {/if} + {#if id.startsWith('unused-')} {/if} diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte index b4c6dd0e71..0489d350d5 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte @@ -135,7 +135,7 @@ declare const ${k} = ${JSON.stringify(v)};
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte index 6daeaaa1bc..8cd3d0c350 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte @@ -10,6 +10,8 @@ StaticAppInput, UserAppInput } from '../../inputType' + import { getContext } from 'svelte' + import type { AppEditorContext } from '../../types' export let inputSpecs: Record< string, @@ -19,6 +21,8 @@ export let staticOnly: boolean = false export let shouldCapitalize: boolean = true export let rowColumns = false + + const { connectingInput } = getContext('AppEditorContext') {#if inputSpecs} @@ -27,7 +31,7 @@ {@const input = inputSpecs[inputSpecKey]}
- + {shouldCapitalize ? capitalize(inputSpecKey) : inputSpecKey} @@ -39,7 +43,19 @@ {#if !inputSpecs[inputSpecKey].onlyStatic} - + { + console.log(inputSpecs[inputSpecKey]) + if (e.detail == 'connected' && !inputSpecs[inputSpecKey]['connection']) { + $connectingInput = { + opened: true, + input: undefined, + hoveredComponent: undefined + } + } + }} + > {/if} +
Status Connected
@@ -56,7 +56,7 @@ Disconnect {:else} -
+
Status Not connected
diff --git a/frontend/src/lib/components/apps/types.ts b/frontend/src/lib/components/apps/types.ts index 3ef9787276..358d7a1da5 100644 --- a/frontend/src/lib/components/apps/types.ts +++ b/frontend/src/lib/components/apps/types.ts @@ -145,7 +145,8 @@ export type AppEditorContext = { appPath: string, workspace: string, onchange: (() => void) | undefined, - isEditor: boolean + isEditor: boolean, + jobs: Writable<{ job: string, component: string }[]> } export type EditorMode = 'dnd' | 'preview'