@@ -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,83 @@ function App() {
114119 . then ( response => response . json ( ) ) ;
115120 } ;
116121
122+ const searchJobs = async ( processInstanceKey , elementId ) => {
123+ return fetch ( `/api/searchJobs/${ processInstanceKey } ?elementId=${ elementId } ` )
124+ . then ( response => response . json ( ) ) ;
125+ } ;
126+
127+ const searchUserTasks = async ( processInstanceKey , elementId ) => {
128+ return fetch ( `/api/searchUserTasks/${ processInstanceKey } ?elementId=${ elementId } ` )
129+ . then ( response => response . json ( ) ) ;
130+ } ;
131+
132+ const searchMessageSubscriptions = async ( processInstanceKey , elementId ) => {
133+ return fetch ( `/api/searchMessageSubscriptions/${ processInstanceKey } ?elementId=${ elementId } ` )
134+ . then ( response => response . json ( ) ) ;
135+ } ;
136+
117137 const { current : onConfigChanged } = useRef ( debounce ( config => setConfig ( config ) , 300 ) ) ;
118138
119139 // eslint-disable-next-line no-undef
120140 const operateURL = process . env . CAMUNDA_OPERATE_BASE_URL ;
121141
142+ // eslint-disable-next-line no-undef
143+ const tasklistURL = process . env . CAMUNDA_TASKLIST_BASE_URL ;
144+
122145 return (
123146 < >
124147 < div className = "modeler" ref = { modelerRef } >
125148 < div id = "canvas" className = "canvas" > </ div >
126149 < 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- />
150+ < div className = "task-testing" >
151+ < TestTab
152+ injector = { injector }
153+ isConnectionConfigured = { isConnectionConfigured }
154+ configureConnectionBannerTitle = "No cluster selected"
155+ configureConnectionBannerDescription = "Select a Camunda 8.8 cluster to enable task testing."
156+ configureConnectionLabel = "Select cluster"
157+ onConfigureConnection = { ( ) => {
158+ if ( window . confirm ( 'Cluster selected?' ) ) {
159+ setIsConnectionConfigured ( true ) ;
160+ }
161+ } }
162+ onTestTask = { ( ) => {
163+ if ( isConnectionConfigured ) {
164+ return true ;
165+ }
166+
167+ if ( window . confirm ( 'Cluster selected?' ) ) {
168+ setIsConnectionConfigured ( true ) ;
169+
170+ return true ;
171+ }
172+
173+ return false ;
174+ } }
175+ api = { {
176+ deploy,
177+ startInstance,
178+ getProcessInstance,
179+ getProcessInstanceVariables,
180+ getProcessInstanceElementInstances,
181+ getProcessInstanceIncident,
182+ searchJobs,
183+ searchUserTasks,
184+ searchMessageSubscriptions
185+ } }
186+ config = { config }
187+ onConfigChanged = { onConfigChanged }
188+ operateBaseUrl = { operateURL }
189+ tasklistBaseUrl = { tasklistURL }
190+ documentationUrl = "https://docs.camunda.io/"
191+ onTaskExecutionStarted = { ( element ) => {
192+ console . log ( 'Task execution started:' , element . id ) ;
193+ } }
194+ onTaskExecutionFinished = { ( element , result ) => {
195+ console . log ( 'Task execution finished:' , element . id , result . success ? 'success' : result . reason , result ) ;
196+ } }
197+ />
198+ </ div >
172199 </ div >
173200 </ >
174201 ) ;
@@ -182,12 +209,12 @@ function TestTab(props) {
182209 }
183210
184211 return < TaskTesting { ...props } >
185- < RPATab />
212+ { /* <RPATab />
186213 <RPALink />
187214 <FooTabDynamic />
188215 <FooTabStatic />
189216 <FooLinkDynamic />
190- < FooLinkStatic />
217+ <FooLinkStatic /> */ }
191218 </ TaskTesting > ;
192219}
193220
0 commit comments