11import { gql } from '@apollo/client'
2- import { Alert , Modal } from 'antd'
2+ import { Alert , Button , Modal } from 'antd'
33import deepmerge from 'deepmerge'
44import { JSONSchema7 } from 'json-schema'
55import { useCallback , useMemo , useState } from 'react'
@@ -272,6 +272,9 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
272272 return integrations
273273 } , [ data ?. workflow ] )
274274
275+ const templateSchemaEmpty = ! templateSchema || isEmptyObj ( templateSchema . properties ?? { } )
276+ const isLoading = loading || forkLoading
277+
275278 return (
276279 < Modal
277280 title = { templateSchema ? `Use template "${ workflow . name } "` : `Create a copy of "${ workflow . name } "` }
@@ -308,7 +311,7 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
308311 />
309312 </ div >
310313 ) ) }
311- { templateSchema && (
314+ { ! templateSchemaEmpty && (
312315 < SchemaForm
313316 schema = { templateSchema }
314317 initialInputs = { templateInputs ?? { } }
@@ -318,6 +321,13 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
318321 submitButtonText = { workflow . isTemplate ? 'Use Template' : 'Fork' }
319322 />
320323 ) }
324+ { ! isLoading && templateSchemaEmpty && (
325+ < >
326+ < Button type = "primary" key = "deploy" onClick = { ( ) => handleFork ( ) } loading = { forkLoading } >
327+ { workflow . isTemplate ? 'Use Template' : 'Fork' }
328+ </ Button >
329+ </ >
330+ ) }
321331 </ Modal >
322332 )
323333}
0 commit comments