Add the new process insterstitial to the frontend.
This commit is contained in:
parent
8a6426efec
commit
19d4fb9981
|
@ -0,0 +1,26 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useParams } from 'react-router-dom';
|
||||||
|
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
||||||
|
import { BACKEND_BASE_URL } from '../config';
|
||||||
|
import { getBasicHeaders } from '../services/HttpService';
|
||||||
|
|
||||||
|
export default function ProcessInterstitial() {
|
||||||
|
const [data, setData] = useState<any[]>([]);
|
||||||
|
const params = useParams();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchEventSource(
|
||||||
|
`${BACKEND_BASE_URL}/tasks/${params.process_instance_id}`,
|
||||||
|
{
|
||||||
|
headers: getBasicHeaders(),
|
||||||
|
onmessage(ev) {
|
||||||
|
console.log(data, ev.data);
|
||||||
|
const parsedData = JSON.parse(ev.data);
|
||||||
|
setData((data) => [...data, parsedData]);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <div className="App">The last streamed item was: {data}</div>;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
// @ts-ignore
|
||||||
|
import { Tabs, TabList, Tab } from '@carbon/react';
|
||||||
|
import TaskShow from './TaskShow';
|
||||||
|
import MyTasks from './MyTasks';
|
||||||
|
import GroupedTasks from './GroupedTasks';
|
||||||
|
import CompletedInstances from './CompletedInstances';
|
||||||
|
import CreateNewInstance from './CreateNewInstance';
|
||||||
|
import ProcessInterstitial from './ProcessInterstitial';
|
||||||
|
|
||||||
|
export default function ProcessRoutes() {
|
||||||
|
return (
|
||||||
|
<Routes>
|
||||||
|
<Route
|
||||||
|
path=":process_model_identifier/:process_instance_id/interstitial"
|
||||||
|
element={<ProcessInterstitial />}
|
||||||
|
/>
|
||||||
|
</Routes>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue