get callers & pass to diagram editor

This commit is contained in:
Elizabeth Esswein 2023-04-21 17:22:17 -04:00
parent edb0d37672
commit 59771d09a3
5 changed files with 22 additions and 0 deletions

View File

@ -85,6 +85,7 @@ type OwnProps = {
onSearchProcessModels?: (..._args: any[]) => any;
onElementsChanged?: (..._args: any[]) => any;
url?: string;
callers?: any;
};
// https://codesandbox.io/s/quizzical-lake-szfyo?file=/src/App.js was a handy reference
@ -110,6 +111,7 @@ export default function ReactDiagramEditor({
onSearchProcessModels,
onElementsChanged,
url,
callers,
}: OwnProps) {
const [diagramXMLString, setDiagramXMLString] = useState('');
const [diagramModelerState, setDiagramModelerState] = useState(null);
@ -125,6 +127,8 @@ export default function ReactDiagramEditor({
const { ability } = usePermissionFetcher(permissionRequestData);
const navigate = useNavigate();
console.log(callers);
useEffect(() => {
if (diagramModelerState) {
return;

View File

@ -197,6 +197,7 @@ export interface ProcessModel {
description: string;
display_name: string;
primary_file_name: string;
primary_process_id: string;
files: ProcessFile[];
parent_groups?: ProcessGroupLite[];
metadata_extraction_paths?: MetadataExtractionPath[];

View File

@ -147,6 +147,7 @@ export default function MyTasks() {
description: '',
display_name: '',
primary_file_name: '',
primary_process_id: '',
files: [],
};
const modifiedProcessModelId = modifyProcessIdentifierForPathParam(

View File

@ -119,6 +119,8 @@ export default function ProcessModelEditDiagram() {
const processModelPath = `process-models/${modifiedProcessModelId}`;
const [callers, setCallers] = useState<Array<string>>([]);
usePrompt('Changes you made may not be saved.', diagramHasChanges);
useEffect(() => {
@ -162,6 +164,18 @@ export default function ProcessModelEditDiagram() {
}
}, [processModelPath, params]);
useEffect(() => {
const getCallerIds = (result: any) => {
setCallers(result.map((r: any) => r.process_model_id));
}
if (processModel !== null) {
HttpService.makeCallToBackend({
path: `/processes/${processModel.primary_process_id}/callers`,
successCallback: getCallerIds,
});
}
}, [processModel]);
const handleFileNameCancel = () => {
setShowFileNameEditor(false);
setNewFileName('');
@ -958,6 +972,7 @@ export default function ProcessModelEditDiagram() {
onDmnFilesRequested={onDmnFilesRequested}
onSearchProcessModels={onSearchProcessModels}
onElementsChanged={onElementsChanged}
callers={callers}
/>
);
};

View File

@ -12,6 +12,7 @@ export default function ProcessModelNew() {
display_name: '',
description: '',
primary_file_name: '',
primary_process_id: '',
files: [],
});