fix home + refreshOnStart

This commit is contained in:
Ruben Fiszel
2023-04-10 18:02:27 +02:00
parent 3dabac153f
commit 3f5df1ee41
7 changed files with 25 additions and 10 deletions
+3 -3
View File
@@ -70,10 +70,10 @@ https://user-images.githubusercontent.com/275584/218350457-bc2fdc3b-e667-4da5-a2
3. Make it flow! You can chain your scripts or scripts made by the community
shared on [WindmillHub](https://hub.windmill.dev).
![Step 4](./imgs/windmill-flow.png)
![Step 3](./imgs/windmill-flow.png)
4. Build complex UI on top of your scripts and flows.
![Step 5](./imgs/windmill-builder.png)
![Step 4](./imgs/windmill-builder.png)
Scripts and flows can also be triggered by a cron schedule '_/5 _ \* \* \*' or
through webhooks.
@@ -123,7 +123,7 @@ instance from local commands. See
### Running scripts locally
You can run your script locally easily, you simply need to pass the right
environment variables for the `wmill` client library to fetch resource and
environment variables for the `wmill` client library to fetch resources and
variables from your instance if necessary. See more:
<https://docs.windmill.dev/docs/advanced/local_development/>
@@ -67,8 +67,6 @@
}
}
$: resolvedConfig?.triggerOnAppLoad && runnableComponent?.runComponent()
let errors: Record<string, string> = {}
$: errorsMessage = Object.values(errors)
.filter((x) => x != '')
@@ -119,6 +117,7 @@
{render}
{outputs}
{extraKey}
refreshOnStart={resolvedConfig.triggerOnAppLoad}
>
<AlignWrapper {noWFull} {horizontalAlignment} {verticalAlignment}>
{#if errorsMessage}
@@ -34,6 +34,7 @@
export let recomputeOnInputChanged: boolean = false
export let loading = false
export let recomputableByRefreshButton: boolean = true
export let refreshOnStart: boolean = false
const {
worldStore,
@@ -54,13 +55,13 @@
$runnableComponents[id] = {
autoRefresh: autoRefresh && recomputableByRefreshButton,
refreshOnStart,
cb: async (inlineScript?: InlineScript) => {
await executeComponent(true, inlineScript)
}
}
if (!$worldStore.initializedComponents.includes(id)) {
console.log('adding', id)
$worldStore.initializedComponents = [...$worldStore.initializedComponents, id]
}
@@ -40,6 +40,7 @@
export let recomputeIds: string[] = []
export let outputs: { result: Output<any>; loading: Output<boolean> }
export let extraKey: string | undefined = undefined
export let refreshOnStart: boolean = false
const { staticExporter, noBackend, componentControl, runnableComponents } =
getContext<AppViewerContext>('AppViewerContext')
@@ -101,6 +102,7 @@
<slot />
{:else if componentInput.type === 'runnable' && isRunnableDefined(componentInput)}
<RunnableComponent
{refreshOnStart}
{extraKey}
bind:loading
bind:this={runnableComponent}
@@ -39,15 +39,19 @@
}
function refresh() {
console.log('refresh')
let isFirstLoad = false
if (!firstLoad) {
$worldStore.initialized = true
firstLoad = true
isFirstLoad = true
}
loading = true
Promise.all(
Object.keys($runnableComponents).map((id) => {
if (!$runnableComponents?.[id]?.autoRefresh) {
if (
!$runnableComponents?.[id]?.autoRefresh &&
(!isFirstLoad || !$runnableComponents?.[id]?.refreshOnStart)
) {
return
}
return $runnableComponents?.[id]?.cb?.()
+8 -1
View File
@@ -138,7 +138,14 @@ export type AppViewerContext = {
connectingInput: Writable<ConnectingInput>
breakpoint: Writable<EditorBreakpoint>
runnableComponents: Writable<
Record<string, { autoRefresh: boolean; cb: (inlineScript?: InlineScript) => Promise<void> }>
Record<
string,
{
autoRefresh: boolean
refreshOnStart?: boolean
cb: (inlineScript?: InlineScript) => Promise<void>
}
>
>
staticExporter: Writable<Record<string, () => any>>
appPath: string
@@ -23,7 +23,9 @@
type Tab = 'hubscripts' | 'hubflows' | 'hubapps' | 'workspace'
let tab: Tab = (window.location.hash?.replace('#', '') as Tab | undefined) ?? 'workspace'
let tab: Tab = window.location.hash?.includes('#')
? (window.location.hash?.replace('#', '') as Tab)
: 'workspace'
let filter: string = ''
let flowViewer: Drawer