diff --git a/src/lib/components/workflow/client-actions/batch-cancel-confirmation-modal.svelte b/src/lib/components/workflow/client-actions/batch-cancel-confirmation-modal.svelte index f6da3432d4..94fd633298 100644 --- a/src/lib/components/workflow/client-actions/batch-cancel-confirmation-modal.svelte +++ b/src/lib/components/workflow/client-actions/batch-cancel-confirmation-modal.svelte @@ -20,15 +20,20 @@ import BatchOperationConfirmationModalBody from './batch-operation-confirmation-form.svelte'; - export let namespace: string; - export let open: boolean; + interface Props { + namespace: string; + open: boolean; + } + + let { namespace, open = $bindable() }: Props = $props(); + const identity = getIdentity(); const reason = writable(''); const reasonPlaceholder = getPlaceholder(Action.Cancel, identity); const jobId = writable(''); const jobIdValid = writable(true); - let jobIdPlaceholder = crypto.randomUUID(); - let error = ''; + let jobIdPlaceholder = $state(crypto.randomUUID()); + let error = $state(''); const { allSelected, cancelableWorkflows } = getContext(BATCH_OPERATION_CONTEXT); @@ -40,7 +45,9 @@ jobIdPlaceholder = crypto.randomUUID(); }; - $: if (open) resetForm(); + $effect(() => { + if (open) resetForm(); + }); const cancelWorkflows = async () => { error = ''; @@ -61,9 +68,10 @@ id: 'batch-cancel-success-toast', }); } catch (err) { - error = isNetworkError(err) - ? err.message - : translate('common.unknown-error'); + error = + isNetworkError(err) && err.message + ? err.message + : translate('common.unknown-error'); } }; diff --git a/src/lib/components/workflow/client-actions/batch-operation-confirmation-form.svelte b/src/lib/components/workflow/client-actions/batch-operation-confirmation-form.svelte index ab63ba89d8..1a532d3e03 100644 --- a/src/lib/components/workflow/client-actions/batch-operation-confirmation-form.svelte +++ b/src/lib/components/workflow/client-actions/batch-operation-confirmation-form.svelte @@ -1,7 +1,7 @@ @@ -119,5 +137,5 @@ on:input={handleJobIdChange} valid={jobIdValid} /> - + {@render children?.()} diff --git a/src/lib/components/workflow/client-actions/batch-reset-confirmation-modal.svelte b/src/lib/components/workflow/client-actions/batch-reset-confirmation-modal.svelte index 3f34c251d8..ab1b74ced7 100644 --- a/src/lib/components/workflow/client-actions/batch-reset-confirmation-modal.svelte +++ b/src/lib/components/workflow/client-actions/batch-reset-confirmation-modal.svelte @@ -22,11 +22,16 @@ import BatchOperationConfirmationForm from './batch-operation-confirmation-form.svelte'; - export let namespace: string; - export let open = false; - let error = ''; - let jobIdPlaceholder = crypto.randomUUID(); - let resetType = writable<'first' | 'last'>('first'); + interface Props { + namespace: string; + open?: boolean; + } + + let { namespace, open = $bindable(false) }: Props = $props(); + + let error = $state(''); + let jobIdPlaceholder = $state(crypto.randomUUID()); + const resetType = writable<'first' | 'last'>('first'); const identity = getIdentity(); const reason = writable(''); const reasonPlaceholder = getPlaceholder(Action.Reset, identity); @@ -44,7 +49,9 @@ jobIdPlaceholder = crypto.randomUUID(); }; - $: if (open) resetForm(); + $effect(() => { + if (open) resetForm(); + }); const resetWorkflows = async () => { error = ''; @@ -67,9 +74,10 @@ id: 'batch-reset-success-toast', }); } catch (err) { - error = isNetworkError(err) - ? err.message - : translate('common.unknown-error'); + error = + isNetworkError(err) && err.message + ? err.message + : translate('common.unknown-error'); } }; @@ -97,7 +105,7 @@ > (BATCH_OPERATION_CONTEXT); @@ -40,7 +45,9 @@ jobIdPlaceholder = crypto.randomUUID(); }; - $: if (open) resetForm(); + $effect(() => { + if (open) resetForm(); + }); const terminateWorkflows = async () => { error = ''; @@ -61,9 +68,10 @@ id: 'batch-terminate-success-toast', }); } catch (err) { - error = isNetworkError(err) - ? err.message - : translate('common.unknown-error'); + error = + isNetworkError(err) && err.message + ? err.message + : translate('common.unknown-error'); } }; diff --git a/src/lib/components/workflow/client-actions/cancel-confirmation-modal.svelte b/src/lib/components/workflow/client-actions/cancel-confirmation-modal.svelte index 41cd1ffe26..59ea31d3ef 100644 --- a/src/lib/components/workflow/client-actions/cancel-confirmation-modal.svelte +++ b/src/lib/components/workflow/client-actions/cancel-confirmation-modal.svelte @@ -11,13 +11,22 @@ import { getIdentity } from '$lib/utilities/core-context'; import { isNetworkError } from '$lib/utilities/is-network-error'; - export let open: boolean; - export let workflow: WorkflowExecution; - export let namespace: string; - export let refresh: Writable | undefined = undefined; + interface Props { + open: boolean; + workflow: WorkflowExecution; + namespace: string; + refresh?: Writable; + } - let loading: boolean; - let error: string = ''; + let { + open = $bindable(), + workflow, + namespace, + refresh = undefined, + }: Props = $props(); + + let loading = $state(false); + let error = $state(''); const identity = getIdentity(); @@ -45,9 +54,10 @@ message: translate('workflows.cancel-success'), }); } catch (err: unknown) { - error = isNetworkError(err) - ? err.message - : translate('common.unknown-error'); + error = + isNetworkError(err) && err.message + ? err.message + : translate('common.unknown-error'); } finally { loading = false; } diff --git a/src/lib/components/workflow/client-actions/reset-confirmation-modal.svelte b/src/lib/components/workflow/client-actions/reset-confirmation-modal.svelte index 65b749d10b..3ee003e249 100644 --- a/src/lib/components/workflow/client-actions/reset-confirmation-modal.svelte +++ b/src/lib/components/workflow/client-actions/reset-confirmation-modal.svelte @@ -19,17 +19,21 @@ import { isNetworkError } from '$lib/utilities/is-network-error'; import { minimumVersionRequired } from '$lib/utilities/version-check'; - export let open: boolean; - export let workflow: WorkflowExecution; - export let namespace: string; + interface Props { + open: boolean; + workflow: WorkflowExecution; + namespace: string; + } - let error = ''; - let loading = false; + let { open = $bindable(), workflow, namespace }: Props = $props(); + + let error = $state(''); + let loading = $state(false); let eventId: Writable = writable(''); - let reason: string; - let includeSignals = true; - let excludeSignals = false; - let excludeUpdates = false; + let reason = $state(''); + let includeSignals = $state(true); + let excludeSignals = $state(false); + let excludeUpdates = $state(false); const identity = getIdentity(); diff --git a/src/lib/components/workflow/client-actions/signal-confirmation-modal.svelte b/src/lib/components/workflow/client-actions/signal-confirmation-modal.svelte index 88f7fc39e7..d85d05b1e2 100644 --- a/src/lib/components/workflow/client-actions/signal-confirmation-modal.svelte +++ b/src/lib/components/workflow/client-actions/signal-confirmation-modal.svelte @@ -16,23 +16,27 @@ import { getIdentity } from '$lib/utilities/core-context'; import { isNetworkError } from '$lib/utilities/is-network-error'; - export let open: boolean; - export let workflow: WorkflowExecution; - export let namespace: string; + interface Props { + open: boolean; + workflow: WorkflowExecution; + namespace: string; + } - $: ({ metadata } = $workflowRun); - $: signalDefinitions = metadata?.definition?.signalDefinitions; + let { open = $bindable(), workflow, namespace }: Props = $props(); + + const metadata = $derived($workflowRun.metadata); + const signalDefinitions = $derived(metadata?.definition?.signalDefinitions); const defaultEncoding: PayloadInputEncoding = 'json/plain'; - let error: string = ''; - let loading = false; - let name = ''; - let customSignal = false; + let error = $state(''); + let loading = $state(false); + let name = $state(''); + let customSignal = $state(false); - let input = ''; - let encoding: Writable = writable(defaultEncoding); - let messageType = ''; + let input = $state(''); + const encoding: Writable = writable(defaultEncoding); + let messageType = $state(''); const identity = getIdentity(); @@ -65,9 +69,10 @@ }); hideSignalModal(); } catch (err) { - error = isNetworkError(err) - ? err.message - : translate('common.unknown-error'); + error = + isNetworkError(err) && err.message + ? err.message + : translate('common.unknown-error'); } finally { loading = false; } @@ -87,13 +92,13 @@ {loading} confirmText={translate('common.submit')} cancelText={translate('common.cancel')} - confirmDisabled={!name || !encoding} + confirmDisabled={!name || !$encoding} on:cancelModal={hideSignalModal} on:confirmModal={signal} >

{translate('workflows.signal-modal-title')}

- {#if signalDefinitions?.length > 0 && !customSignal} + {#if signalDefinitions && signalDefinitions.length > 0 && !customSignal}