cleaned up breadcrumbs some more and cleaned up console.log statements

This commit is contained in:
jasquat 2022-11-10 09:13:27 -05:00
parent fcd5b431e2
commit a29f267b3d
7 changed files with 34 additions and 36 deletions

View File

@ -32,9 +32,10 @@ const explodeCrumb = (crumb: HotCrumbItem) => {
if (lastPathItem !== undefined) { if (lastPathItem !== undefined) {
paths.push(lastPathItem); 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( breadcrumbItems.push(
<BreadcrumbItem key={lastPathItem} href={lastUrl}> <BreadcrumbItem key={lastPathItem} href={lastUrl}>
{lastPathItem} {lastPathItem}
@ -69,7 +70,7 @@ export default function ProcessBreadcrumb({
</BreadcrumbItem> </BreadcrumbItem>
); );
} }
if (url && url.match(/^process_(model|group):/)) { if (url && url.match(/^process[_-](model|group)s?:/)) {
return explodeCrumb(crumb); return explodeCrumb(crumb);
} }
return ( return (

View File

@ -79,12 +79,9 @@ export default function ProcessGroupForm({
description: processGroup.description, description: processGroup.description,
}; };
if (mode === 'new') { if (mode === 'new') {
console.log(`parentGroupId: ${parentGroupId}`);
console.log(`processGroup.id: ${processGroup.id}`);
if (parentGroupId) { if (parentGroupId) {
newProcessGroupId = `${parentGroupId}/${processGroup.id}`; newProcessGroupId = `${parentGroupId}/${processGroup.id}`;
} }
console.log(`newProcessGroupId: ${newProcessGroupId}`);
Object.assign(postBody, { Object.assign(postBody, {
id: parentGroupId id: parentGroupId
? `${parentGroupId}/${processGroup.id}` ? `${parentGroupId}/${processGroup.id}`

View File

@ -229,7 +229,7 @@ export default function ReactDiagramEditor({
diagramModeler.on('spiff.script.edit', (event: any) => { diagramModeler.on('spiff.script.edit', (event: any) => {
const { error, element, scriptType, script, eventBus } = event; const { error, element, scriptType, script, eventBus } = event;
if (error) { if (error) {
console.log(error); console.error(error);
} }
handleLaunchScriptEditor(element, script, scriptType, eventBus); handleLaunchScriptEditor(element, script, scriptType, eventBus);
}); });
@ -237,7 +237,7 @@ export default function ReactDiagramEditor({
diagramModeler.on('spiff.markdown.edit', (event: any) => { diagramModeler.on('spiff.markdown.edit', (event: any) => {
const { error, element, value, eventBus } = event; const { error, element, value, eventBus } = event;
if (error) { if (error) {
console.log(error); console.error(error);
} }
handleLaunchMarkdownEditor(element, value, eventBus); handleLaunchMarkdownEditor(element, value, eventBus);
}); });
@ -318,7 +318,7 @@ export default function ReactDiagramEditor({
} }
function handleError(err: any) { function handleError(err: any) {
console.log('ERROR:', err); console.error('ERROR:', err);
} }
function checkTaskCanBeHighlighted(taskBpmnId: string) { function checkTaskCanBeHighlighted(taskBpmnId: string) {
@ -406,7 +406,6 @@ export default function ReactDiagramEditor({
} }
function fetchDiagramFromURL(urlToUse: any) { function fetchDiagramFromURL(urlToUse: any) {
console.log(`urlToUse: ${urlToUse}`);
fetch(urlToUse) fetch(urlToUse)
.then((response) => response.text()) .then((response) => response.text())
.then((text) => { .then((text) => {

View File

@ -1,18 +1,25 @@
import { useState } from 'react'; import { useState } from 'react';
import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
import ProcessGroupForm from '../components/ProcessGroupForm'; import ProcessGroupForm from '../components/ProcessGroupForm';
import { ProcessGroup } from '../interfaces'; import { ProcessGroup, HotCrumbItem } from '../interfaces';
export default function ProcessGroupNew() { export default function ProcessGroupNew() {
const searchParams = new URLSearchParams(document.location.search);
const parentGroupId = searchParams.get('parentGroupId');
const [processGroup, setProcessGroup] = useState<ProcessGroup>({ const [processGroup, setProcessGroup] = useState<ProcessGroup>({
id: '', id: '',
display_name: '', display_name: '',
description: '', description: '',
}); });
const hotCrumbs: HotCrumbItem[] = [['Process Groups', '/admin']];
if (parentGroupId) {
hotCrumbs.push(['', `process_group:${parentGroupId}:link`]);
}
return ( return (
<> <>
<ProcessBreadcrumb /> <ProcessBreadcrumb hotCrumbs={hotCrumbs} />
<h2>Add Process Group</h2> <h2>Add Process Group</h2>
<ProcessGroupForm <ProcessGroupForm
mode="new" mode="new"

View File

@ -10,7 +10,7 @@ import {
modifyProcessModelPath, modifyProcessModelPath,
unModifyProcessModelPath, unModifyProcessModelPath,
} from '../helpers'; } from '../helpers';
import { ProcessGroup } from '../interfaces'; import { ProcessGroup, ProcessModel } from '../interfaces';
export default function ProcessGroupShow() { export default function ProcessGroupShow() {
const params = useParams(); const params = useParams();
@ -49,19 +49,19 @@ export default function ProcessGroupShow() {
if (processGroup === null) { if (processGroup === null) {
return null; return null;
} }
const rows = processModels.map((row) => { const rows = processModels.map((row: ProcessModel) => {
const modifiedProcessModelId: String = (row as any).id.replace('/', ':'); const modifiedProcessModelId: String = row.id.replace('/', ':');
return ( return (
<tr key={(row as any).id}> <tr key={row.id}>
<td> <td>
<Link <Link
to={`/admin/process-models/${modifiedProcessModelId}`} to={`/admin/process-models/${modifiedProcessModelId}`}
data-qa="process-model-show-link" data-qa="process-model-show-link"
> >
{(row as any).id} {row.id}
</Link> </Link>
</td> </td>
<td>{(row as any).display_name}</td> <td>{row.display_name}</td>
</tr> </tr>
); );
}); });
@ -85,21 +85,19 @@ export default function ProcessGroupShow() {
if (processGroup === null) { if (processGroup === null) {
return null; return null;
} }
const rows = processGroups.map((row) => { const rows = processGroups.map((row: ProcessGroup) => {
const modifiedProcessGroupId: String = modifyProcessModelPath( const modifiedProcessGroupId: String = modifyProcessModelPath(row.id);
(row as any).id
);
return ( return (
<tr key={(row as any).id}> <tr key={row.id}>
<td> <td>
<Link <Link
to={`/admin/process-groups/${modifiedProcessGroupId}`} to={`/admin/process-groups/${modifiedProcessGroupId}`}
data-qa="process-model-show-link" data-qa="process-model-show-link"
> >
{(row as any).id} {row.id}
</Link> </Link>
</td> </td>
<td>{(row as any).display_name}</td> <td>{row.display_name}</td>
</tr> </tr>
); );
}); });
@ -121,15 +119,13 @@ export default function ProcessGroupShow() {
if (processGroup && pagination) { if (processGroup && pagination) {
const { page, perPage } = getPageInfoFromSearchParams(searchParams); const { page, perPage } = getPageInfoFromSearchParams(searchParams);
const modifiedProcessGroupId = modifyProcessModelPath( const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id);
(processGroup as any).id
);
return ( return (
<> <>
<ProcessBreadcrumb <ProcessBreadcrumb
hotCrumbs={[ hotCrumbs={[
['Process Groups', '/admin'], ['Process Groups', '/admin'],
[`Process Group: ${processGroup.display_name}`], ['', `process_group:${processGroup.id}`],
]} ]}
/> />
<ul> <ul>
@ -159,7 +155,7 @@ export default function ProcessGroupShow() {
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
tableToDisplay={buildModelTable()} tableToDisplay={buildModelTable()}
path={`/admin/process-groups/${(processGroup as any).id}`} path={`/admin/process-groups/${processGroup.id}`}
/> />
<br /> <br />
<br /> <br />
@ -168,7 +164,7 @@ export default function ProcessGroupShow() {
perPage={perPage} perPage={perPage}
pagination={pagination} pagination={pagination}
tableToDisplay={buildGroupTable()} tableToDisplay={buildGroupTable()}
path={`/admin/process-groups/${(processGroup as any).id}`} path={`/admin/process-groups/${processGroup.id}`}
/> />
</ul> </ul>
</> </>

View File

@ -36,7 +36,6 @@ export default function ProcessInstanceLogList() {
// return null; // return null;
const rows = processInstanceLogs.map((row) => { const rows = processInstanceLogs.map((row) => {
const rowToUse = row as any; const rowToUse = row as any;
console.log(`rowToUse: ${rowToUse}`);
return ( return (
<tr key={rowToUse.id}> <tr key={rowToUse.id}>
<td>{rowToUse.bpmn_process_identifier}</td> <td>{rowToUse.bpmn_process_identifier}</td>

View File

@ -268,7 +268,7 @@ export default function ProcessModelEditDiagram() {
}); });
event.eventBus.fire('spiff.json_files.returned', { options }); event.eventBus.fire('spiff.json_files.returned', { options });
} else { } 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 }); options.push({ label: ref.name, value: ref.id });
}); });
}); });
console.log('Options', options);
event.eventBus.fire('spiff.dmn_files.returned', { options }); event.eventBus.fire('spiff.dmn_files.returned', { options });
} else { } else {
console.log('There is no process model.'); console.error('There is no process model.');
} }
}; };