diff --git a/frontend/src/lib/components/FlowMetadata.svelte b/frontend/src/lib/components/FlowMetadata.svelte
index 34ba78acf5..747a5da817 100644
--- a/frontend/src/lib/components/FlowMetadata.svelte
+++ b/frontend/src/lib/components/FlowMetadata.svelte
@@ -11,11 +11,15 @@
faUser,
faBarsStaggered
} from '@fortawesome/free-solid-svg-icons'
+ import ScheduleEditor from './ScheduleEditor.svelte'
export let job: Job
const SMALL_ICON_SCALE = 0.7
+ let scheduleEditor: ScheduleEditor
+
@@ -46,9 +50,10 @@
{:else if job && job.schedule_path}
Triggered by the schedule: {job.schedule_path} Triggered by the schedule: scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')}
+ >{job.schedule_path}
{/if}
diff --git a/frontend/src/lib/components/Path.svelte b/frontend/src/lib/components/Path.svelte
index 2859bc541c..a584106f90 100644
--- a/frontend/src/lib/components/Path.svelte
+++ b/frontend/src/lib/components/Path.svelte
@@ -10,7 +10,6 @@
} from '$lib/gen'
import { GroupService } from '$lib/gen'
import { superadmin, userStore, workspaceStore } from '$lib/stores'
- import { sleep } from '$lib/utils'
import { createEventDispatcher } from 'svelte'
import Required from './Required.svelte'
import { Button, Drawer, DrawerContent } from './common'
@@ -28,6 +27,7 @@
export let path = ''
export let error = ''
export let disabled = false
+ export let checkInitialPathExistence = false
export let kind: PathKind
@@ -105,7 +105,10 @@
clearTimeout(validateTimeout)
}
validateTimeout = setTimeout(async () => {
- if ((path == '' || path != initialPath) && (await pathExists(path, kind))) {
+ if (
+ (path == '' || checkInitialPathExistence || path != initialPath) &&
+ (await pathExists(path, kind))
+ ) {
error = 'path already used'
} else if (meta && validateName(meta)) {
error = ''
diff --git a/frontend/src/lib/components/RadioButton.svelte b/frontend/src/lib/components/RadioButton.svelte
index ba75f9e078..646e163443 100644
--- a/frontend/src/lib/components/RadioButton.svelte
+++ b/frontend/src/lib/components/RadioButton.svelte
@@ -2,6 +2,7 @@
export let label = ''
export let options: [string | { title: string; desc: string }, any][]
export let value: any
+ export let disabled = false
import { createEventDispatcher } from 'svelte'
import Tooltip from './Tooltip.svelte'
@@ -19,6 +20,7 @@
{val === value ? '!bg-blue-50 !border-blue-500' : ''}"
>
+ export function load() {
+ return {
+ stuff: { title: 'New Schedule' }
+ }
+ }
+
+
+
+
+
+
+
+ {#if edit}
+
+ {
+ await ScheduleService.setScheduleEnabled({
+ path: initialPath,
+ workspace: $workspaceStore ?? '',
+ requestBody: { enabled: e.detail }
+ })
+ sendUserToast(`${e.detail ? 'enabled' : 'disabled'} schedule ${initialPath}`)
+ }}
+ />
+
+ {/if}
+
+ {edit ? 'Save' : 'Schedule'}
+
+
+
+ {#if !edit}
+
Path
+
+
+ {/if}
+
+
+ Schedule
+ Schedules use CRON syntax. Seconds are mandatory.
+
+
+
+
Runnable
+ {#if !edit}
+
+ Pick a script or flow to be triggered by the schedule
+
+
+ {:else}
+
+ Once a schedule is created, the runnable path cannot be changed. However, when renaming a
+ script or a flow, the runnable path will automatically update itself.
+
+
+
+ {/if}
+
+
Arguments
+
+ {#if runnable}
+ {#if runnable?.schema && runnable.schema.properties && Object.keys(runnable.schema.properties).length > 0}
+
+ {:else}
+
+ This {is_flow ? 'flow' : 'script'} takes no argument
+
+ {/if}
+ {:else}
+
+ Pick a {is_flow ? 'flow' : 'script'} and fill its argument here
+
+ {/if}
+
+
+
+
diff --git a/frontend/src/lib/components/ScriptPicker.svelte b/frontend/src/lib/components/ScriptPicker.svelte
index d1c5aa1442..6f469a81d4 100644
--- a/frontend/src/lib/components/ScriptPicker.svelte
+++ b/frontend/src/lib/components/ScriptPicker.svelte
@@ -10,6 +10,7 @@
import RadioButton from './RadioButton.svelte'
import { Button, Drawer, DrawerContent } from './common'
import HighlightCode from './HighlightCode.svelte'
+ import FlowPathViewer from './flows/content/FlowPathViewer.svelte'
export let initialPath: string | undefined = undefined
export let scriptPath: string | undefined = undefined
@@ -17,9 +18,11 @@
export let allowHub = false
export let itemKind: 'hub' | 'script' | 'flow' = allowHub ? 'hub' : 'script'
export let kind: Script.kind = Script.kind.SCRIPT
+ export let disabled = false
let items: { value: string; label: string }[] = []
let drawerViewer: Drawer
+ let drawerFlowViewer: Drawer
let code: string = ''
let lang: 'deno' | 'python3' | 'go' | 'bash' | undefined
@@ -53,41 +56,64 @@
$: itemKind && $workspaceStore && loadItems()
-
- {#if options.length > 1}
-
-
-
- {/if}
-
-
x.value == initialPath)}
- class="grow"
- on:change={() => {
- dispatch('select', { path: scriptPath })
- }}
- bind:justValue={scriptPath}
- {items}
- placeholder="Pick a {itemKind}"
- />
- {#if scriptPath !== undefined && scriptPath !== ''}
- {
- const { language, content } = await getScriptByPath(scriptPath ?? '')
- code = content
- lang = language
- drawerViewer.openDrawer()
- }}
- >
- Show code
-
- {/if}
-
-
-
+
+
+
+
+
+
+
+
+
+ {#if options.length > 1}
+
+
+
+ {/if}
+
+ {#if disabled}
+
+ {:else}
+
x.value == initialPath)}
+ class="grow"
+ on:change={() => {
+ dispatch('select', { path: scriptPath })
+ }}
+ bind:justValue={scriptPath}
+ {items}
+ placeholder="Pick a {itemKind}"
+ />
+ {/if}
+
+ {#if scriptPath !== undefined && scriptPath !== ''}
+ {#if itemKind == 'flow'}
+ {
+ drawerFlowViewer.openDrawer()
+ }}
+ >
+ Show flow
+
+ {:else}
+ {
+ const { language, content } = await getScriptByPath(scriptPath ?? '')
+ code = content
+ lang = language
+ drawerViewer.openDrawer()
+ }}
+ >
+ Show code
+
+ {/if}
+ {/if}
+
diff --git a/frontend/src/lib/components/VariableEditor.svelte b/frontend/src/lib/components/VariableEditor.svelte
index 1dab82b6ce..2b8769a136 100644
--- a/frontend/src/lib/components/VariableEditor.svelte
+++ b/frontend/src/lib/components/VariableEditor.svelte
@@ -141,7 +141,7 @@
>
{/if}
-
General
+
Path
+
{#if variable.is_secret}
Every secret is encrypted at rest and in transit with a key specific to this
diff --git a/frontend/src/lib/components/common/table/FlowRow.svelte b/frontend/src/lib/components/common/table/FlowRow.svelte
index 3f37a29317..5ac87a9386 100644
--- a/frontend/src/lib/components/common/table/FlowRow.svelte
+++ b/frontend/src/lib/components/common/table/FlowRow.svelte
@@ -1,5 +1,7 @@
+ goto('/schedules')} bind:this={scheduleEditor} />
{
+ scheduleEditor.openNew(true, path)
+ }
},
{
displayName: 'Share',
diff --git a/frontend/src/lib/components/common/table/ScriptRow.svelte b/frontend/src/lib/components/common/table/ScriptRow.svelte
index 9d02f27f09..d685b59a35 100644
--- a/frontend/src/lib/components/common/table/ScriptRow.svelte
+++ b/frontend/src/lib/components/common/table/ScriptRow.svelte
@@ -1,5 +1,7 @@
+ goto('/schedules')} bind:this={scheduleEditor} />
+
{
+ scheduleEditor.openNew(false, path)
+ }
},
{
displayName: 'Share',
diff --git a/frontend/src/lib/components/jobs/JobDetail.svelte b/frontend/src/lib/components/jobs/JobDetail.svelte
index 498eb1415b..dbdfeaaf56 100644
--- a/frontend/src/lib/components/jobs/JobDetail.svelte
+++ b/frontend/src/lib/components/jobs/JobDetail.svelte
@@ -25,12 +25,16 @@
import Icon from 'svelte-awesome'
import { check } from 'svelte-awesome/icons'
import { Badge } from '../common'
+ import ScheduleEditor from '../ScheduleEditor.svelte'
const SMALL_ICON_SCALE = 0.7
export let job: Job
+ let scheduleEditor: ScheduleEditor
+ goto('/schedules')} bind:this={scheduleEditor} />
+
@@ -159,9 +163,11 @@
{:else if job && job.schedule_path}
Triggered by the schedule: {job.schedule_path} Triggered by the schedule:
+ scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')}
+ >{job.schedule_path}
{/if}
diff --git a/frontend/src/routes/flows/get/[...path].svelte b/frontend/src/routes/flows/get/[...path].svelte
index fb63fc039d..18b12905f1 100644
--- a/frontend/src/routes/flows/get/[...path].svelte
+++ b/frontend/src/routes/flows/get/[...path].svelte
@@ -43,6 +43,7 @@
import Icon from 'svelte-awesome'
import RunForm from '$lib/components/RunForm.svelte'
import { goto } from '$app/navigation'
+ import ScheduleEditor from '$lib/components/ScheduleEditor.svelte'
let userSettings: UserSettings
@@ -115,8 +116,11 @@
})
await goto('/run/' + run + '?workspace=' + $workspaceStore)
}
+ let scheduleEditor: ScheduleEditor
+
loadSchedule()} bind:this={scheduleEditor} />
+
scheduleEditor?.openNew(true, flow?.path ?? '')}
variant="border"
color="light"
size="xs"
@@ -305,7 +309,7 @@
}
}}
/>
- scheduleEditor?.openEdit(flow?.path ?? '', true)}
>Edit schedule
diff --git a/frontend/src/routes/schedule/add.svelte b/frontend/src/routes/schedule/add.svelte
deleted file mode 100644
index 28e3d3b6e4..0000000000
--- a/frontend/src/routes/schedule/add.svelte
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
-
-
-
- {edit ? 'Save' : 'Schedule'}
-
-
-
-
- {#if !edit}
-
Save schedule as
-
-
- {/if}
-
-
Runnable
- {#if !edit}
-
- Pick a script or flow to be triggered by the schedule
-
-
- {:else}
-
- Once a schedule is created, the runnable path cannot be changed. However, when renaming a
- script or a flow, the runnable path will automatically update itself. To edit the runnable
- path, you can always delete the schedule and create a new on.
-
-
-
{itemKind}
-
- View runs
-
-
- {/if}
-
-
Arguments
- {#if runnable}
- {#if runnable?.schema && runnable.schema.properties && Object.keys(runnable.schema.properties).length > 0}
-
- {:else}
-
- This {is_flow ? 'flow' : 'script'} takes no argument
-
- {/if}
- {:else}
-
- Pick a {is_flow ? 'flow' : 'script'} and fill its argument here
-
- {/if}
-
-
- Schedule
- Schedules use CRON syntax. Seconds are mandatory.
-
-
- {#if edit}
-
Enable
-
{
- await ScheduleService.setScheduleEnabled({
- path: initialPath,
- workspace: $workspaceStore ?? '',
- requestBody: { enabled: e.detail }
- })
- sendUserToast(`${e.detail ? 'enabled' : 'disabled'} schedule ${initialPath}`)
- }}
- />
- {/if}
-
-
diff --git a/frontend/src/routes/schedules.svelte b/frontend/src/routes/schedules.svelte
index 76562a4fa2..3c92036120 100644
--- a/frontend/src/routes/schedules.svelte
+++ b/frontend/src/routes/schedules.svelte
@@ -13,7 +13,6 @@
import PageHeader from '$lib/components/PageHeader.svelte'
import TableCustom from '$lib/components/TableCustom.svelte'
import Dropdown from '$lib/components/Dropdown.svelte'
- import { goto } from '$app/navigation'
import ShareModal from '$lib/components/ShareModal.svelte'
import SharedBadge from '$lib/components/SharedBadge.svelte'
import {
@@ -31,6 +30,7 @@
import { Badge, Button, Skeleton } from '$lib/components/common'
import Popover from '$lib/components/Popover.svelte'
import { Icon } from 'svelte-awesome'
+ import ScheduleEditor from '$lib/components/ScheduleEditor.svelte'
type ScheduleW = Schedule & { canWrite: boolean }
@@ -64,11 +64,15 @@
loadSchedules()
}
}
+ let scheduleEditor: ScheduleEditor
+
- New schedule
+ scheduleEditor.openNew(false)}
+ >New schedule
{#if loading}
@@ -92,8 +96,9 @@
{#each schedules as { path, error, edited_by, edited_at, schedule, offset_, enabled, script_path, is_flow, extra_perms, canWrite }}
{path} scheduleEditor?.openEdit(path, is_flow)}>{path}
@@ -176,7 +181,7 @@
icon: faEdit,
disabled: !canWrite,
action: () => {
- goto(`/schedule/add?edit=${path}&isFlow=${is_flow}`)
+ scheduleEditor?.openEdit(path, is_flow)
}
},
{
diff --git a/frontend/src/routes/scripts/get/[...hash].svelte b/frontend/src/routes/scripts/get/[...hash].svelte
index 5209bd933d..d994d289fa 100644
--- a/frontend/src/routes/scripts/get/[...hash].svelte
+++ b/frontend/src/routes/scripts/get/[...hash].svelte
@@ -36,7 +36,6 @@
import ShareModal from '$lib/components/ShareModal.svelte'
import { superadmin, userStore, workspaceStore } from '$lib/stores'
import SharedBadge from '$lib/components/SharedBadge.svelte'
- import SvelteMarkdown from 'svelte-markdown'
import SchemaViewer from '$lib/components/SchemaViewer.svelte'
import CenteredPage from '$lib/components/CenteredPage.svelte'
import { onDestroy } from 'svelte'
@@ -57,6 +56,7 @@
import RunForm from '$lib/components/RunForm.svelte'
import { goto } from '$app/navigation'
import Popover from '$lib/components/Popover.svelte'
+ import ScheduleEditor from '$lib/components/ScheduleEditor.svelte'
let userSettings: UserSettings
let script: Script | undefined
@@ -163,8 +163,11 @@
sendUserToast(`Could not create job: ${err.body}`, true)
}
}
+ let scheduleEditor: ScheduleEditor
+
+
{#if script}
@@ -279,7 +282,7 @@
Share
scheduleEditor?.openNew(false, script?.path ?? '')}
variant="border"
color="light"
size="xs"