@@ -255,14 +255,18 @@ export function NewRunForm({
255255 setShowValidation ( true ) ;
256256
257257 // Validate workflow definition (only when definitions prop is provided)
258- if (
259- ! definitionId &&
260- definitions &&
261- definitions . length > 0 &&
262- ! selectedDefinitionId
263- ) {
264- setError ( "Workflow definition is required" ) ;
265- return ;
258+ if ( ! definitionId ) {
259+ // Case 1: Definitions loaded but empty
260+ if ( definitions && definitions . length === 0 ) {
261+ setError ( "No workflow definitions available. Please create a workflow definition first." ) ;
262+ return ;
263+ }
264+
265+ // Case 2: Definitions loaded but none selected
266+ if ( definitions && definitions . length > 0 && ! selectedDefinitionId ) {
267+ setError ( "Workflow definition is required" ) ;
268+ return ;
269+ }
266270 }
267271
268272 // Check if selected workflow has a load error
@@ -386,6 +390,26 @@ export function NewRunForm({
386390 </ div >
387391 ) }
388392
393+ { /* No workflow definitions warning */ }
394+ { definitions && definitions . length === 0 && (
395+ < div className = "rounded-lg border border-amber-500 bg-amber-500/10 p-3" >
396+ < p className = "text-sm font-medium text-amber-700 dark:text-amber-400" >
397+ No Workflow Definitions Found
398+ </ p >
399+ < p className = "text-xs text-muted-foreground mt-1" >
400+ You need to create a workflow definition before creating a run.{ " " }
401+ < a
402+ href = { `${ websiteUrl } /docs/concepts/workflows/workflow-definitions` }
403+ target = "_blank"
404+ rel = "noopener noreferrer"
405+ className = "text-primary hover:underline"
406+ >
407+ Learn how to create workflow definitions
408+ </ a >
409+ </ p >
410+ </ div >
411+ ) }
412+
389413 { /* Workflow definition selection - always show */ }
390414 < div >
391415 < Label > Workflow</ Label >
@@ -400,7 +424,11 @@ export function NewRunForm({
400424 : "Loading definitions..."
401425 }
402426 searchPlaceholder = "Search definitions..."
403- emptyMessage = "No workflow definitions found"
427+ emptyMessage = {
428+ definitions && definitions . length === 0
429+ ? "No workflow definitions found. Create one first."
430+ : "No workflow definitions found"
431+ }
404432 disabled = { createWorkflow . isPending || ! definitions }
405433 renderTrigger = { ( selectedOption ) =>
406434 selectedOption ? (
@@ -976,8 +1004,7 @@ export function NewRunForm({
9761004 createWorkflow . isPending ||
9771005 ( ! definitionId &&
9781006 definitions &&
979- definitions . length > 0 &&
980- ! selectedDefinitionId ) ||
1007+ ( definitions . length === 0 || ! selectedDefinitionId ) ) ||
9811008 branchValidation . isValidating ||
9821009 branchValidation . branchExists
9831010 }
0 commit comments