diff --git a/frontend/src/components/schedules/GeneralTab.tsx b/frontend/src/components/schedules/GeneralTab.tsx
new file mode 100644
index 00000000..9e9939cb
--- /dev/null
+++ b/frontend/src/components/schedules/GeneralTab.tsx
@@ -0,0 +1,137 @@
+import { Combobox, type ComboboxOption } from '@/components/ui/combobox'
+import { Input } from '@/components/ui/input'
+import { Label } from '@/components/ui/label'
+import { Switch } from '@/components/ui/switch'
+import { TabsContent } from '@/components/ui/tabs'
+import { Info } from 'lucide-react'
+
+type GeneralTabProps = {
+ name: string
+ onNameChange: (value: string) => void
+ description: string
+ onDescriptionChange: (value: string) => void
+ agentSlug: string
+ onAgentSlugChange: (value: string) => void
+ agentOptions: ComboboxOption[]
+ model: string
+ onModelChange: (value: string) => void
+ modelOptions: ComboboxOption[]
+ enabled: boolean
+ onEnabledChange: (value: boolean) => void
+ showRepoSelector?: boolean
+ isEditing: boolean
+ repoId?: number
+ onRepoChange?: (repoId: number | undefined) => void
+ repoOptions: ComboboxOption[]
+}
+
+function InfoHint({ text }: { text: string }) {
+ return (
+
+
+
+ )
+}
+
+export function GeneralTab({
+ name,
+ onNameChange,
+ description,
+ onDescriptionChange,
+ agentSlug,
+ onAgentSlugChange,
+ agentOptions,
+ model,
+ onModelChange,
+ modelOptions,
+ enabled,
+ onEnabledChange,
+ showRepoSelector,
+ isEditing,
+ repoId,
+ onRepoChange,
+ repoOptions,
+}: GeneralTabProps) {
+ return (
+
+
+ {showRepoSelector && !isEditing && (
+
+
+ onRepoChange?.(value ? Number(value) : undefined)}
+ options={repoOptions}
+ placeholder="Select a repository"
+ allowCustomValue={false}
+ />
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/frontend/src/components/schedules/PromptTab.tsx b/frontend/src/components/schedules/PromptTab.tsx
new file mode 100644
index 00000000..56184daa
--- /dev/null
+++ b/frontend/src/components/schedules/PromptTab.tsx
@@ -0,0 +1,126 @@
+import { Button } from '@/components/ui/button'
+import { Label } from '@/components/ui/label'
+import { TabsContent } from '@/components/ui/tabs'
+import { Textarea } from '@/components/ui/textarea'
+import { Badge } from '@/components/ui/badge'
+import { Check, Pencil, Plus, Trash2 } from 'lucide-react'
+import type { PromptTemplate } from '@opencode-manager/shared/types'
+
+type PromptTabProps = {
+ prompt: string
+ onPromptChange: (value: string) => void
+ selectedPromptTemplateId: number | null
+ onApplyTemplate: (template: PromptTemplate) => void
+ templates: PromptTemplate[]
+ onEditTemplate: (template: PromptTemplate) => void
+ onDeleteTemplate: (templateId: number) => void
+ onNewTemplate: () => void
+}
+
+export function PromptTab({
+ prompt,
+ onPromptChange,
+ selectedPromptTemplateId,
+ onApplyTemplate,
+ templates,
+ onEditTemplate,
+ onDeleteTemplate,
+ onNewTemplate,
+}: PromptTabProps) {
+ return (
+
+
+
+
+
+
+
+
+
+ {templates.map((template) => {
+ const isSelected = selectedPromptTemplateId === template.id
+
+ return (
+
+
+
+
+
+
+
+ )
+ })}
+
+
+
+
+
+
+
+ This prompt becomes the first message sent to the agent when the schedule runs.
+
+
+
+ )
+}
diff --git a/frontend/src/components/schedules/ScheduleJobDialog.tsx b/frontend/src/components/schedules/ScheduleJobDialog.tsx
index ca611dd8..979a35bc 100644
--- a/frontend/src/components/schedules/ScheduleJobDialog.tsx
+++ b/frontend/src/components/schedules/ScheduleJobDialog.tsx
@@ -7,32 +7,25 @@ import { settingsApi } from '@/api/settings'
import { listRepos } from '@/api/repos'
import type { Repo } from '@/api/types'
import { OPENCODE_API_ENDPOINT } from '@/config'
-import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
-import { Combobox, type ComboboxOption } from '@/components/ui/combobox'
+import type { ComboboxOption } from '@/components/ui/combobox'
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
-import { MultiSelect } from '@/components/ui/multi-select'
-import { Input } from '@/components/ui/input'
-import { Label } from '@/components/ui/label'
-import { Switch } from '@/components/ui/switch'
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
-import { Textarea } from '@/components/ui/textarea'
+import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
import {
buildCronExpressionFromPreset,
- cronPresetOptions,
detectSchedulePreset,
- formatDraftScheduleSummary,
getLocalTimeZone,
- intervalOptions,
- schedulePresetOptions,
type SchedulePreset,
- weekdayOptions,
} from '@/components/schedules/schedule-utils'
import { getRepoDisplayName } from '@/lib/utils'
-import { Check, Info, Loader2, Pencil, Plus, Sparkles, Trash2 } from 'lucide-react'
+import { Loader2 } from 'lucide-react'
import { usePromptTemplates, useDeletePromptTemplate } from '@/hooks/usePromptTemplates'
import { PromptTemplateDialog } from './PromptTemplateDialog'
import { DeleteDialog } from '@/components/ui/delete-dialog'
+import { GeneralTab } from './GeneralTab'
+import { TimingTab } from './TimingTab'
+import { PromptTab } from './PromptTab'
+import { SkillsTab } from './SkillsTab'
type ScheduleJobDialogProps = {
open: boolean
@@ -43,18 +36,7 @@ type ScheduleJobDialogProps = {
showRepoSelector?: boolean
repoId?: number
onRepoChange?: (repoId: number | undefined) => void
-}
-
-function InfoHint({ text }: { text: string }) {
- return (
-
-
-
- )
+ isEditing?: boolean
}
export function ScheduleJobDialog({ open, onOpenChange, job, isSaving, onSubmit, showRepoSelector, repoId: selectedRepoId, onRepoChange }: ScheduleJobDialogProps) {
@@ -291,384 +273,64 @@ export function ScheduleJobDialog({ open, onOpenChange, job, isSaving, onSubmit,
-
-
- {showRepoSelector && !job && (
-
-
- onRepoChange?.(value ? Number(value) : undefined)}
- options={repoOptions}
- placeholder="Select a repository"
- allowCustomValue={false}
- />
-
- )}
-
-
-
- setName(event.target.value)} placeholder="Nightly repo health check" />
-
+
-
-
- setDescription(event.target.value)} placeholder="What this job checks or produces" />
-
-
+
-
-
-
-
-
+
{ setEditingTemplate(template); setTemplateDialogOpen(true) }}
+ onDeleteTemplate={setDeletingTemplateId}
+ onNewTemplate={() => { setEditingTemplate(undefined); setTemplateDialogOpen(true) }}
+ />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Use a simple scheduler builder by default. Advanced cron is still available if you need it.
-
-
-
- {schedulePresetOptions.map((option) => (
-
- ))}
-
-
-
- {schedulePreset === 'interval' ? (
-
-
-
- setIntervalMinutes(event.target.value)}
- className="w-28"
- />
-
-
-
- {intervalOptions.map((option) => (
-
- ))}
-
-
- ) : schedulePreset === 'hourly' ? (
-
-
-
- setHourlyMinute(event.target.value)}
- />
-
-
Run every hour at the selected minute mark.
-
- ) : schedulePreset === 'daily' || schedulePreset === 'weekdays' ? (
-
- ) : schedulePreset === 'weekly' ? (
-
-
-
-
- {weekdayOptions.map((option) => {
- const selected = weeklyDays.includes(option.value)
-
- return (
-
- )
- })}
-
-
-
-
-
- ) : schedulePreset === 'monthly' ? (
-
- ) : (
-
-
-
-
setCronExpression(event.target.value)}
- placeholder="0 9 * * 1-5"
- className="font-mono"
- />
-
Examples: `0 9 * * 1-5` weekdays at 9 AM, `30 6 1 * *` monthly on the 1st at 6:30 AM.
-
-
-
-
- setTimezone(event.target.value)}
- placeholder="Detected from browser"
- />
-
-
-
- {cronPresetOptions.map((option) => (
-
- ))}
-
-
- )}
-
-
-
Schedule Preview
-
{formatDraftScheduleSummary({ preset: schedulePreset, intervalMinutes, timeOfDay, hourlyMinute, weeklyDays, monthlyDay, cronExpression, timezone })}
- {schedulePreset !== 'interval' && (
-
- {buildCronExpressionFromPreset({ preset: schedulePreset, intervalMinutes, timeOfDay, hourlyMinute, weeklyDays, monthlyDay, cronExpression })}
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {templates.map((template) => {
- const isSelected = selectedPromptTemplateId === template.id
-
- return (
-
-
-
-
-
-
-
- )
- })}
-
-
-
-
-
-
-
- This prompt becomes the first message sent to the agent when the schedule runs.
-
-
-
-
-
-
-
-
-
- Skills provide domain-specific instructions to the agent. Select which skills should be available when this schedule runs.
-
-
-
- {skillsLoading ? (
-
-
-
- ) : skills.length === 0 ? (
-
-
-
No skills discovered. Configure skill paths in Settings to make skills available here.
-
- ) : (
-
({ value: s.name, label: s.name, description: s.description }))}
- placeholder="Search and select skills..."
- />
- )}
-
-
-
-
-
-
+
diff --git a/frontend/src/components/schedules/SkillsTab.tsx b/frontend/src/components/schedules/SkillsTab.tsx
new file mode 100644
index 00000000..9aad3eb3
--- /dev/null
+++ b/frontend/src/components/schedules/SkillsTab.tsx
@@ -0,0 +1,65 @@
+import { Label } from '@/components/ui/label'
+import { TabsContent } from '@/components/ui/tabs'
+import { Textarea } from '@/components/ui/textarea'
+import { MultiSelect } from '@/components/ui/multi-select'
+import { Loader2, Sparkles } from 'lucide-react'
+
+type SkillsTabProps = {
+ skillSlugs: string[]
+ onSkillSlugsChange: (value: string[]) => void
+ skillNotes: string
+ onSkillNotesChange: (value: string) => void
+ skills: Array<{ name: string; description: string }>
+ skillsLoading: boolean
+}
+
+export function SkillsTab({
+ skillSlugs,
+ onSkillSlugsChange,
+ skillNotes,
+ onSkillNotesChange,
+ skills,
+ skillsLoading,
+}: SkillsTabProps) {
+ return (
+
+
+
+
+
+ Skills provide domain-specific instructions to the agent. Select which skills should be available when this schedule runs.
+
+
+
+ {skillsLoading ? (
+
+
+
+ ) : skills.length === 0 ? (
+
+
+
No skills discovered. Configure skill paths in Settings to make skills available here.
+
+ ) : (
+
({ value: s.name, label: s.name, description: s.description }))}
+ placeholder="Search and select skills..."
+ />
+ )}
+
+
+
+
+
+
+ )
+}
diff --git a/frontend/src/components/schedules/TimingTab.tsx b/frontend/src/components/schedules/TimingTab.tsx
new file mode 100644
index 00000000..741b0f09
--- /dev/null
+++ b/frontend/src/components/schedules/TimingTab.tsx
@@ -0,0 +1,229 @@
+import { Button } from '@/components/ui/button'
+import { Input } from '@/components/ui/input'
+import { Label } from '@/components/ui/label'
+import { TabsContent } from '@/components/ui/tabs'
+import {
+ buildCronExpressionFromPreset,
+ cronPresetOptions,
+ intervalOptions,
+ schedulePresetOptions,
+ weekdayOptions,
+ type SchedulePreset,
+} from '@/components/schedules/schedule-utils'
+import { formatDraftScheduleSummary, getLocalTimeZone } from '@/components/schedules/schedule-utils'
+
+type TimingTabProps = {
+ schedulePreset: SchedulePreset
+ onSchedulePresetChange: (value: SchedulePreset) => void
+ intervalMinutes: string
+ onIntervalMinutesChange: (value: string) => void
+ timeOfDay: string
+ onTimeOfDayChange: (value: string) => void
+ hourlyMinute: string
+ onHourlyMinuteChange: (value: string) => void
+ weeklyDays: string[]
+ onWeeklyDaysChange: (value: string[]) => void
+ monthlyDay: string
+ onMonthlyDayChange: (value: string) => void
+ cronExpression: string
+ onCronExpressionChange: (value: string) => void
+ timezone: string
+ onTimezoneChange: (value: string) => void
+}
+
+export function TimingTab({
+ schedulePreset,
+ onSchedulePresetChange,
+ intervalMinutes,
+ onIntervalMinutesChange,
+ timeOfDay,
+ onTimeOfDayChange,
+ hourlyMinute,
+ onHourlyMinuteChange,
+ weeklyDays,
+ onWeeklyDaysChange,
+ monthlyDay,
+ onMonthlyDayChange,
+ cronExpression,
+ onCronExpressionChange,
+ timezone,
+ onTimezoneChange,
+}: TimingTabProps) {
+ return (
+
+
+
+
+
+
Use a simple scheduler builder by default. Advanced cron is still available if you need it.
+
+
+
+ {schedulePresetOptions.map((option) => (
+
+ ))}
+
+
+
+ {schedulePreset === 'interval' ? (
+
+
+
+ onIntervalMinutesChange(event.target.value)}
+ className="w-28"
+ />
+
+
+
+ {intervalOptions.map((option) => (
+
+ ))}
+
+
+ ) : schedulePreset === 'hourly' ? (
+
+
+
+ onHourlyMinuteChange(event.target.value)}
+ />
+
+
Run every hour at the selected minute mark.
+
+ ) : schedulePreset === 'daily' || schedulePreset === 'weekdays' ? (
+
+ ) : schedulePreset === 'weekly' ? (
+
+
+
+
+ {weekdayOptions.map((option) => {
+ const selected = weeklyDays.includes(option.value)
+
+ return (
+
+ )
+ })}
+
+
+
+
+
+ ) : schedulePreset === 'monthly' ? (
+
+ ) : (
+
+
+
+
onCronExpressionChange(event.target.value)}
+ placeholder="0 9 * * 1-5"
+ className="font-mono"
+ />
+
Examples: `0 9 * * 1-5` weekdays at 9 AM, `30 6 1 * *` monthly on the 1st at 6:30 AM.
+
+
+
+
+ onTimezoneChange(event.target.value)}
+ placeholder={getLocalTimeZone()}
+ />
+
+
+
+ {cronPresetOptions.map((option) => (
+
+ ))}
+
+
+ )}
+
+
+
Schedule Preview
+
{formatDraftScheduleSummary({ preset: schedulePreset, intervalMinutes, timeOfDay, hourlyMinute, weeklyDays, monthlyDay, cronExpression, timezone })}
+ {schedulePreset !== 'interval' && (
+
+ {buildCronExpressionFromPreset({ preset: schedulePreset, intervalMinutes, timeOfDay, hourlyMinute, weeklyDays, monthlyDay, cronExpression })}
+
+ )}
+
+
+
+ )
+}
diff --git a/frontend/src/hooks/useSchedules.ts b/frontend/src/hooks/useSchedules.ts
index 10ef5241..7ff77193 100644
--- a/frontend/src/hooks/useSchedules.ts
+++ b/frontend/src/hooks/useSchedules.ts
@@ -73,17 +73,16 @@ export function useRepoScheduleRun(repoId: number | undefined, jobId: number | n
})
}
-export function useCreateRepoSchedule(repoId: number | undefined) {
+export function useCreateRepoSchedule() {
const queryClient = useQueryClient()
return useMutation({
- mutationFn: async ({ repoId: callRepoId, data }: { repoId?: number; data: CreateScheduleJobRequest }) => {
- const resolvedRepoId = callRepoId ?? repoId
- const response = await createRepoSchedule(resolvedRepoId!, data)
+ mutationFn: async ({ repoId, data }: { repoId: number; data: CreateScheduleJobRequest }) => {
+ const response = await createRepoSchedule(repoId, data)
return response.job
},
- onSuccess: (__variables) => {
- queryClient.invalidateQueries({ queryKey: ['repo-schedules', __variables.repoId ?? repoId] })
+ onSuccess: (_data, variables) => {
+ queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId] })
queryClient.invalidateQueries({ queryKey: ['all-schedules'] })
showToast.success('Schedule created')
},
@@ -93,18 +92,17 @@ export function useCreateRepoSchedule(repoId: number | undefined) {
})
}
-export function useUpdateRepoSchedule(repoId: number | undefined) {
+export function useUpdateRepoSchedule() {
const queryClient = useQueryClient()
return useMutation({
- mutationFn: async ({ repoId: callRepoId, jobId, data }: { repoId?: number; jobId: number; data: UpdateScheduleJobRequest }) => {
- const resolvedRepoId = callRepoId ?? repoId
- const response = await updateRepoSchedule(resolvedRepoId!, jobId, data)
+ mutationFn: async ({ repoId, jobId, data }: { repoId: number; jobId: number; data: UpdateScheduleJobRequest }) => {
+ const response = await updateRepoSchedule(repoId, jobId, data)
return response.job
},
onSuccess: (_data, variables) => {
- queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId ?? repoId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule', variables.repoId ?? repoId, variables.jobId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule', variables.repoId, variables.jobId] })
queryClient.invalidateQueries({ queryKey: ['all-schedules'] })
showToast.success('Schedule updated')
},
@@ -114,16 +112,15 @@ export function useUpdateRepoSchedule(repoId: number | undefined) {
})
}
-export function useDeleteRepoSchedule(repoId: number | undefined) {
+export function useDeleteRepoSchedule() {
const queryClient = useQueryClient()
return useMutation({
- mutationFn: ({ repoId: callRepoId, jobId }: { repoId?: number; jobId: number }) => {
- const resolvedRepoId = callRepoId ?? repoId
- return deleteRepoSchedule(resolvedRepoId!, jobId)
+ mutationFn: ({ repoId, jobId }: { repoId: number; jobId: number }) => {
+ return deleteRepoSchedule(repoId, jobId)
},
onSuccess: (_data, variables) => {
- queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId ?? repoId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId] })
queryClient.invalidateQueries({ queryKey: ['all-schedules'] })
showToast.success('Schedule deleted')
},
@@ -133,20 +130,19 @@ export function useDeleteRepoSchedule(repoId: number | undefined) {
})
}
-export function useRunRepoSchedule(repoId: number | undefined) {
+export function useRunRepoSchedule() {
const queryClient = useQueryClient()
return useMutation({
- mutationFn: async ({ repoId: callRepoId, jobId }: { repoId?: number; jobId: number }) => {
- const resolvedRepoId = callRepoId ?? repoId
- const response = await runRepoSchedule(resolvedRepoId!, jobId)
+ mutationFn: async ({ repoId, jobId }: { repoId: number; jobId: number }) => {
+ const response = await runRepoSchedule(repoId, jobId)
return response.run
},
onSuccess: (run, variables) => {
- queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId ?? repoId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule-runs', variables.repoId ?? repoId, run.jobId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule', variables.repoId ?? repoId, run.jobId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule-run', variables.repoId ?? repoId, run.jobId, run.id] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule-runs', variables.repoId, run.jobId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule', variables.repoId, run.jobId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule-run', variables.repoId, run.jobId, run.id] })
queryClient.invalidateQueries({ queryKey: ['all-schedules'] })
showToast.success(run.status === 'running' ? 'Schedule started' : 'Schedule run completed')
},
@@ -156,19 +152,20 @@ export function useRunRepoSchedule(repoId: number | undefined) {
})
}
-export function useCancelRepoScheduleRun(repoId: number | undefined) {
+export function useCancelRepoScheduleRun() {
const queryClient = useQueryClient()
return useMutation({
- mutationFn: async ({ jobId, runId }: { jobId: number; runId: number }) => {
- const response = await cancelRepoScheduleRun(repoId!, jobId, runId)
+ mutationFn: async ({ repoId, jobId, runId }: { repoId: number; jobId: number; runId: number }) => {
+ const response = await cancelRepoScheduleRun(repoId, jobId, runId)
return response.run
},
- onSuccess: (run) => {
- queryClient.invalidateQueries({ queryKey: ['repo-schedules', repoId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule-runs', repoId, run.jobId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule', repoId, run.jobId] })
- queryClient.invalidateQueries({ queryKey: ['repo-schedule-run', repoId, run.jobId, run.id] })
+ onSuccess: (run, variables) => {
+ queryClient.invalidateQueries({ queryKey: ['repo-schedules', variables.repoId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule-runs', variables.repoId, run.jobId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule', variables.repoId, run.jobId] })
+ queryClient.invalidateQueries({ queryKey: ['repo-schedule-run', variables.repoId, run.jobId, run.id] })
+ queryClient.invalidateQueries({ queryKey: ['all-schedules'] })
showToast.success('Schedule run cancelled')
},
onError: (error) => {
diff --git a/frontend/src/pages/GlobalSchedules.tsx b/frontend/src/pages/GlobalSchedules.tsx
index e70931ca..a491782c 100644
--- a/frontend/src/pages/GlobalSchedules.tsx
+++ b/frontend/src/pages/GlobalSchedules.tsx
@@ -33,10 +33,10 @@ export function GlobalSchedules() {
const { data: jobs = [], isLoading, error } = useAllSchedules()
- const createMutation = useCreateRepoSchedule(undefined)
- const deleteMutation = useDeleteRepoSchedule(undefined)
- const runMutation = useRunRepoSchedule(undefined)
- const updateMutation = useUpdateRepoSchedule(undefined)
+ const createMutation = useCreateRepoSchedule()
+ const deleteMutation = useDeleteRepoSchedule()
+ const runMutation = useRunRepoSchedule()
+ const updateMutation = useUpdateRepoSchedule()
const uniqueRepos = useMemo(() => {
const repoMap = new Map
()
diff --git a/frontend/src/pages/Schedules.tsx b/frontend/src/pages/Schedules.tsx
index 523192e3..60be9b05 100644
--- a/frontend/src/pages/Schedules.tsx
+++ b/frontend/src/pages/Schedules.tsx
@@ -44,11 +44,11 @@ export function Schedules() {
const { data: runs, isLoading: runsLoading } = useRepoScheduleRuns(repoId, selectedJobId, 30)
const { data: selectedRunDetails, isLoading: selectedRunLoading } = useRepoScheduleRun(repoId, selectedJobId, selectedRunId)
- const createMutation = useCreateRepoSchedule(repoId)
- const updateMutation = useUpdateRepoSchedule(repoId)
- const deleteMutation = useDeleteRepoSchedule(repoId)
- const runMutation = useRunRepoSchedule(repoId)
- const cancelRunMutation = useCancelRepoScheduleRun(repoId)
+ const createMutation = useCreateRepoSchedule()
+ const updateMutation = useUpdateRepoSchedule()
+ const deleteMutation = useDeleteRepoSchedule()
+ const runMutation = useRunRepoSchedule()
+ const cancelRunMutation = useCancelRepoScheduleRun()
useEffect(() => {
if (!jobs?.length) {
@@ -103,7 +103,7 @@ export function Schedules() {
const hasJobs = (jobs?.length ?? 0) > 0
const handleCreate = (data: CreateScheduleJobRequest) => {
- createMutation.mutate({ data }, {
+ createMutation.mutate({ repoId: repoId!, data }, {
onSuccess: (job) => {
setSelectedJobId(job.id)
setDialogOpen(false)
@@ -118,6 +118,7 @@ export function Schedules() {
}
updateMutation.mutate({
+ repoId: repoId!,
jobId: editingJob.id,
data: toUpdateScheduleRequest(data),
}, {
@@ -133,7 +134,7 @@ export function Schedules() {
return
}
- deleteMutation.mutate({ jobId: deleteJobId }, {
+ deleteMutation.mutate({ repoId: repoId!, jobId: deleteJobId }, {
onSuccess: () => {
if (selectedJobId === deleteJobId) {
setSelectedJobId(null)
@@ -149,6 +150,7 @@ export function Schedules() {
}
updateMutation.mutate({
+ repoId: repoId!,
jobId: selectedJob.id,
data: { enabled: !selectedJob.enabled },
})
@@ -159,7 +161,7 @@ export function Schedules() {
return
}
- runMutation.mutate({ jobId: selectedJob.id }, {
+ runMutation.mutate({ repoId: repoId!, jobId: selectedJob.id }, {
onSuccess: (run) => {
setSelectedRunId(run.id)
},
@@ -172,6 +174,7 @@ export function Schedules() {
}
cancelRunMutation.mutate({
+ repoId: repoId!,
jobId: activeRun.jobId,
runId: activeRun.id,
}, {