Skip to content

Commit fd00376

Browse files
committed
fix: forking templates without schema
1 parent 0b93005 commit fd00376

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

components/workflows/ForkWorkflowModal.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { gql } from '@apollo/client'
2-
import { Alert, Modal } from 'antd'
2+
import { Alert, Button, Modal } from 'antd'
33
import deepmerge from 'deepmerge'
44
import { JSONSchema7 } from 'json-schema'
55
import { 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

Comments
 (0)