1
1
import { gql } from '@apollo/client'
2
- import { Alert , Modal } from 'antd'
2
+ import { Alert , Button , Modal } from 'antd'
3
3
import deepmerge from 'deepmerge'
4
4
import { JSONSchema7 } from 'json-schema'
5
5
import { useCallback , useMemo , useState } from 'react'
@@ -272,6 +272,9 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
272
272
return integrations
273
273
} , [ data ?. workflow ] )
274
274
275
+ const templateSchemaEmpty = ! templateSchema || isEmptyObj ( templateSchema . properties ?? { } )
276
+ const isLoading = loading || forkLoading
277
+
275
278
return (
276
279
< Modal
277
280
title = { templateSchema ? `Use template "${ workflow . name } "` : `Create a copy of "${ workflow . name } "` }
@@ -308,7 +311,7 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
308
311
/>
309
312
</ div >
310
313
) ) }
311
- { templateSchema && (
314
+ { ! templateSchemaEmpty && (
312
315
< SchemaForm
313
316
schema = { templateSchema }
314
317
initialInputs = { templateInputs ?? { } }
@@ -318,6 +321,13 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
318
321
submitButtonText = { workflow . isTemplate ? 'Use Template' : 'Fork' }
319
322
/>
320
323
) }
324
+ { ! isLoading && templateSchemaEmpty && (
325
+ < >
326
+ < Button type = "primary" key = "deploy" onClick = { ( ) => handleFork ( ) } loading = { forkLoading } >
327
+ { workflow . isTemplate ? 'Use Template' : 'Fork' }
328
+ </ Button >
329
+ </ >
330
+ ) }
321
331
</ Modal >
322
332
)
323
333
}
0 commit comments