@@ -8,6 +8,7 @@ import 'camunda-bpmn-js/dist/assets/camunda-cloud-modeler.css';
88import TaskTesting from '../lib' ;
99
1010import diagram from './fixtures/diagram.bpmn' ;
11+ import form from './fixtures/form.form' ;
1112import connectorTemplates from './fixtures/connectorTemplates.json' ;
1213import defaultConfig from './fixtures/config' ;
1314
@@ -26,7 +27,7 @@ function App() {
2627
2728 const [ modeler , setModeler ] = useState ( null ) ;
2829
29- const [ isConnectionConfigured , setIsConnectionConfigured ] = useState ( false ) ;
30+ const [ isConnectionConfigured , setIsConnectionConfigured ] = useState ( true ) ;
3031
3132 const [ config , setConfig ] = useState ( undefined ) ;
3233
@@ -65,14 +66,18 @@ function App() {
6566 const deploy = async ( ) => {
6667 const { xml } = await modeler . saveXML ( ) ;
6768
69+ const payload = { xml } ;
70+
71+ if ( form ) {
72+ payload . form = form ;
73+ }
74+
6875 const response = await fetch ( '/api/deploy' , {
6976 method : 'POST' ,
7077 headers : {
7178 'Content-Type' : 'application/json'
7279 } ,
73- body : JSON . stringify ( {
74- xml
75- } )
80+ body : JSON . stringify ( payload )
7681 } ) ;
7782
7883 return await response . json ( ) ;
@@ -114,61 +119,71 @@ function App() {
114119 . then ( response => response . json ( ) ) ;
115120 } ;
116121
122+ const getWaitingState = async ( processInstanceKey , elementId ) => {
123+ return fetch ( `/api/getWaitingState/${ processInstanceKey } ?elementId=${ elementId } ` )
124+ . then ( response => response . json ( ) ) ;
125+ } ;
126+
117127 const { current : onConfigChanged } = useRef ( debounce ( config => setConfig ( config ) , 300 ) ) ;
118128
119129 // eslint-disable-next-line no-undef
120130 const operateURL = process . env . CAMUNDA_OPERATE_BASE_URL ;
121131
132+ // eslint-disable-next-line no-undef
133+ const tasklistURL = process . env . CAMUNDA_TASKLIST_BASE_URL ;
134+
122135 return (
123136 < >
124137 < div className = "modeler" ref = { modelerRef } >
125138 < div id = "canvas" className = "canvas" > </ div >
126139 < div id = "properties" className = "properties-panel" > </ div >
127- </ div >
128- < div className = "task-testing" >
129- < TestTab
130- injector = { injector }
131- isConnectionConfigured = { isConnectionConfigured }
132- configureConnectionBannerTitle = "No cluster selected"
133- configureConnectionBannerDescription = "Select a Camunda 8.8 cluster to enable task testing."
134- configureConnectionLabel = "Select cluster"
135- onConfigureConnection = { ( ) => {
136- if ( window . confirm ( 'Cluster selected?' ) ) {
137- setIsConnectionConfigured ( true ) ;
138- }
139- } }
140- onTestTask = { ( ) => {
141- if ( isConnectionConfigured ) {
142- return true ;
143- }
144-
145- if ( window . confirm ( 'Cluster selected?' ) ) {
146- setIsConnectionConfigured ( true ) ;
147-
148- return true ;
149- }
150-
151- return false ;
152- } }
153- api = { {
154- deploy,
155- startInstance,
156- getProcessInstance,
157- getProcessInstanceVariables,
158- getProcessInstanceElementInstances,
159- getProcessInstanceIncident
160- } }
161- config = { config }
162- onConfigChanged = { onConfigChanged }
163- operateBaseUrl = { operateURL }
164- documentationUrl = "https://docs.camunda.io/"
165- onTaskExecutionStarted = { ( element ) => {
166- console . log ( 'Task execution started:' , element . id ) ;
167- } }
168- onTaskExecutionFinished = { ( element , result ) => {
169- console . log ( 'Task execution finished:' , element . id , result . success ? 'success' : result . reason , result ) ;
170- } }
171- />
140+ < div className = "task-testing" >
141+ < TestTab
142+ injector = { injector }
143+ isConnectionConfigured = { isConnectionConfigured }
144+ configureConnectionBannerTitle = "No cluster selected"
145+ configureConnectionBannerDescription = "Select a Camunda 8.8 cluster to enable task testing."
146+ configureConnectionLabel = "Select cluster"
147+ onConfigureConnection = { ( ) => {
148+ if ( window . confirm ( 'Cluster selected?' ) ) {
149+ setIsConnectionConfigured ( true ) ;
150+ }
151+ } }
152+ onTestTask = { ( ) => {
153+ if ( isConnectionConfigured ) {
154+ return true ;
155+ }
156+
157+ if ( window . confirm ( 'Cluster selected?' ) ) {
158+ setIsConnectionConfigured ( true ) ;
159+
160+ return true ;
161+ }
162+
163+ return false ;
164+ } }
165+ api = { {
166+ deploy,
167+ startInstance,
168+ getProcessInstance,
169+ getProcessInstanceVariables,
170+ getProcessInstanceElementInstances,
171+ getProcessInstanceIncident,
172+ getWaitingState
173+ } }
174+ config = { config }
175+ onConfigChanged = { onConfigChanged }
176+ operateBaseUrl = { operateURL }
177+ tasklistBaseUrl = { tasklistURL }
178+ documentationUrl = "https://docs.camunda.io/"
179+ onTaskExecutionStarted = { ( element ) => {
180+ console . log ( 'Task execution started:' , element . id ) ;
181+ } }
182+ onTaskExecutionFinished = { ( element , result ) => {
183+ console . log ( 'Task execution finished:' , element . id , result . success ? 'success' : result . reason , result ) ;
184+ } }
185+ />
186+ </ div >
172187 </ div >
173188 </ >
174189 ) ;
@@ -182,12 +197,12 @@ function TestTab(props) {
182197 }
183198
184199 return < TaskTesting { ...props } >
185- < RPATab />
200+ { /* <RPATab />
186201 <RPALink />
187202 <FooTabDynamic />
188203 <FooTabStatic />
189204 <FooLinkDynamic />
190- < FooLinkStatic />
205+ <FooLinkStatic /> */ }
191206 </ TaskTesting > ;
192207}
193208
0 commit comments