diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/BackgroundScriptSettings.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/BackgroundScriptSettings.svelte index 8e321c5d5d..13fc581d72 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/BackgroundScriptSettings.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/BackgroundScriptSettings.svelte @@ -33,11 +33,12 @@ canConfigureRecomputeOnInputChanged={runnable.type == 'runnableByPath' || runnable.inlineScript?.language !== 'frontend'} on:updateAutoRefresh={updateAutoRefresh} - /> - + > + + {:else} Please configure the language in the inline script panel diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/ComponentScriptSettings.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/ComponentScriptSettings.svelte index cd51e26df0..ab70f0d14d 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/ComponentScriptSettings.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/ComponentScriptSettings.svelte @@ -67,8 +67,9 @@ bind:autoRefresh={appInput.autoRefresh} bind:recomputeOnInputChanged={appInput.recomputeOnInputChanged} on:updateAutoRefresh={updateAutoRefresh} - /> - + > + + {:else} Please configure the language in the inline script panel diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ComponentScriptTriggerBy.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ComponentScriptTriggerBy.svelte index c5a99d4aad..15f1aac313 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ComponentScriptTriggerBy.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ComponentScriptTriggerBy.svelte @@ -23,6 +23,7 @@ {isFrontend} {triggerEvents} {shoudlDisplayChangeEvents} + isTriggerable={isTriggerable(appComponent.type)} /> {:else} {/if} diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptRunConfiguration.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptRunConfiguration.svelte index eb4aee9c57..d7e6a165ac 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptRunConfiguration.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptRunConfiguration.svelte @@ -13,8 +13,8 @@ {#if canConfigureRecomputeOnInputChanged || canConfigureRunOnStart} - - + + {#if autoRefresh !== undefined && canConfigureRunOnStart} @@ -50,9 +50,10 @@ {/if} + {:else} - - Triggerable component runs only when an interaction happens. + + {/if} diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte index 67273c3b20..d733b7492e 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte @@ -3,7 +3,6 @@ import Alert from '$lib/components/common/alert/Alert.svelte' import { classNames } from '$lib/utils' import { Plus, X } from 'lucide-svelte' - import ScriptSettingsSection from './ScriptSettingsSection.svelte' import { Button } from '$lib/components/common' import { getContext } from 'svelte' import type { AppViewerContext, InlineScript } from '$lib/components/apps/types' @@ -14,6 +13,7 @@ export let isFrontend: boolean = false export let dependencies: string[] = [] export let shoudlDisplayChangeEvents: boolean = false + export let isTriggerable: boolean = false $: changeEvents = isFrontend ? inlineScript?.refreshOn @@ -57,73 +57,71 @@ } - - {#if isFrontend} - - { - $connectingInput = { - opened: true, - input: undefined, - hoveredComponent: undefined, - onConnect: applyConnection - } - }} - > - - +{#if isFrontend && !isTriggerable} + + { + $connectingInput = { + opened: true, + input: undefined, + hoveredComponent: undefined, + onConnect: applyConnection + } + }} + > + + - Add dependency - - + Add dependency + + + +{/if} +{#if hasNoTriggers} + + This script has no triggers. It will never run. + +{:else} + {#if triggerEvents.length > 0} + Events + + {#each triggerEvents as triggerEvent} + {triggerEvent} + {/each} {/if} - {#if hasNoTriggers} - - This script has no triggers. It will never run. - - {:else} - {#if triggerEvents.length > 0} - Events - - {#each triggerEvents as triggerEvent} - {triggerEvent} - {/each} - - {/if} - {#if changeEvents.length > 0 && shoudlDisplayChangeEvents} - Change on value - - {#each changeEvents as changeEvent} - - {changeEvent} - {#if changeEvent === 'Eval'} - - At least one input is configured as an evaluated input and the component will be - triggered if the result of the eval change. Eval expressions are re-evaluated on any - output or state changes. - - {/if} - {#if isFrontend} - { - if (inlineScript?.refreshOn) { - inlineScript.refreshOn = inlineScript.refreshOn.filter( - (x) => `${x.id} - ${x.key}` !== changeEvent - ) - inlineScript = JSON.parse(JSON.stringify(inlineScript)) - } - }} - > - - - {/if} - - {/each} - - {/if} + {#if changeEvents.length > 0 && shoudlDisplayChangeEvents} + Change on value + + {#each changeEvents as changeEvent} + + {changeEvent} + {#if changeEvent === 'Eval'} + + At least one input is configured as an evaluated input and the component will be + triggered if the result of the eval change. Eval expressions are re-evaluated on any + output or state changes. + + {/if} + {#if isFrontend} + { + if (inlineScript?.refreshOn) { + inlineScript.refreshOn = inlineScript.refreshOn.filter( + (x) => `${x.id} - ${x.key}` !== changeEvent + ) + inlineScript = JSON.parse(JSON.stringify(inlineScript)) + } + }} + > + + + {/if} + + {/each} + {/if} - +{/if}