Skip to content

Commit d7f96bd

Browse files
committed
feat: add execution log
1 parent 2baa067 commit d7f96bd

File tree

19 files changed

+2659
-742
lines changed

19 files changed

+2659
-742
lines changed

demo/App.jsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,29 @@ function App() {
119119
.then(response => response.json());
120120
};
121121

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+
122137
const { current: onConfigChanged } = useRef(debounce(config => setConfig(config), 300));
123138

124139
// eslint-disable-next-line no-undef
125140
const operateURL = process.env.CAMUNDA_OPERATE_BASE_URL;
126141

142+
// eslint-disable-next-line no-undef
143+
const tasklistURL = process.env.CAMUNDA_TASKLIST_BASE_URL;
144+
127145
return (
128146
<>
129147
<div className="modeler" ref={ modelerRef }>
@@ -160,11 +178,15 @@ function App() {
160178
getProcessInstance,
161179
getProcessInstanceVariables,
162180
getProcessInstanceElementInstances,
163-
getProcessInstanceIncident
181+
getProcessInstanceIncident,
182+
searchJobs,
183+
searchUserTasks,
184+
searchMessageSubscriptions
164185
} }
165186
config={ config }
166187
onConfigChanged={ onConfigChanged }
167188
operateBaseUrl={ operateURL }
189+
tasklistBaseUrl={ tasklistURL }
168190
documentationUrl="https://docs.camunda.io/"
169191
onTaskExecutionStarted={ (element) => {
170192
console.log('Task execution started:', element.id);

demo/plugins/RPA.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import logHtml from './log.html';
66
export const RPATab = () => {
77
const render = useCallback(({ output }) => {
88

9-
if (!output.variables?.RPA_Result) {
9+
if (!output?.variables?.RPA_Result) {
1010
return;
1111
}
1212

13-
return <iframe width="100%" srcDoc={ logHtml } />;
13+
return <iframe width="100%" height="100%" srcDoc={ logHtml } />;
1414
}, []);
1515

1616
return <TaskTesting.Tab

demo/server.mjs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,80 @@ app.get('/api/getProcessInstanceIncident/:processInstanceKey', async (req, res)
184184
}
185185
});
186186

187+
app.get('/api/searchJobs/:processInstanceKey', async (req, res) => {
188+
try {
189+
if (!camundaRestClient) {
190+
return res.json({ success: false, error: 'Camunda environment not configured' });
191+
}
192+
193+
const { processInstanceKey } = req.params;
194+
const { elementId } = req.query;
195+
196+
const response = await camundaRestClient.callApiEndpoint({
197+
urlPath: 'jobs/search',
198+
method: 'POST',
199+
body: {
200+
filter: {
201+
processInstanceKey,
202+
...(elementId && { elementId })
203+
}
204+
}
205+
});
206+
207+
res.json({ success: true, response });
208+
} catch (err) {
209+
res.status(500).json({ success: false, error: err.message });
210+
}
211+
});
212+
213+
app.get('/api/searchUserTasks/:processInstanceKey', async (req, res) => {
214+
try {
215+
if (!camundaRestClient) {
216+
return res.json({ success: false, error: 'Camunda environment not configured' });
217+
}
218+
219+
const { processInstanceKey } = req.params;
220+
const { elementId } = req.query;
221+
222+
const response = await camundaRestClient.searchUserTasks({
223+
filter: {
224+
processInstanceKey,
225+
...(elementId && { elementId })
226+
}
227+
});
228+
229+
res.json({ success: true, response });
230+
} catch (err) {
231+
res.status(500).json({ success: false, error: err.message });
232+
}
233+
});
234+
235+
app.get('/api/searchMessageSubscriptions/:processInstanceKey', async (req, res) => {
236+
try {
237+
if (!camundaRestClient) {
238+
return res.json({ success: false, error: 'Camunda environment not configured' });
239+
}
240+
241+
const { processInstanceKey } = req.params;
242+
const { elementId } = req.query;
243+
244+
const response = await camundaRestClient.callApiEndpoint({
245+
urlPath: 'message-subscriptions/search',
246+
method: 'POST',
247+
body: {
248+
filter: {
249+
processInstanceKey,
250+
...(elementId && { elementId })
251+
}
252+
}
253+
});
254+
255+
res.json({ success: true, response });
256+
} catch (err) {
257+
res.status(500).json({ success: false, error: err.message });
258+
}
259+
});
260+
187261
function createJobWorker() {
188262
if (!camundaRestClient) {
189263
console.warn('Camunda environment not configured, job worker not started');

0 commit comments

Comments
 (0)