some updates to add the log link back into the log list w/ burnettk

This commit is contained in:
jasquat 2023-03-23 11:08:23 -04:00
parent 00a0e901f1
commit b61b6d7921
No known key found for this signature in database
3 changed files with 49 additions and 17 deletions

View File

@ -300,3 +300,20 @@ export interface JsonSchemaForm {
process_model_id: string; process_model_id: string;
required: string[]; required: string[];
} }
export interface ProcessInstanceLogEntry {
bpmn_process_definition_identifier: string;
bpmn_process_definition_name: string;
bpmn_task_type: string;
event_type: string;
spiff_task_guid: string;
task_definition_identifier: string;
task_guid: string;
timestamp: number;
id: number;
process_instance_id: number;
task_definition_name?: string;
user_id?: number;
username?: string;
}

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
// @ts-ignore // @ts-ignore
import { Table, Tabs, TabList, Tab } from '@carbon/react'; import { Table, Tabs, TabList, Tab } from '@carbon/react';
import { useParams, useSearchParams } from 'react-router-dom'; import { Link, useParams, useSearchParams } from 'react-router-dom';
import PaginationForTable from '../components/PaginationForTable'; import PaginationForTable from '../components/PaginationForTable';
import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
import { import {
@ -10,6 +10,7 @@ import {
} from '../helpers'; } from '../helpers';
import HttpService from '../services/HttpService'; import HttpService from '../services/HttpService';
import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { useUriListForPermissions } from '../hooks/UriListForPermissions';
import { ProcessInstanceLogEntry } from '../interfaces';
type OwnProps = { type OwnProps = {
variant: string; variant: string;
@ -50,25 +51,26 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
isDetailedView, isDetailedView,
]); ]);
const getTableRow = (row: any) => { const getTableRow = (logEntry: ProcessInstanceLogEntry) => {
const tableRow = []; const tableRow = [];
const taskNameCell = ( const taskNameCell = (
<td> <td>
{row.task_definition_name || {logEntry.spiff_task_guid ||
(row.bpmn_task_type === 'StartEvent' ? 'Process Started' : '') || logEntry.task_definition_name ||
(row.bpmn_task_type === 'EndEvent' ? 'Process Ended' : '')} (logEntry.bpmn_task_type === 'StartEvent' ? 'Process Started' : '') ||
(logEntry.bpmn_task_type === 'EndEvent' ? 'Process Ended' : '')}
</td> </td>
); );
const bpmnProcessCell = ( const bpmnProcessCell = (
<td> <td>
{row.bpmn_process_definition_name || {logEntry.bpmn_process_definition_name ||
row.bpmn_process_definition_identifier} logEntry.bpmn_process_definition_identifier}
</td> </td>
); );
if (isDetailedView) { if (isDetailedView) {
tableRow.push( tableRow.push(
<> <>
<td data-qa="paginated-entity-id">{row.id}</td> <td data-qa="paginated-entity-id">{logEntry.id}</td>
{bpmnProcessCell} {bpmnProcessCell}
{taskNameCell} {taskNameCell}
</> </>
@ -84,24 +86,37 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
if (isDetailedView) { if (isDetailedView) {
tableRow.push( tableRow.push(
<> <>
<td>{row.bpmn_task_type}</td> <td>{logEntry.bpmn_task_type}</td>
<td>{row.event_type}</td> <td>{logEntry.event_type}</td>
<td> <td>
{row.username || ( {logEntry.username || (
<span className="system-user-log-entry">system</span> <span className="system-user-log-entry">system</span>
)} )}
</td> </td>
</> </>
); );
} }
tableRow.push(<td>{convertSecondsToFormattedDateTime(row.timestamp)}</td>); // tableRow.push(<td>{convertSecondsToFormattedDateTime(logEntry.timestamp)}</td>);
return <tr key={row.id}>{tableRow}</tr>; tableRow.push(
<td>
<Link
data-qa="process-instance-show-link"
to={`${processInstanceShowPageBaseUrl}/${logEntry.process_instance_id}/${logEntry.spiff_task_guid}`}
>
{convertSecondsToFormattedDateTime(logEntry.timestamp)}
</Link>
</td>
);
return <tr key={logEntry.id}>{tableRow}</tr>;
}; };
const buildTable = () => { const buildTable = () => {
const rows = processInstanceLogs.map((row) => { const rows = processInstanceLogs.map(
return getTableRow(row); (logEntry: ProcessInstanceLogEntry) => {
}); return getTableRow(logEntry);
}
);
const tableHeaders = []; const tableHeaders = [];
if (isDetailedView) { if (isDetailedView) {

View File

@ -608,7 +608,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
const isCurrentTask = (task: Task) => { const isCurrentTask = (task: Task) => {
const subprocessTypes = [ const subprocessTypes = [
'Subprocess', 'Subprocess',
'Call Activity', 'CallActivity',
'Transactional Subprocess', 'Transactional Subprocess',
]; ];
return ( return (