1
1
import { gql } from '@apollo/client'
2
2
import { Alert , Button , Form , Input , Switch } from 'antd'
3
+ import TextArea from 'antd/lib/input/TextArea'
3
4
import { useEffect , useState } from 'react'
4
5
import { Workflow } from '../../graphql'
5
6
import { WorkflowSelector } from './WorkflowSelector'
@@ -13,8 +14,7 @@ interface Props {
13
14
error : string | null
14
15
}
15
16
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 ) => {
18
18
const [ name , setName ] = useState ( workflow ?. name ?? '' )
19
19
const [ runWorkflowOnFailureEnabled , setRunWorkflowOnFailureEnabled ] = useState ( ! ! workflow . runOnFailure )
20
20
const [ runOnFailure , setRunOnFailure ] = useState < string | null > ( workflow . runOnFailure ?? null )
@@ -78,6 +78,21 @@ export const WorkflowForm = (props: Props) => {
78
78
< span style = { { marginLeft : 8 } } > Run a workflow on failure</ span >
79
79
</ div >
80
80
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
+
81
96
{ runWorkflowOnFailureEnabled && (
82
97
< div style = { { marginBottom : 32 } } >
83
98
< WorkflowSelector
@@ -106,6 +121,8 @@ WorkflowForm.fragments = {
106
121
id
107
122
name
108
123
runOnFailure
124
+ templateSchema
125
+ isTemplate
109
126
}
110
127
` ,
111
128
0 commit comments