Skip to content

Commit 94b454d

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

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

components/workflows/ForkWorkflowModal.tsx

+11-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,8 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
272272
return integrations
273273
}, [data?.workflow])
274274

275+
const templateSchemaEmpty = !templateSchema || isEmptyObj(templateSchema.properties ?? {})
276+
275277
return (
276278
<Modal
277279
title={templateSchema ? `Use template "${workflow.name}"` : `Create a copy of "${workflow.name}"`}
@@ -308,7 +310,7 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
308310
/>
309311
</div>
310312
))}
311-
{templateSchema && (
313+
{!templateSchemaEmpty && (
312314
<SchemaForm
313315
schema={templateSchema}
314316
initialInputs={templateInputs ?? {}}
@@ -318,6 +320,13 @@ export const ForkWorkflowModal = ({ workflow, visible, onWorkflowFork, onClose }
318320
submitButtonText={workflow.isTemplate ? 'Use Template' : 'Fork'}
319321
/>
320322
)}
323+
{templateSchemaEmpty && (
324+
<>
325+
<Button type="primary" key="deploy" onClick={() => handleFork()} loading={forkLoading}>
326+
{workflow.isTemplate ? 'Use Template' : 'Fork'}
327+
</Button>
328+
</>
329+
)}
321330
</Modal>
322331
)
323332
}

0 commit comments

Comments
 (0)