From 7565197e399d3538b6251cbd77832b199bc0494f Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 10 Nov 2022 09:13:27 -0500 Subject: [PATCH] cleaned up breadcrumbs some more and cleaned up console.log statements --- .../src/components/ProcessBreadcrumb.tsx | 9 ++--- .../src/components/ProcessGroupForm.tsx | 3 -- .../src/components/ReactDiagramEditor.tsx | 7 ++-- .../src/routes/ProcessGroupNew.tsx | 11 ++++-- .../src/routes/ProcessGroupShow.tsx | 34 ++++++++----------- .../src/routes/ProcessInstanceLogList.tsx | 1 - .../src/routes/ProcessModelEditDiagram.tsx | 5 ++- 7 files changed, 34 insertions(+), 36 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx index fcd8b50d..6408be2d 100644 --- a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx +++ b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx @@ -32,9 +32,10 @@ const explodeCrumb = (crumb: HotCrumbItem) => { if (lastPathItem !== undefined) { paths.push(lastPathItem); } - const lastUrl = `/admin/${endingUrlType.replace('_', '-')}s/${paths.join( - ':' - )}`; + // process_models to process-models + const lastUrl = `/admin/${endingUrlType + .replace('_', '-') + .replace(/s*$/, 's')}/${paths.join(':')}`; breadcrumbItems.push( {lastPathItem} @@ -69,7 +70,7 @@ export default function ProcessBreadcrumb({ ); } - if (url && url.match(/^process_(model|group):/)) { + if (url && url.match(/^process[_-](model|group)s?:/)) { return explodeCrumb(crumb); } return ( diff --git a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx index 5006fc0a..3d51adeb 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx @@ -79,12 +79,9 @@ export default function ProcessGroupForm({ description: processGroup.description, }; if (mode === 'new') { - console.log(`parentGroupId: ${parentGroupId}`); - console.log(`processGroup.id: ${processGroup.id}`); if (parentGroupId) { newProcessGroupId = `${parentGroupId}/${processGroup.id}`; } - console.log(`newProcessGroupId: ${newProcessGroupId}`); Object.assign(postBody, { id: parentGroupId ? `${parentGroupId}/${processGroup.id}` diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index e9ddb445..37a947e4 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -229,7 +229,7 @@ export default function ReactDiagramEditor({ diagramModeler.on('spiff.script.edit', (event: any) => { const { error, element, scriptType, script, eventBus } = event; if (error) { - console.log(error); + console.error(error); } handleLaunchScriptEditor(element, script, scriptType, eventBus); }); @@ -237,7 +237,7 @@ export default function ReactDiagramEditor({ diagramModeler.on('spiff.markdown.edit', (event: any) => { const { error, element, value, eventBus } = event; if (error) { - console.log(error); + console.error(error); } handleLaunchMarkdownEditor(element, value, eventBus); }); @@ -318,7 +318,7 @@ export default function ReactDiagramEditor({ } function handleError(err: any) { - console.log('ERROR:', err); + console.error('ERROR:', err); } function checkTaskCanBeHighlighted(taskBpmnId: string) { @@ -406,7 +406,6 @@ export default function ReactDiagramEditor({ } function fetchDiagramFromURL(urlToUse: any) { - console.log(`urlToUse: ${urlToUse}`); fetch(urlToUse) .then((response) => response.text()) .then((text) => { diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx index d4d8b038..c47b83bd 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx @@ -1,18 +1,25 @@ import { useState } from 'react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessGroupForm from '../components/ProcessGroupForm'; -import { ProcessGroup } from '../interfaces'; +import { ProcessGroup, HotCrumbItem } from '../interfaces'; export default function ProcessGroupNew() { + const searchParams = new URLSearchParams(document.location.search); + const parentGroupId = searchParams.get('parentGroupId'); const [processGroup, setProcessGroup] = useState({ id: '', display_name: '', description: '', }); + const hotCrumbs: HotCrumbItem[] = [['Process Groups', '/admin']]; + if (parentGroupId) { + hotCrumbs.push(['', `process_group:${parentGroupId}:link`]); + } + return ( <> - +

Add Process Group

{ - const modifiedProcessModelId: String = (row as any).id.replace('/', ':'); + const rows = processModels.map((row: ProcessModel) => { + const modifiedProcessModelId: String = row.id.replace('/', ':'); return ( - + - {(row as any).id} + {row.id} - {(row as any).display_name} + {row.display_name} ); }); @@ -85,21 +85,19 @@ export default function ProcessGroupShow() { if (processGroup === null) { return null; } - const rows = processGroups.map((row) => { - const modifiedProcessGroupId: String = modifyProcessModelPath( - (row as any).id - ); + const rows = processGroups.map((row: ProcessGroup) => { + const modifiedProcessGroupId: String = modifyProcessModelPath(row.id); return ( - + - {(row as any).id} + {row.id} - {(row as any).display_name} + {row.display_name} ); }); @@ -121,15 +119,13 @@ export default function ProcessGroupShow() { if (processGroup && pagination) { const { page, perPage } = getPageInfoFromSearchParams(searchParams); - const modifiedProcessGroupId = modifyProcessModelPath( - (processGroup as any).id - ); + const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id); return ( <>
    @@ -159,7 +155,7 @@ export default function ProcessGroupShow() { perPage={perPage} pagination={pagination} tableToDisplay={buildModelTable()} - path={`/admin/process-groups/${(processGroup as any).id}`} + path={`/admin/process-groups/${processGroup.id}`} />

    @@ -168,7 +164,7 @@ export default function ProcessGroupShow() { perPage={perPage} pagination={pagination} tableToDisplay={buildGroupTable()} - path={`/admin/process-groups/${(processGroup as any).id}`} + path={`/admin/process-groups/${processGroup.id}`} />
diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 92961b0a..3bec8aef 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -36,7 +36,6 @@ export default function ProcessInstanceLogList() { // return null; const rows = processInstanceLogs.map((row) => { const rowToUse = row as any; - console.log(`rowToUse: ${rowToUse}`); return ( {rowToUse.bpmn_process_identifier} diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index a60a42f0..85668d45 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -268,7 +268,7 @@ export default function ProcessModelEditDiagram() { }); event.eventBus.fire('spiff.json_files.returned', { options }); } else { - console.log('There is no process Model.'); + console.error('There is no process Model.'); } }; @@ -281,10 +281,9 @@ export default function ProcessModelEditDiagram() { options.push({ label: ref.name, value: ref.id }); }); }); - console.log('Options', options); event.eventBus.fire('spiff.dmn_files.returned', { options }); } else { - console.log('There is no process model.'); + console.error('There is no process model.'); } };