diff --git a/backend/windmill-api/src/apps.rs b/backend/windmill-api/src/apps.rs index fedf747a75..c3164bd456 100644 --- a/backend/windmill-api/src/apps.rs +++ b/backend/windmill-api/src/apps.rs @@ -57,6 +57,7 @@ pub struct ListableApp { pub extra_perms: serde_json::Value, pub execution_mode: String, pub starred: bool, + pub edited_at: chrono::DateTime, } #[derive(FromRow, Serialize, Deserialize)] diff --git a/frontend/src/lib/components/TestJobLoader.svelte b/frontend/src/lib/components/TestJobLoader.svelte index cf23bbdef3..55e5719123 100644 --- a/frontend/src/lib/components/TestJobLoader.svelte +++ b/frontend/src/lib/components/TestJobLoader.svelte @@ -21,6 +21,8 @@ let intervalId: SetIntervalAsyncTimer | undefined = undefined let syncIteration: number = 0 + let errorIteration = 0 + let ITERATIONS_BEFORE_SLOW_REFRESH = 10 let ITERATIONS_BEFORE_SUPER_SLOW_REFRESH = 100 @@ -119,6 +121,8 @@ } export async function watchJob(testId: string) { + syncIteration = 0 + errorIteration = 0 const isCompleted = await loadTestJob(testId) if (!isCompleted) { isLoading = true @@ -161,10 +165,10 @@ } notfound = false } catch (err) { - intervalId && clearIntervalAsync(intervalId!) - clearCurrentJob() - if (err.status === 404) { + errorIteration += 1 + if (errorIteration == 5) { notfound = true + await clearCurrentJob() } console.warn(err) } diff --git a/frontend/src/lib/components/apps/components/helpers/RefreshButton.svelte b/frontend/src/lib/components/apps/components/helpers/RefreshButton.svelte index 871c367670..41b6729b8c 100644 --- a/frontend/src/lib/components/apps/components/helpers/RefreshButton.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RefreshButton.svelte @@ -1,25 +1,31 @@ - diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte index 5b3efc6ef8..2b04a2ab4d 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte @@ -14,6 +14,7 @@ import { fieldTypeToTsType, loadSchema, schemaToInputsSpec } from '../../utils' import InputValue from './InputValue.svelte' import MissingConnectionWarning from './MissingConnectionWarning.svelte' + import RefreshButton from './RefreshButton.svelte' // Component props export let id: string @@ -78,10 +79,9 @@ return areAllArgsValid } - $: isValid = argMergedArgsValid( - { ...extraQueryParams, ...runnableInputValues, ...args }, - testJobLoader - ) + $: isValid = + Object.keys(fields ?? {}).length == 0 || + argMergedArgsValid({ ...extraQueryParams, ...runnableInputValues, ...args }, testJobLoader) // Test job internal state let testJob: CompletedJob | undefined = undefined @@ -297,14 +297,18 @@ {/if} {#if !runnable && autoRefresh} - + Please select a runnable {:else if autoRefresh === true} +
+ +
+ {#if isValid} {:else} - + Please fill in all the inputs {#each Object.keys(fields ?? {}) as key} diff --git a/frontend/src/lib/components/apps/components/table/AppTable.svelte b/frontend/src/lib/components/apps/components/table/AppTable.svelte index 401cd0b4b2..1bb6d99426 100644 --- a/frontend/src/lib/components/apps/components/table/AppTable.svelte +++ b/frontend/src/lib/components/apps/components/table/AppTable.svelte @@ -26,7 +26,7 @@ $: result = [] as Array> - let search: 'Runnable' | 'Component' | 'Disabled' = 'Disabled' + let search: 'Runnable' | 'Component' | 'Disabled' | undefined = undefined let searchValue = '' let pagination: boolean | undefined = undefined @@ -114,16 +114,16 @@ {#if Array.isArray(result) && result.every(isObject)}
-
-
- - {#if search !== 'Disabled'} + {#if search !== 'Disabled'} +
+
- {/if} +
-
+ {/if} +
diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index 4865ee2276..1f48483772 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -32,10 +32,12 @@ import { grid } from 'd3-dag' import SettingsPanel from './SettingsPanel.svelte' import { fly } from 'svelte/transition' + import type { Policy } from '$lib/gen' export let app: App export let path: string export let initialMode: EditorMode = 'dnd' + export let policy: Policy const appStore = writable(app) const worldStore = writable(undefined) @@ -49,7 +51,7 @@ input: undefined }) - const runnableComponents = writable void>>({}) + const runnableComponents = writable Promise>>({}) setContext('AppEditorContext', { worldStore, @@ -88,20 +90,20 @@ {/if} {#if previewing} - + {:else} - + - +
{#if $appStore.grid} -
- +
+
{/if} {#if $connectingInput.opened} @@ -124,7 +126,7 @@ - +
diff --git a/frontend/src/lib/components/apps/editor/AppPreview.svelte b/frontend/src/lib/components/apps/editor/AppPreview.svelte index 2f5cce47c8..7529fdb91d 100644 --- a/frontend/src/lib/components/apps/editor/AppPreview.svelte +++ b/frontend/src/lib/components/apps/editor/AppPreview.svelte @@ -13,10 +13,12 @@ import GridEditor from './GridEditor.svelte' import { classNames } from '$lib/utils' + import type { Policy } from '$lib/gen' export let app: App export let appPath: string export let breakpoint: Writable + export let policy: Policy const appStore = writable(app) const worldStore = writable(undefined) @@ -29,7 +31,7 @@ input: undefined }) - const runnableComponents = writable void>>({}) + const runnableComponents = writable Promise>>({}) setContext('AppEditorContext', { worldStore, @@ -57,7 +59,7 @@
{#if $appStore.grid}
- +
{/if}
diff --git a/frontend/src/lib/components/apps/editor/ComponentHeader.svelte b/frontend/src/lib/components/apps/editor/ComponentHeader.svelte index cc666d6cce..a009bf58c3 100644 --- a/frontend/src/lib/components/apps/editor/ComponentHeader.svelte +++ b/frontend/src/lib/components/apps/editor/ComponentHeader.svelte @@ -15,7 +15,7 @@ {component.id} @@ -24,7 +24,7 @@ {#if pointerdown || selected} {/if} diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte index 03d76cf6f9..ee0bfb79f2 100644 --- a/frontend/src/lib/components/apps/editor/GridEditor.svelte +++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte @@ -5,9 +5,11 @@ import ComponentEditor from './ComponentEditor.svelte' import { classNames } from '$lib/utils' import { columnConfiguration, disableDrag, enableDrag, isFixed, toggleFixed } from '../gridUtils' - import { fly } from 'svelte/transition' import RecomputeAllComponents from './RecomputeAllComponents.svelte' + import type { Policy } from '$lib/gen' + + export let policy: Policy const { selectedComponent, @@ -104,7 +106,15 @@ on:pointerup={onpointerup} class="bg-white h-full relative" > - +
+

{$app.title}

+ +
{policy.execution_mode} mode {policy.on_behalf_of + ? `on behalf of ${policy.on_behalf_of}` + : ''}
+
- import Button from '$lib/components/common/button/Button.svelte' - import { classNames } from '$lib/utils' - import { faRefresh } from '@fortawesome/free-solid-svg-icons' + import { RefreshCw } from 'lucide-svelte' import { getContext } from 'svelte' import type { AppEditorContext } from '../types' @@ -20,12 +18,10 @@ } - + ({Object.keys($runnableComponents) + .length}) + diff --git a/frontend/src/lib/components/apps/gridUtils.ts b/frontend/src/lib/components/apps/gridUtils.ts index a707570159..1be2f74864 100644 --- a/frontend/src/lib/components/apps/gridUtils.ts +++ b/frontend/src/lib/components/apps/gridUtils.ts @@ -8,7 +8,7 @@ const Breakpoints = { } const columnConfiguration: ColumnConfiguration = [ - [Breakpoints.lg, 12], + [Breakpoints.lg, 9], [Breakpoints.sm, 3] ] diff --git a/frontend/src/lib/components/apps/types.ts b/frontend/src/lib/components/apps/types.ts index 43432064e5..116f16b80a 100644 --- a/frontend/src/lib/components/apps/types.ts +++ b/frontend/src/lib/components/apps/types.ts @@ -133,7 +133,7 @@ export type AppEditorContext = { mode: Writable connectingInput: Writable breakpoint: Writable - runnableComponents: Writable void>> + runnableComponents: Writable Promise>> appPath: string } diff --git a/frontend/src/lib/components/sidebar/SidebarContent.svelte b/frontend/src/lib/components/sidebar/SidebarContent.svelte index fccda0e19e..28007b89de 100644 --- a/frontend/src/lib/components/sidebar/SidebarContent.svelte +++ b/frontend/src/lib/components/sidebar/SidebarContent.svelte @@ -53,18 +53,18 @@
@@ -221,7 +218,6 @@ on:click={() => { isCollapsed = !isCollapsed }} - disabled={onAppEditor} > - +
{/if} diff --git a/frontend/src/routes/(root)/(logged)/apps/get/[...path]/+page.svelte b/frontend/src/routes/(root)/(logged)/apps/get/[...path]/+page.svelte index ad7a8ebe9f..8731142533 100644 --- a/frontend/src/routes/(root)/(logged)/apps/get/[...path]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/apps/get/[...path]/+page.svelte @@ -3,12 +3,9 @@ import AppPreview from '$lib/components/apps/editor/AppPreview.svelte' import type { EditorBreakpoint } from '$lib/components/apps/types' - import CenteredPage from '$lib/components/CenteredPage.svelte' import { Skeleton } from '$lib/components/common' - import Button from '$lib/components/common/button/Button.svelte' import { AppService, AppWithLastVersion } from '$lib/gen' import { workspaceStore } from '$lib/stores' - import { faPen } from '@fortawesome/free-solid-svg-icons' import { writable } from 'svelte/store' let app: AppWithLastVersion | undefined = undefined @@ -24,20 +21,10 @@ const breakpoint = writable('lg') - - - - {#if app} -
-

{app.value.title}

- - -
- -
- -
- {/if} -
+{#if app} +
+ +
+{:else} + +{/if}