schedule error handlers in ee

This commit is contained in:
Ruben Fiszel
2024-01-12 11:25:44 +01:00
parent 5eb3703a64
commit 016cccb27d
3 changed files with 20 additions and 22 deletions
@@ -26,7 +26,6 @@
export let slackToggleText: string = 'enable'
export let showScriptHelpText: boolean = false
export let handlerSelected: 'custom' | 'slack'
export let handlersOnlyForEe: string[]
export let handlerPath: string | undefined
export let handlerExtraArgs: Record<string, any>
@@ -186,26 +185,18 @@
<div>
<Tabs bind:selected={handlerSelected} class="mt-2 mb-4">
{#if $enterpriseLicense}
<Tab value="slack">Slack</Tab>
<Tab value="custom">
Custom
<slot name="custom-tab-tooltip" />
</Tab>
{:else}
<Tab value="custom">
Custom
<slot name="custom-tab-tooltip" />
</Tab>
<Tab value="slack">Slack {handlersOnlyForEe.includes('slack') ? '(ee only)' : ''}</Tab>
{/if}
<Tab value="slack">Slack</Tab>
<Tab value="custom">
Custom
<slot name="custom-tab-tooltip" />
</Tab>
</Tabs>
</div>
{#if handlerSelected === 'custom'}
<div class="flex flex-row mb-2">
<ScriptPicker
disabled={!isEditable}
disabled={!isEditable || !$enterpriseLicense}
initialPath={customInitialScriptPath}
kinds={[Script.kind.SCRIPT, Script.kind.FAILURE]}
allowFlow={true}
@@ -541,8 +541,14 @@
<Tab value="retries">Retries</Tab>
{/if}
</Tabs>
<div class="pt-0.5" />
{#if optionTabSelected === 'error_handler'}
<Section label="Error handler">
<svelte:fragment slot="header">
<div class="flex flex-row gap-2">
{#if !$enterpriseLicense}<span class="text-normal text-2xs">(ee only)</span>{/if}
</div>
</svelte:fragment>
<svelte:fragment slot="action">
<div class="flex flex-row items-center gap-2">
<Dropdown
@@ -567,7 +573,7 @@
</svelte:fragment>
<div class="flex flex-row">
<Toggle
disabled={!can_write}
disabled={!can_write || !$enterpriseLicense}
bind:checked={wsErrorHandlerMuted}
options={{ right: 'Mute workspace error handler for this schedule' }}
/>
@@ -575,7 +581,6 @@
<ErrorOrRecoveryHandler
isEditable={can_write}
errorOrRecovery="error"
handlersOnlyForEe={['slack']}
showScriptHelpText={true}
bind:handlerSelected={errorHandlerSelected}
bind:handlerPath={errorHandlerPath}
@@ -610,8 +615,7 @@
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-center mt-4 font-semibold text-sm gap-2">
<p class={emptyString(errorHandlerPath) ? 'text-tertiary' : ''}
>{#if !$enterpriseLicense}<span class="text-normal text-2xs">(ee only)</span>{/if}
<p class={emptyString(errorHandlerPath) ? 'text-tertiary' : ''}>
Triggered when schedule failed</p
>
<select
@@ -668,7 +672,6 @@
<ErrorOrRecoveryHandler
isEditable={can_write && !emptyString($enterpriseLicense)}
errorOrRecovery="recovery"
handlersOnlyForEe={[]}
bind:handlerSelected={recoveryHandlerSelected}
bind:handlerPath={recoveryHandlerPath}
customInitialScriptPath={recoveryHandlerCustomInitialPath}
@@ -728,6 +731,9 @@
{:else if optionTabSelected === 'retries'}
<Section label="Retries">
<svelte:fragment slot="header">
<div class="flex flex-row gap-2">
{#if !$enterpriseLicense}<span class="text-normal text-2xs">(ee only)</span>{/if}
</div>
<Tooltip>
If defined, upon error this schedule will be retried with a delay and a maximum
number of attempts as defined below.
@@ -3,6 +3,7 @@
import { SecondsInput } from '$lib/components/common'
import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte'
import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte'
import { enterpriseLicense } from '$lib/stores'
export let flowModuleRetry: Retry | undefined
export let disabled: boolean = false
@@ -66,8 +67,8 @@
}}
>
<ToggleButton light value="disabled" label="Disabled" />
<ToggleButton light value="constant" label="Constant" />
<ToggleButton light value="exponential" label="Exponential" />
<ToggleButton disabled={!$enterpriseLicense} light value="constant" label="Constant" />
<ToggleButton disabled={!$enterpriseLicense} light value="exponential" label="Exponential" />
</ToggleButtonGroup>
<div class="flex h-[calc(100%-22px)]">
<div class="w-1/2 h-full overflow-auto pr-2">