mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-04 00:03:02 +00:00
feat(frontend): triggers
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
let scheduleEditor: ScheduleEditor
|
||||
|
||||
let schedule: Schedule | false | undefined = undefined
|
||||
let schedules: Schedule[] | undefined = undefined
|
||||
export let schedules: Schedule[] | undefined = undefined
|
||||
|
||||
$: path && loadSchedule()
|
||||
$: path && loadSchedules()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
triggerDetail: (e: { detail: 'webhook' | 'mail' | 'schedule' }) => void
|
||||
isEditor: boolean
|
||||
newFlow: boolean
|
||||
extra_perms: Record<string, any>
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
export let count: number | undefined = undefined
|
||||
</script>
|
||||
|
||||
<div class="absolute -right-2 -top-2">
|
||||
<div class="bg-blue-500 rounded-full h-4 w-4 p-1 flex center-center text-white text-2xs">
|
||||
{#if count === undefined}
|
||||
<Loader2 class="animate-spin text-2xs" />
|
||||
{:else}
|
||||
{count}
|
||||
{/if}
|
||||
{#if count && count > 0}
|
||||
<div class="absolute -right-2 -top-2">
|
||||
<div class="bg-blue-500 rounded-full h-4 w-4 p-1 flex center-center text-white text-2xs">
|
||||
{#if count === undefined}
|
||||
<Loader2 class="animate-spin text-2xs" />
|
||||
{:else}
|
||||
{count}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import { Route } from 'lucide-svelte'
|
||||
import { canWrite } from '$lib/utils'
|
||||
import RoutesPanel from '$lib/components/triggers/RoutesPanel.svelte'
|
||||
import RunPageSchedules from '$lib/components/RunPageSchedules.svelte'
|
||||
|
||||
let schedules: Schedule[] | undefined = undefined
|
||||
let triggers: (HttpTrigger & { canWrite: boolean })[] | undefined = undefined
|
||||
@@ -59,7 +60,7 @@
|
||||
loadTriggers()
|
||||
|
||||
let drawer: Drawer | undefined = undefined
|
||||
let selectedTab: 'webhooks' | 'mail' | 'routes' = 'webhooks'
|
||||
let selectedTab: 'webhooks' | 'mail' | 'routes' | 'schedules' = 'webhooks'
|
||||
</script>
|
||||
|
||||
{#if !newFlow}
|
||||
@@ -70,6 +71,7 @@
|
||||
<Tab value="webhooks">Webhooks</Tab>
|
||||
<Tab value="mail">Mail</Tab>
|
||||
<Tab value="routes">Routes</Tab>
|
||||
<Tab value="schedules">Schedules</Tab>
|
||||
|
||||
<svelte:fragment slot="content">
|
||||
{#if selectedTab === 'webhooks'}
|
||||
@@ -89,6 +91,15 @@
|
||||
{#if selectedTab === 'routes'}
|
||||
<RoutesPanel path={path ?? ''} isFlow={true} bind:triggers />
|
||||
{/if}
|
||||
|
||||
{#if selectedTab === 'schedules'}
|
||||
<RunPageSchedules
|
||||
isFlow={true}
|
||||
path={path ?? ''}
|
||||
can_write={canWrite(path, {}, $userStore)}
|
||||
bind:schedules
|
||||
/>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
</DrawerContent>
|
||||
@@ -159,7 +170,8 @@
|
||||
<TriggerButton
|
||||
on:click={() => {
|
||||
if (isEditor) {
|
||||
dispatch('openSchedules')
|
||||
selectedTab = 'schedules'
|
||||
drawer?.openDrawer()
|
||||
} else {
|
||||
dispatch('triggerDetail', 'schedule')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user