use process model display name rather than id for completed instances tab

This commit is contained in:
burnettk 2022-11-25 00:30:01 -05:00
parent 069f717ee7
commit 6fc2a66949
1 changed files with 23 additions and 2 deletions

View File

@ -47,6 +47,7 @@ import {
PaginationObject, PaginationObject,
ProcessModel, ProcessModel,
ProcessInstanceReport, ProcessInstanceReport,
ProcessInstance,
} from '../interfaces'; } from '../interfaces';
import ProcessModelSearch from './ProcessModelSearch'; import ProcessModelSearch from './ProcessModelSearch';
import ProcessInstanceReportSearch from './ProcessInstanceReportSearch'; import ProcessInstanceReportSearch from './ProcessInstanceReportSearch';
@ -609,6 +610,7 @@ export default function ProcessInstanceListTable({
const headerLabels: Record<string, string> = { const headerLabels: Record<string, string> = {
id: 'Id', id: 'Id',
process_model_identifier: 'Process', process_model_identifier: 'Process',
process_model_display_name: 'Process',
start_in_seconds: 'Start Time', start_in_seconds: 'Start Time',
end_in_seconds: 'End Time', end_in_seconds: 'End Time',
status: 'Status', status: 'Status',
@ -622,13 +624,14 @@ export default function ProcessInstanceListTable({
return getHeaderLabel((column as any).Header); return getHeaderLabel((column as any).Header);
}); });
const formatProcessInstanceId = (row: any, id: any) => { const formatProcessInstanceId = (row: ProcessInstance, id: number) => {
const modifiedProcessModelId: String = const modifiedProcessModelId: String =
modifyProcessIdentifierForPathParam(row.process_model_identifier); modifyProcessIdentifierForPathParam(row.process_model_identifier);
return ( return (
<Link <Link
data-qa="process-instance-show-link" data-qa="process-instance-show-link"
to={`/admin/process-models/${modifiedProcessModelId}/process-instances/${row.id}`} to={`/admin/process-models/${modifiedProcessModelId}/process-instances/${id}`}
title={`View process instance ${id}`}
> >
{id} {id}
</Link> </Link>
@ -645,6 +648,23 @@ export default function ProcessInstanceListTable({
</Link> </Link>
); );
}; };
const formatProcessModelDisplayName = (
row: ProcessInstance,
displayName: string
) => {
return (
<Link
to={`/admin/process-models/${modifyProcessIdentifierForPathParam(
row.process_model_identifier
)}`}
title={row.process_model_identifier}
>
{displayName}
</Link>
);
};
const formatSecondsForDisplay = (_row: any, seconds: any) => { const formatSecondsForDisplay = (_row: any, seconds: any) => {
return convertSecondsToFormattedDateTime(seconds) || '-'; return convertSecondsToFormattedDateTime(seconds) || '-';
}; };
@ -655,6 +675,7 @@ export default function ProcessInstanceListTable({
const columnFormatters: Record<string, any> = { const columnFormatters: Record<string, any> = {
id: formatProcessInstanceId, id: formatProcessInstanceId,
process_model_identifier: formatProcessModelIdentifier, process_model_identifier: formatProcessModelIdentifier,
process_model_display_name: formatProcessModelDisplayName,
start_in_seconds: formatSecondsForDisplay, start_in_seconds: formatSecondsForDisplay,
end_in_seconds: formatSecondsForDisplay, end_in_seconds: formatSecondsForDisplay,
}; };