diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index f318fb59..212014cf 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -64,7 +64,7 @@ import { modifyProcessIdentifierForPathParam, } from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; -import { PermissionsToCheck, Task } from '../interfaces'; +import { PermissionsToCheck, ProcessModelCaller, Task } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; type OwnProps = { @@ -89,7 +89,7 @@ type OwnProps = { onSearchProcessModels?: (..._args: any[]) => any; onElementsChanged?: (..._args: any[]) => any; url?: string; - callers?: any; + callers?: ProcessModelCaller[]; }; // https://codesandbox.io/s/quizzical-lake-szfyo?file=/src/App.js was a handy reference @@ -575,6 +575,9 @@ export default function ReactDiagramEditor({ const canViewXml = fileName !== undefined; const showReferences = () => { + if (!callers) { + return null; + } return ( - {callers.map((ref: any) => ( + {callers.map((ref: ProcessModelCaller) => (
  • { - if (callers.length > 0) { + if (callers && callers.length > 0) { let buttonText = `View ${callers.length} Reference`; if (callers.length > 1) buttonText += 's'; return ( diff --git a/spiffworkflow-frontend/src/interfaces.ts b/spiffworkflow-frontend/src/interfaces.ts index cd280cb8..aa0579e9 100644 --- a/spiffworkflow-frontend/src/interfaces.ts +++ b/spiffworkflow-frontend/src/interfaces.ts @@ -330,3 +330,8 @@ export interface ProcessInstanceLogEntry { user_id?: number; username?: string; } + +export interface ProcessModelCaller { + display_name: string; + process_model_id: string; +} diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 1e200ec4..6e17c873 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -34,6 +34,7 @@ import { CarbonComboBoxProcessSelection, ProcessFile, ProcessModel, + ProcessModelCaller, ProcessReference, } from '../interfaces'; import ProcessSearch from '../components/ProcessSearch'; @@ -119,7 +120,7 @@ export default function ProcessModelEditDiagram() { const processModelPath = `process-models/${modifiedProcessModelId}`; - const [callers, setCallers] = useState>([]); + const [callers, setCallers] = useState([]); usePrompt('Changes you made may not be saved.', diagramHasChanges);