11import { gql } from '@apollo/client'
22import { Alert , Button , Form , Input , Switch } from 'antd'
3+ import TextArea from 'antd/lib/input/TextArea'
34import { useEffect , useState } from 'react'
45import { Workflow } from '../../graphql'
56import { WorkflowSelector } from './WorkflowSelector'
@@ -13,8 +14,7 @@ interface Props {
1314 error : string | null
1415}
1516
16- export const WorkflowForm = ( props : Props ) => {
17- const { workflow, showSubmit, onSubmit, onChange, loading, error } = props
17+ export const WorkflowForm = ( { workflow, showSubmit, onSubmit, onChange, loading, error } : Props ) => {
1818 const [ name , setName ] = useState ( workflow ?. name ?? '' )
1919 const [ runWorkflowOnFailureEnabled , setRunWorkflowOnFailureEnabled ] = useState ( ! ! workflow . runOnFailure )
2020 const [ runOnFailure , setRunOnFailure ] = useState < string | null > ( workflow . runOnFailure ?? null )
@@ -78,6 +78,21 @@ export const WorkflowForm = (props: Props) => {
7878 < span style = { { marginLeft : 8 } } > Run a workflow on failure</ span >
7979 </ div >
8080
81+ { workflow . isTemplate && (
82+ < div className = "mb-8" >
83+ < Form . Item
84+ name = "templateSchema"
85+ label = "Template Schema (Advanced)"
86+ initialValue = { JSON . stringify ( workflow . templateSchema , null , 2 ) }
87+ rules = { [ { required : true } ] }
88+ help = "Define the JSON Schema for the use template modal. Only for advanced users."
89+ style = { { marginBottom : 46 } }
90+ >
91+ < TextArea rows = { 4 } />
92+ </ Form . Item >
93+ </ div >
94+ ) }
95+
8196 { runWorkflowOnFailureEnabled && (
8297 < div style = { { marginBottom : 32 } } >
8398 < WorkflowSelector
@@ -106,6 +121,8 @@ WorkflowForm.fragments = {
106121 id
107122 name
108123 runOnFailure
124+ templateSchema
125+ isTemplate
109126 }
110127 ` ,
111128
0 commit comments