2022-10-12 10:21:49 -04:00
|
|
|
import { useState, useEffect } from 'react';
|
2022-11-03 15:55:50 -04:00
|
|
|
import { useParams } from 'react-router-dom';
|
2022-10-31 15:09:21 -04:00
|
|
|
// @ts-ignore
|
2022-10-12 10:21:49 -04:00
|
|
|
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
|
|
|
import HttpService from '../services/HttpService';
|
2022-11-03 15:55:50 -04:00
|
|
|
import ProcessGroupForm from '../components/ProcessGroupForm';
|
|
|
|
import { ProcessGroup } from '../interfaces';
|
2022-10-12 10:21:49 -04:00
|
|
|
|
|
|
|
export default function ProcessGroupEdit() {
|
|
|
|
const params = useParams();
|
2022-11-03 15:55:50 -04:00
|
|
|
const [processGroup, setProcessGroup] = useState<ProcessGroup | null>(null);
|
2022-10-12 10:21:49 -04:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const setProcessGroupsFromResult = (result: any) => {
|
|
|
|
setProcessGroup(result);
|
|
|
|
};
|
|
|
|
|
|
|
|
HttpService.makeCallToBackend({
|
|
|
|
path: `/process-groups/${params.process_group_id}`,
|
|
|
|
successCallback: setProcessGroupsFromResult,
|
|
|
|
});
|
|
|
|
}, [params]);
|
|
|
|
|
|
|
|
if (processGroup) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ProcessBreadcrumb processGroupId={(processGroup as any).id} />
|
|
|
|
<h2>Edit Process Group: {(processGroup as any).id}</h2>
|
2022-11-03 15:55:50 -04:00
|
|
|
<ProcessGroupForm
|
|
|
|
mode="edit"
|
|
|
|
processGroup={processGroup}
|
|
|
|
setProcessGroup={setProcessGroup}
|
|
|
|
/>
|
2022-10-12 10:21:49 -04:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|