diff --git a/frontend/src/lib/components/Path.svelte b/frontend/src/lib/components/Path.svelte index eb58a35fd5..db9b58f20e 100644 --- a/frontend/src/lib/components/Path.svelte +++ b/frontend/src/lib/components/Path.svelte @@ -39,6 +39,7 @@ export let disabled = false export let checkInitialPathExistence = false export let autofocus = true + export let dirty = false export let kind: PathKind let inputP: HTMLInputElement | undefined = undefined @@ -69,6 +70,7 @@ } function handleKeyUp(event: KeyboardEvent) { + setDirty() const key = event.key if (key === 'Enter') { @@ -250,6 +252,10 @@ meta.owner = newFolderName } } + + function setDirty() { + !dirty && (dirty = true) + } @@ -296,6 +302,7 @@ class="mt-0.5" bind:selected={meta.ownerKind} on:selected={(e) => { + setDirty() const kind = e.detail if (meta) { if (kind === 'folder') { @@ -338,6 +345,7 @@ bind:value={meta.owner} placeholder={$userStore?.username ?? ''} disabled={disabled || !($superadmin || ($userStore?.is_admin ?? false))} + on:keydown={setDirty} /> {:else if meta.ownerKind === 'folder'} diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte index 85ca3996d0..e5cf3a942d 100644 --- a/frontend/src/lib/components/ScriptBuilder.svelte +++ b/frontend/src/lib/components/ScriptBuilder.svelte @@ -264,6 +264,7 @@ } let path: Path | undefined = undefined + let dirtyPath = false @@ -279,7 +280,7 @@ bind:value={script.summary} placeholder="Short summary to be displayed when listed" on:keyup={() => { - if (initialPath == '' && script.summary?.length > 0) { + if (initialPath == '' && script.summary?.length > 0 && !dirtyPath) { path?.setName( script.summary .toLowerCase() @@ -295,6 +296,7 @@ bind:this={path} bind:error={pathError} bind:path={script.path} + bind:dirty={dirtyPath} {initialPath} autofocus={false} namePlaceholder="script" diff --git a/frontend/src/lib/components/flows/content/FlowSettings.svelte b/frontend/src/lib/components/flows/content/FlowSettings.svelte index 0863168f3c..5fed564b41 100644 --- a/frontend/src/lib/components/flows/content/FlowSettings.svelte +++ b/frontend/src/lib/components/flows/content/FlowSettings.svelte @@ -40,6 +40,7 @@ } let path: Path | undefined = undefined + let dirtyPath = false
@@ -65,7 +66,7 @@ placeholder="Short summary to be displayed when listed" id="flow-summary" on:keyup={() => { - if (initialPath == '' && $flowStore.summary?.length > 0) { + if (initialPath == '' && $flowStore.summary?.length > 0 && !dirtyPath) { path?.setName( $flowStore.summary .toLowerCase() @@ -82,6 +83,7 @@