mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-28 08:02:43 +00:00
fix schedules sync
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import ScheduleEditor from './ScheduleEditor.svelte'
|
||||
import { Button } from './common'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
import { ScheduleService, type Schedule } from '$lib/gen'
|
||||
import { ScheduleService } from '$lib/gen'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { Calendar } from 'lucide-svelte'
|
||||
import Skeleton from './common/skeleton/Skeleton.svelte'
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
let scheduleEditor: ScheduleEditor
|
||||
|
||||
export let schedules: Schedule[] | undefined = undefined
|
||||
export let newFlow: boolean = false
|
||||
|
||||
$: path && loadSchedule()
|
||||
@@ -42,7 +41,7 @@
|
||||
|
||||
async function loadSchedules() {
|
||||
try {
|
||||
schedules = (
|
||||
$schedules = (
|
||||
await ScheduleService.listSchedules({
|
||||
workspace: $workspaceStore ?? '',
|
||||
path,
|
||||
@@ -70,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const { primarySchedule } = getContext<FlowEditorContext>('FlowEditorContext')
|
||||
const { primarySchedule, schedules } = getContext<FlowEditorContext>('FlowEditorContext')
|
||||
</script>
|
||||
|
||||
<ScheduleEditor
|
||||
@@ -106,13 +105,13 @@
|
||||
{/if}
|
||||
|
||||
<Label label="Other schedules">
|
||||
{#if schedules}
|
||||
{#if schedules.length == 0}
|
||||
{#if $schedules}
|
||||
{#if $schedules?.length == 0 || $schedules == undefined}
|
||||
<div class="text-xs text-tertiary"> No other schedules </div>
|
||||
{:else}
|
||||
<div class="flex flex-col divide-y">
|
||||
{#each schedules as schedule (schedule.path)}
|
||||
<div class="grid grid-cols-6 text-xs items-center">
|
||||
{#each $schedules as schedule (schedule.path)}
|
||||
<div class="grid grid-cols-6 text-xs items-center py-2">
|
||||
<div class="col-span-3 truncate">{schedule.path}</div>
|
||||
<div class="col-span-2 flex flex-row gap-4 flex-nowrap">
|
||||
<div>{schedule.schedule}</div>
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
import EmailTriggerPanel from '$lib/components/details/EmailTriggerPanel.svelte'
|
||||
import RoutesPanel from '$lib/components/triggers/RoutesPanel.svelte'
|
||||
import RunPageSchedules from '$lib/components/RunPageSchedules.svelte'
|
||||
import { ScheduleService, type Schedule } from '$lib/gen'
|
||||
import { canWrite } from '$lib/utils'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { userStore } from '$lib/stores'
|
||||
import FlowCard from '../common/FlowCard.svelte'
|
||||
import { onMount, getContext } from 'svelte'
|
||||
import { getContext } from 'svelte'
|
||||
import type { FlowEditorContext } from '../types'
|
||||
let schedules: Schedule[] | undefined = undefined
|
||||
|
||||
export let noEditor: boolean
|
||||
export let newFlow = false
|
||||
@@ -20,27 +18,6 @@
|
||||
const { pathStore, selectedTrigger } = getContext<FlowEditorContext>('FlowEditorContext')
|
||||
|
||||
$: path = $pathStore
|
||||
|
||||
async function loadSchedules() {
|
||||
if (!path) return
|
||||
try {
|
||||
schedules = (
|
||||
await ScheduleService.listSchedules({
|
||||
workspace: $workspaceStore ?? '',
|
||||
path: path,
|
||||
isFlow: true
|
||||
})
|
||||
).filter((s) => s.path != path)
|
||||
} catch (e) {
|
||||
console.error('impossible to load schedules')
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!newFlow) {
|
||||
loadSchedules()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<FlowCard {noEditor} title="Flow Triggers">
|
||||
@@ -90,7 +67,6 @@
|
||||
isFlow={true}
|
||||
path={path ?? ''}
|
||||
can_write={canWrite(path, {}, $userStore)}
|
||||
bind:schedules
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user