mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
* runs on svelte 5 * Line component from svelte-chartjs * Replaced all svelte-chartjs occurrences with custom wrapper * Fix props mistake * Fix illegal table structures * self-closing-tags fix * aria labels * Fixed trivial warnings and errors * @tanstack/svelte-table fix * upgrade to vite 6 * svelte-kit sync before running svelte-check * Remove on:clear which is actually on:removeAll and already handled by on:change * fix worker tags not displaying in Autoscaling * Try to fix svelte-kit sync not working during CI * remove warnings * Fix add flow page crashing * access worldStore before assignment fix * fix infinite recursions in App Editor * Replaced JSON.stringify with proper deepEqual * component mount api changed (no longer classes) * fix ci errors * Fix infinite loops in background runnable panel * factored effect on deep equal logic in onObjChange * fix "Add" not working in AgGrid Table * Replaced legacy component.$set api * Fix multiselect infinite value reaction * Fix flow input fields resetting when opening their edit tab * fix date input resetting when typing year * Remove !p-0 affecting subgrid dotted borders * fix missing debounceTemplate causing hundreds of updates * Fix AgGrid action refreshes and disppearing * resolve getItems generating random ids every rerun * fix cannot access items before init * fix sort lambda arguments being undefined * Revert "Remove !p-0 affecting subgrid dotted borders" This reverts commit c62809bb45d682a48376b071680645ed4e1c601b. * fix input not updating in decision tree editor * Update frontend/src/lib/components/schema/EditableSchemaWrapper.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Re-added padding affecting subgrid dotted borders (#5479) * remove !p-0 in preset components * removed extra padding on accordion tabs subgrid * Fix non-reactive SchemaForm * dirty fix for the oneOf bug * Fix warnings and update svelte-exmarkdown for svelte 5 * fix dnd not working * don't mount component like objects --------- Co-authored-by: Diego Imbert <diegoimbert@protonmail.com> Co-authored-by: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
85 lines
2.0 KiB
Svelte
85 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import { WorkspaceService } from '$lib/gen'
|
|
import { createEventDispatcher } from 'svelte'
|
|
import { workspaceStore } from '$lib/stores'
|
|
import { Button } from './common'
|
|
import Drawer from './common/drawer/Drawer.svelte'
|
|
import DrawerContent from './common/drawer/DrawerContent.svelte'
|
|
import { sendUserToast } from '$lib/toast'
|
|
import Section from './Section.svelte'
|
|
import { Save } from 'lucide-svelte'
|
|
import autosize from '$lib/autosize'
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
let edit: boolean = false
|
|
let name: string = ''
|
|
let value: string = ''
|
|
|
|
export function initNew(): void {
|
|
edit = false
|
|
name = ''
|
|
value = ''
|
|
drawer.openDrawer()
|
|
}
|
|
|
|
export function editVariable(editName: string, editValue: string): void {
|
|
edit = true
|
|
name = editName
|
|
value = editValue
|
|
drawer.openDrawer()
|
|
}
|
|
|
|
let drawer: Drawer
|
|
|
|
async function updateVariable(): Promise<void> {
|
|
await WorkspaceService.setEnvironmentVariable({
|
|
workspace: $workspaceStore!,
|
|
requestBody: {
|
|
value: value,
|
|
name: name
|
|
}
|
|
})
|
|
sendUserToast(
|
|
`${
|
|
edit ? 'Updated' : 'Created'
|
|
} contextual variable ${name}. It may take up to a few minutes to update.`
|
|
)
|
|
dispatch('update')
|
|
|
|
drawer.closeDrawer()
|
|
setTimeout(() => {
|
|
dispatch('update')
|
|
}, 5000)
|
|
}
|
|
</script>
|
|
|
|
<Drawer bind:this={drawer} size="900px">
|
|
<DrawerContent
|
|
title={edit ? `Update contextual variable ${name}` : 'Create a contextual variable'}
|
|
on:close={drawer.closeDrawer}
|
|
>
|
|
<div class="flex flex-col gap-8">
|
|
{#if !edit}
|
|
<Section label="Name">
|
|
<input type="text" bind:value={name} placeholder="Variable name" />
|
|
</Section>
|
|
{/if}
|
|
<Section label="Value">
|
|
<textarea rows="4" use:autosize bind:value placeholder="Variable value"></textarea>
|
|
</Section>
|
|
</div>
|
|
<svelte:fragment slot="actions">
|
|
<Button
|
|
on:click={() => updateVariable()}
|
|
disabled={value === '' || name === ''}
|
|
startIcon={{ icon: Save }}
|
|
color="dark"
|
|
size="sm"
|
|
>
|
|
{edit ? 'Update' : 'Save'}
|
|
</Button>
|
|
</svelte:fragment>
|
|
</DrawerContent>
|
|
</Drawer>
|