diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte
index 008a6497ad..a1acf8e681 100644
--- a/frontend/src/lib/components/apps/editor/AppEditor.svelte
+++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte
@@ -30,10 +30,10 @@
import ItemPicker from '$lib/components/ItemPicker.svelte'
import VariableEditor from '$lib/components/VariableEditor.svelte'
- import { VariableService, type Job, type Policy } from '$lib/gen'
+ import { VariableService, type Policy } from '$lib/gen'
import { initHistory } from '$lib/history'
import { Component, Minus, Paintbrush, Plus, Smartphone, Scan, Hand, Grab } from 'lucide-svelte'
- import { findGridItem, findGridItemParentGrid } from './appUtils'
+ import { animateTo, findGridItem, findGridItemParentGrid } from './appUtils'
import ComponentNavigation from './component/ComponentNavigation.svelte'
import CssSettings from './componentsPanel/CssSettings.svelte'
import SettingsPanel from './SettingsPanel.svelte'
@@ -49,7 +49,6 @@
import { getTheme } from './componentsPanel/themeUtils'
import StylePanel from './settingsPanel/StylePanel.svelte'
import type DiffDrawer from '$lib/components/DiffDrawer.svelte'
- import RunnableJobPanel from './RunnableJobPanel.svelte'
import HideButton from './settingsPanel/HideButton.svelte'
import AppEditorBottomPanel from './AppEditorBottomPanel.svelte'
import panzoom from 'panzoom'
@@ -386,27 +385,6 @@
}
}
- function animateTo(start: number, end: number, onUpdate: (newValue: number) => void) {
- const duration = 400
- const startTime = performance.now()
-
- function animate(time: number) {
- const elapsed = time - startTime
- const progress = Math.min(elapsed / duration, 1)
- const currentValue = start + (end - start) * easeInOut(progress)
- onUpdate(currentValue)
- if (progress < 1) {
- requestAnimationFrame(animate)
- }
- }
-
- requestAnimationFrame(animate)
- }
-
- function easeInOut(t: number) {
- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t
- }
-
$: $cssEditorOpen && selectCss()
function selectCss() {
@@ -583,13 +561,11 @@
} else {
leftPanelSize = storedLeftPanelSize
}
- storedLeftPanelSize = 0
}
function showRightPanel() {
rightPanelSize = storedRightPanelSize
centerPanelSize = centerPanelSize - storedRightPanelSize
- storedRightPanelSize = 0
}
function showBottomPanel(animate: boolean = false) {
@@ -611,7 +587,6 @@
runnablePanelSize = storedBottomPanelSize
gridPanelSize = gridPanelSize - storedBottomPanelSize
}
- storedBottomPanelSize = 0
}
function keydown(event: KeyboardEvent) {
@@ -705,9 +680,6 @@
$: $connectingInput.opened, updatePannelInConnecting()
- let testJob: Job | undefined = undefined
- let jobToWatch: { componentId: string; job: string } | undefined = undefined
-
$: updateCursorStyle(!!$connectingInput.opened && !$panzoomActive)
function updateCursorStyle(disabled: boolean) {
@@ -1125,14 +1097,7 @@
{rightPanelSize}
{centerPanelWidth}
{runnablePanelSize}
- >
-
-
+ />
{/if}
diff --git a/frontend/src/lib/components/apps/editor/AppEditorBottomPanel.svelte b/frontend/src/lib/components/apps/editor/AppEditorBottomPanel.svelte
index be46d46c81..5839a3e9be 100644
--- a/frontend/src/lib/components/apps/editor/AppEditorBottomPanel.svelte
+++ b/frontend/src/lib/components/apps/editor/AppEditorBottomPanel.svelte
@@ -1,5 +1,4 @@
-
-
-
-
-
-
- {#if !$selectedComponentInEditor}
-
- Select a script on the left panel
-
- {:else if gridItem}
- {#key gridItem?.id}
-
+
+
+
+
+ {#if !$selectedComponentInEditor}
+
+ Select a script on the left panel
+
+ {:else if gridItem}
+ {#key gridItem?.id}
+ {
+ createScriptFromInlineScript(gridItem?.id ?? 'unknown', e.detail)
+ }}
+ bind:gridItem
+ />
+ {/key}
+ {:else if unusedInlineScript > -1 && $app.unusedInlineScripts?.[unusedInlineScript]}
+ {#key unusedInlineScript}
+
+ sendUserToast('Cannot save to workspace unused scripts', true)}
+ id={`unused-${unusedInlineScript}`}
+ bind:name={$app.unusedInlineScripts[unusedInlineScript].name}
+ bind:inlineScript={$app.unusedInlineScripts[unusedInlineScript].inlineScript}
+ on:delete={() => {
+ // remove the script from the array at the index
+ $app.unusedInlineScripts.splice(unusedInlineScript, 1)
+ $app.unusedInlineScripts = [...$app.unusedInlineScripts]
+ }}
+ />
+ {/key}
+ {:else if hiddenInlineScript > -1}
+ {#key hiddenInlineScript}
+ {#if $app.hiddenInlineScripts?.[hiddenInlineScript]}
+ {
- createScriptFromInlineScript(gridItem?.id ?? 'unknown', e.detail)
+ createScriptFromInlineScript(BG_PREFIX + hiddenInlineScript, e.detail)
}}
- bind:gridItem
- />
- {/key}
- {:else if unusedInlineScript > -1 && $app.unusedInlineScripts?.[unusedInlineScript]}
- {#key unusedInlineScript}
-
- sendUserToast('Cannot save to workspace unused scripts', true)}
- id={`unused-${unusedInlineScript}`}
- bind:name={$app.unusedInlineScripts[unusedInlineScript].name}
- bind:inlineScript={$app.unusedInlineScripts[unusedInlineScript].inlineScript}
- on:delete={() => {
- // remove the script from the array at the index
- $app.unusedInlineScripts.splice(unusedInlineScript, 1)
- $app.unusedInlineScripts = [...$app.unusedInlineScripts]
- }}
- />
- {/key}
- {:else if hiddenInlineScript > -1}
- {#key hiddenInlineScript}
- {#if $app.hiddenInlineScripts?.[hiddenInlineScript]}
- {
- createScriptFromInlineScript(BG_PREFIX + hiddenInlineScript, e.detail)
- }}
- transformer={$selectedComponentInEditor?.endsWith('_transformer')}
- on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
- id={BG_PREFIX + hiddenInlineScript}
- bind:runnable={$app.hiddenInlineScripts[hiddenInlineScript]}
- />{/if}{/key}
- {:else}
-
- No script found at id {$selectedComponentInEditor}
-
- {/if}
-
-
-
+ transformer={$selectedComponentInEditor?.endsWith('_transformer')}
+ on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
+ id={BG_PREFIX + hiddenInlineScript}
+ bind:runnable={$app.hiddenInlineScripts[hiddenInlineScript]}
+ />{/if}{/key}
+ {:else}
+
+ No script found at id {$selectedComponentInEditor}
+
+ {/if}
+
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte
index 6870811eeb..cec3bb6df4 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte
@@ -18,13 +18,18 @@
export let defaultUserInput = false
export let hideCreateScript = false
export let onlyFlow = false
-
- let tab: Tab = onlyFlow ? 'workspaceflows' : 'inlinescripts'
- let filter: string = ''
- let picker: Drawer
+ export let rawApps = false
const { app, workspace } = getContext('AppViewerContext')
+ let tab: Tab = onlyFlow
+ ? 'workspaceflows'
+ : $app?.unusedInlineScripts?.length > 0
+ ? 'inlinescripts'
+ : 'workspacescripts'
+ let filter: string = ''
+ let picker: Drawer
+
const dispatch = createEventDispatcher<{
pick: {
runnable: Runnable
@@ -138,15 +143,17 @@
{#if !onlyFlow}
-
-
-
- Detached Inline Scripts
-
-
+ {#if !rawApps}
+
+
+
+ Detached Inline Scripts
+
+
+ {/if}
-
+
Workspace Scripts