Files
windmill/frontend/src/lib/components/SaveInputsButton.svelte
T
6186a0645d feat: edit variables, resources and triggers in their own session tab (#11206)
* feat: edit variables, resources and triggers in their own session tab

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: take a trigger's flow kind from its config and name the written trigger

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor: one operating-workspace context for editors acting on a session's workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: reload page item tabs only in sessions acting on the tool's workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: resolve open in workspace for every preview tab kind in one place

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: guard every component under a session editor against the navigation workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: show a page item tab whose item is gone instead of mounting its editor

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: follow a saved page item in the tab's own workspace and restore in-frame rows

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: close a page item tab from its editor header

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: judge trigger permissions by the user acting in the session workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: judge every session-editor permission by the user acting in that workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep session permissions reactive to the acting role and restore tabs as last seen

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: default Path's owner controls to the user acting in its workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-09-19 23:29:14 +02:00

77 lines
1.8 KiB
Svelte

<script lang="ts">
import { displayDate } from '$lib/utils.js'
import { InputService, type CreateInput, type RunnableType } from '$lib/gen/index.js'
import { Button } from '$lib/components/common'
import { Save } from 'lucide-svelte'
import { sendUserToast } from '$lib/utils.js'
import { createEventDispatcher } from 'svelte'
import Tooltip from '$lib/components/Tooltip.svelte'
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
const operatingWorkspace = useOperatingWorkspace()
const dispatch = createEventDispatcher()
interface Props {
runnableId: string | undefined
runnableType: RunnableType | undefined
args: object
disabled?: boolean
small?: boolean | undefined
showTooltip?: boolean | undefined
workspace?: string | undefined
}
let {
runnableId,
runnableType,
args,
disabled = false,
small = undefined,
showTooltip = undefined,
workspace = undefined
}: Props = $props()
let ws = $derived(workspace ?? $operatingWorkspace)
let savingInputs = $state(false)
async function saveInput(args: object) {
savingInputs = true
const requestBody: CreateInput = {
name: 'Saved ' + displayDate(new Date()),
args: args as any
}
try {
await InputService.createInput({
workspace: ws!,
runnableId,
runnableType,
requestBody
})
} catch (err) {
console.error(err)
sendUserToast(`Failed to save Input: ${err}`, true)
}
savingInputs = false
dispatch('update')
}
</script>
<Button
on:click={() => saveInput(args)}
{disabled}
loading={savingInputs}
startIcon={{ icon: Save }}
variant={small ? 'subtle' : 'default'}
unifiedSize="sm"
>
<span>{small ? 'Save inputs' : 'Save current input'}</span>
{#if showTooltip}
<Tooltip>Shared inputs are available to anyone with access to the script</Tooltip>
{/if}
</Button>