@@ -37,7 +37,10 @@ import {
3737} from "@/components/ui/dropdown-menu" ;
3838import { ExecutionFormDialog } from "@/components/workflow/execution-form-dialog" ;
3939import { HttpIntegrationDialog } from "@/components/workflow/http-integration-dialog" ;
40- import { SetCronDialog } from "@/components/workflow/set-cron-dialog" ;
40+ import {
41+ type CronFormData ,
42+ SetCronDialog ,
43+ } from "@/components/workflow/set-cron-dialog" ;
4144import {
4245 ActionButton ,
4346 DeployButton ,
@@ -51,6 +54,7 @@ import {
5154 useDeploymentHistory ,
5255} from "@/services/deployment-service" ;
5356import {
57+ upsertCronTrigger ,
5458 useCronTrigger ,
5559 useWorkflow ,
5660 useWorkflowExecution ,
@@ -168,7 +172,7 @@ export function DeploymentDetailPage() {
168172 const [ expandedHistory , setExpandedHistory ] = useState ( false ) ;
169173 const [ isIntegrationDialogOpen , setIsIntegrationDialogOpen ] = useState ( false ) ;
170174
171- const { cronTrigger } = useCronTrigger ( workflowId ! ) ;
175+ const { cronTrigger, mutateCronTrigger } = useCronTrigger ( workflowId ! ) ;
172176
173177 const {
174178 workflow : workflowSummary ,
@@ -256,6 +260,24 @@ export function DeploymentDetailPage() {
256260 ) ;
257261 } ;
258262
263+ const handleSaveCron = async ( data : CronFormData ) => {
264+ if ( ! workflowId || ! orgHandle ) return ;
265+ try {
266+ const updatedCron = await upsertCronTrigger ( workflowId , orgHandle , {
267+ cronExpression : data . cronExpression ,
268+ active : data . active ,
269+ versionAlias : data . versionAlias ,
270+ versionNumber : data . versionNumber ,
271+ } ) ;
272+ mutateCronTrigger ( updatedCron ) ;
273+ toast . success ( "Cron schedule saved successfully." ) ;
274+ setIsIntegrationDialogOpen ( false ) ;
275+ } catch ( error ) {
276+ console . error ( "Failed to save cron schedule:" , error ) ;
277+ toast . error ( "Failed to save cron schedule. Please try again." ) ;
278+ }
279+ } ;
280+
259281 const displayDeployments = expandedHistory
260282 ? deployments || [ ]
261283 : deployments . slice ( 0 , 3 ) || [ ] ;
@@ -470,8 +492,7 @@ export function DeploymentDetailPage() {
470492 < SetCronDialog
471493 isOpen = { isIntegrationDialogOpen }
472494 onClose = { ( ) => setIsIntegrationDialogOpen ( false ) }
473- // TODO: Add submit handler
474- onSubmit = { ( ) => { } }
495+ onSubmit = { handleSaveCron }
475496 initialData = { {
476497 cronExpression : cronTrigger ?. cronExpression || "" ,
477498 active :
0 commit comments