diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 208cbd292..f42e92947 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -19,7 +19,7 @@ import { import React, { useRef, useEffect, useState } from 'react'; // @ts-ignore -import { Button } from '@carbon/react'; +import { Button, Modal, UnorderedList, Link } from '@carbon/react'; import 'bpmn-js/dist/assets/diagram-js.css'; import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'; @@ -58,7 +58,11 @@ import { Can } from '@casl/react'; import HttpService from '../services/HttpService'; import ButtonWithConfirmation from './ButtonWithConfirmation'; -import { getBpmnProcessIdentifiers, makeid } from '../helpers'; +import { + getBpmnProcessIdentifiers, + makeid, + modifyProcessIdentifierForPathParam, +} from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { PermissionsToCheck, Task } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; @@ -127,7 +131,7 @@ export default function ReactDiagramEditor({ const { ability } = usePermissionFetcher(permissionRequestData); const navigate = useNavigate(); - console.log(callers); + const [showingReferences, setShowingReferences] = useState(false); useEffect(() => { if (diagramModelerState) { @@ -570,6 +574,42 @@ export default function ReactDiagramEditor({ const canViewXml = fileName !== undefined; + const showReferences = () => { + return ( + setShowingReferences(false)} + passiveModal + > + + {callers.map((ref: any) => ( +
  • + + {`${ref.display_name}`} + +
  • + ))} +
    +
    + ); + }; + + const getReferencesButton = () => { + if (callers.length > 0) { + let buttonText = `View ${callers.length} Reference`; + if (callers.length > 1) buttonText += 's'; + return ( + + ); + } + return null; + }; + const userActionOptions = () => { if (diagramType !== 'readonly') { return ( @@ -631,5 +671,11 @@ export default function ReactDiagramEditor({ return null; }; - return
    {userActionOptions()}
    ; + return ( +
    + {userActionOptions()} + {getReferencesButton()} + {showReferences()} +
    + ); } diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 07f4d16fd..1e200ec4e 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -165,13 +165,10 @@ 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, + successCallback: setCallers, }); } }, [processModel]);