mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 08:00:59 +00:00
5d79f33590
* Remove $$props.field usage * Rename slots to ensure no hyphen * _props * _trigger * OnSelectedIteration type correct capitalization * rename _content * Remove afterUpdate * Migrate everything to svelte 5 * array bind * Fix popover * type never * nit fixes * Fixed many trivial errors * onClick * Fix errors * use let: * nit typing * fix: wrap state_referenced_locally vars with untrack() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add untrack import * Fix all syntax errors due to untrack migration * Fix undefined errors * Fix more undefined errors * untrack(() => initialOpen) * svelte-ignore * Fix state_descriptors_fixed error in Chart.svelte Use $state.snapshot() to pass plain copies of data/options to Chart.js instead of $state proxies. Chart.js's listenArrayEvents tries to define property descriptors on data arrays, which Svelte 5 proxies reject. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * nit typing * Merge issue * Fix "path is not set" error in resource picker / editor * Fix InputTransformForm error when rerunning some flows * fix npm run check --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
121 lines
2.8 KiB
Svelte
121 lines
2.8 KiB
Svelte
<script lang="ts">
|
|
import { SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER } from '$lib/consts'
|
|
import Label from './Label.svelte'
|
|
import Toggle from './Toggle.svelte'
|
|
import Tooltip from './Tooltip.svelte'
|
|
import { userStore, workerTags, workspaceStore } from '$lib/stores'
|
|
import { Button } from './common'
|
|
import { WorkerService } from '$lib/gen'
|
|
import DateTimeInput from './DateTimeInput.svelte'
|
|
|
|
|
|
interface Props {
|
|
runnable:
|
|
| {
|
|
summary?: string
|
|
description?: string
|
|
path?: string
|
|
is_template?: boolean
|
|
hash?: string
|
|
kind?: string
|
|
can_write?: boolean
|
|
created_at?: string
|
|
created_by?: string
|
|
extra_perms?: Record<string, boolean>
|
|
}
|
|
| undefined;
|
|
scheduledForStr: string | undefined;
|
|
invisible_to_owner: boolean | undefined;
|
|
overrideTag: string | undefined;
|
|
}
|
|
|
|
let {
|
|
runnable,
|
|
scheduledForStr = $bindable(),
|
|
invisible_to_owner = $bindable(),
|
|
overrideTag = $bindable()
|
|
}: Props = $props();
|
|
loadWorkerGroups()
|
|
|
|
async function loadWorkerGroups() {
|
|
if (!$workerTags) {
|
|
$workerTags = await WorkerService.getCustomTagsForWorkspace({ workspace: $workspaceStore! })
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<div class="flex flex-col gap-4 p-4">
|
|
<div class="flex flex-col gap-2">
|
|
{#if SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER}
|
|
<div class="">
|
|
<Label label="Schedule to run later" />
|
|
|
|
<div class="flex flex-row items-center my-1">
|
|
<div>
|
|
<label for="run-time"></label>
|
|
<DateTimeInput
|
|
value={scheduledForStr}
|
|
on:change={(e) => {
|
|
console.log('e.detail', e.detail)
|
|
scheduledForStr = e.detail
|
|
}}
|
|
/>
|
|
</div>
|
|
<Button
|
|
variant="default"
|
|
size="xs"
|
|
btnClasses="mx-2 "
|
|
on:click={() => {
|
|
scheduledForStr = undefined
|
|
}}
|
|
>
|
|
Clear
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
{#if !$userStore?.operator}
|
|
{#if $workerTags && $workerTags?.length > 0}
|
|
<div class="w-full">
|
|
<select
|
|
placeholder="Worker group"
|
|
bind:value={
|
|
() => overrideTag ?? '',
|
|
(v) => {
|
|
if (v == '') {
|
|
overrideTag = undefined
|
|
} else {
|
|
overrideTag = v
|
|
}
|
|
}
|
|
}
|
|
>
|
|
{#if overrideTag}
|
|
<option value="">reset to default</option>
|
|
{:else}
|
|
<option value="" disabled selected>Override Worker Group Tag</option>
|
|
{/if}
|
|
{#each $workerTags ?? [] as tag (tag)}
|
|
<option value={tag}>{tag}</option>
|
|
{/each}
|
|
</select>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
|
|
{#if runnable?.path?.startsWith(`u/${$userStore?.username}`) != true && (runnable?.path?.split('/')?.length ?? 0) > 2}
|
|
<div class="flex items-center gap-1">
|
|
<Toggle
|
|
options={{
|
|
right: `make run invisible to others`
|
|
}}
|
|
bind:checked={invisible_to_owner}
|
|
/>
|
|
<Tooltip
|
|
>By default, runs are visible to the owner(s) of the script or flow being triggered</Tooltip
|
|
>
|
|
</div>
|
|
{/if}
|
|
</div>
|