Merge pull request #172 from sartography/feature/click_on_row
When a row is clicked in a Process Instance list take the end user to…
This commit is contained in:
commit
2382c08820
|
@ -32,7 +32,7 @@ if (process.env.SPIFFWORKFLOW_FRONTEND_URL) {
|
||||||
|
|
||||||
const cypressConfig = {
|
const cypressConfig = {
|
||||||
projectId: 'crax1q',
|
projectId: 'crax1q',
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
videoUploadOnPasses: false,
|
videoUploadOnPasses: false,
|
||||||
chromeWebSecurity: false,
|
chromeWebSecurity: false,
|
||||||
e2e: {
|
e2e: {
|
||||||
|
|
|
@ -158,7 +158,7 @@ describe('process-instances', () => {
|
||||||
// make sure we have some process instances
|
// make sure we have some process instances
|
||||||
cy.runPrimaryBpmnFile();
|
cy.runPrimaryBpmnFile();
|
||||||
cy.getBySel('process-instance-list-link').click();
|
cy.getBySel('process-instance-list-link').click();
|
||||||
cy.getBySel('process-instance-show-link').first().click();
|
cy.getBySel('process-instance-show-link-id').first().click();
|
||||||
cy.getBySel('process-instance-log-list-link').click();
|
cy.getBySel('process-instance-log-list-link').click();
|
||||||
cy.getBySel('process-instance-log-detailed').click();
|
cy.getBySel('process-instance-log-detailed').click();
|
||||||
cy.contains('process_model_one');
|
cy.contains('process_model_one');
|
||||||
|
|
|
@ -168,7 +168,7 @@ describe('process-models', () => {
|
||||||
.click();
|
.click();
|
||||||
cy.runPrimaryBpmnFile();
|
cy.runPrimaryBpmnFile();
|
||||||
|
|
||||||
cy.getBySel('process-instance-show-link').click();
|
cy.getBySel('process-instance-show-link-id').click();
|
||||||
cy.getBySel('process-instance-delete').click();
|
cy.getBySel('process-instance-delete').click();
|
||||||
cy.contains('Are you sure');
|
cy.contains('Are you sure');
|
||||||
cy.getBySel('process-instance-delete-modal-confirmation-dialog')
|
cy.getBySel('process-instance-delete-modal-confirmation-dialog')
|
||||||
|
|
|
@ -74,7 +74,7 @@ describe('tasks', () => {
|
||||||
cy.assertAtLeastOneItemInPaginatedResults();
|
cy.assertAtLeastOneItemInPaginatedResults();
|
||||||
|
|
||||||
// This should get the first one which should be the one we just completed
|
// This should get the first one which should be the one we just completed
|
||||||
cy.getBySel('process-instance-show-link').first().click();
|
cy.getBySel('process-instance-show-link-id').first().click();
|
||||||
cy.contains('Process Instance Id: ');
|
cy.contains('Process Instance Id: ');
|
||||||
|
|
||||||
cy.get(`g[data-element-id=form3]`).click();
|
cy.get(`g[data-element-id=form3]`).click();
|
||||||
|
@ -106,7 +106,7 @@ describe('tasks', () => {
|
||||||
cy.assertAtLeastOneItemInPaginatedResults();
|
cy.assertAtLeastOneItemInPaginatedResults();
|
||||||
|
|
||||||
// This should get the first one which should be the one we just completed
|
// This should get the first one which should be the one we just completed
|
||||||
cy.getBySel('process-instance-show-link').first().click();
|
cy.getBySel('process-instance-show-link-id').first().click();
|
||||||
cy.contains('Process Instance Id: ');
|
cy.contains('Process Instance Id: ');
|
||||||
cy.contains('Status: complete');
|
cy.contains('Status: complete');
|
||||||
});
|
});
|
||||||
|
@ -120,6 +120,6 @@ describe('tasks', () => {
|
||||||
kickOffModelWithForm();
|
kickOffModelWithForm();
|
||||||
|
|
||||||
cy.navigateToHome();
|
cy.navigateToHome();
|
||||||
cy.basicPaginationTest('process-instance-show-link');
|
cy.basicPaginationTest('process-instance-show-link-id');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import {
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
Link,
|
|
||||||
useNavigate,
|
|
||||||
useParams,
|
|
||||||
useSearchParams,
|
|
||||||
} from 'react-router-dom';
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Filter, Close, AddAlt } from '@carbon/icons-react';
|
import { Filter, Close, AddAlt } from '@carbon/icons-react';
|
||||||
|
@ -66,7 +61,6 @@ import ProcessModelSearch from './ProcessModelSearch';
|
||||||
import ProcessInstanceReportSearch from './ProcessInstanceReportSearch';
|
import ProcessInstanceReportSearch from './ProcessInstanceReportSearch';
|
||||||
import ProcessInstanceListDeleteReport from './ProcessInstanceListDeleteReport';
|
import ProcessInstanceListDeleteReport from './ProcessInstanceListDeleteReport';
|
||||||
import ProcessInstanceListSaveAsReport from './ProcessInstanceListSaveAsReport';
|
import ProcessInstanceListSaveAsReport from './ProcessInstanceListSaveAsReport';
|
||||||
import { FormatProcessModelDisplayName } from './MiniComponents';
|
|
||||||
import { Notification } from './Notification';
|
import { Notification } from './Notification';
|
||||||
import useAPIError from '../hooks/UseApiError';
|
import useAPIError from '../hooks/UseApiError';
|
||||||
|
|
||||||
|
@ -1203,28 +1197,13 @@ export default function ProcessInstanceListTable({
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatProcessInstanceId = (row: ProcessInstance, id: number) => {
|
const formatProcessInstanceId = (row: ProcessInstance, id: number) => {
|
||||||
const modifiedProcessModelId: String =
|
return <span data-qa="paginated-entity-id">{id}</span>;
|
||||||
modifyProcessIdentifierForPathParam(row.process_model_identifier);
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
data-qa="process-instance-show-link"
|
|
||||||
to={`${processInstanceShowPathPrefix}/${modifiedProcessModelId}/${id}`}
|
|
||||||
title={`View process instance ${id}`}
|
|
||||||
>
|
|
||||||
<span data-qa="paginated-entity-id">{id}</span>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
const formatProcessModelIdentifier = (_row: any, identifier: any) => {
|
const formatProcessModelIdentifier = (_row: any, identifier: any) => {
|
||||||
return (
|
return <span>{identifier}</span>;
|
||||||
<Link
|
};
|
||||||
to={`/admin/process-models/${modifyProcessIdentifierForPathParam(
|
const formatProcessModelDisplayName = (_row: any, identifier: any) => {
|
||||||
identifier
|
return <span>{identifier}</span>;
|
||||||
)}`}
|
|
||||||
>
|
|
||||||
{identifier}
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatSecondsForDisplay = (_row: any, seconds: any) => {
|
const formatSecondsForDisplay = (_row: any, seconds: any) => {
|
||||||
|
@ -1237,7 +1216,7 @@ export default function ProcessInstanceListTable({
|
||||||
const reportColumnFormatters: Record<string, any> = {
|
const reportColumnFormatters: Record<string, any> = {
|
||||||
id: formatProcessInstanceId,
|
id: formatProcessInstanceId,
|
||||||
process_model_identifier: formatProcessModelIdentifier,
|
process_model_identifier: formatProcessModelIdentifier,
|
||||||
process_model_display_name: FormatProcessModelDisplayName,
|
process_model_display_name: formatProcessModelDisplayName,
|
||||||
start_in_seconds: formatSecondsForDisplay,
|
start_in_seconds: formatSecondsForDisplay,
|
||||||
end_in_seconds: formatSecondsForDisplay,
|
end_in_seconds: formatSecondsForDisplay,
|
||||||
};
|
};
|
||||||
|
@ -1245,21 +1224,66 @@ export default function ProcessInstanceListTable({
|
||||||
const formatter =
|
const formatter =
|
||||||
reportColumnFormatters[column.accessor] ?? defaultFormatter;
|
reportColumnFormatters[column.accessor] ?? defaultFormatter;
|
||||||
const value = row[column.accessor];
|
const value = row[column.accessor];
|
||||||
|
const modifiedModelId = modifyProcessIdentifierForPathParam(
|
||||||
|
row.process_model_identifier
|
||||||
|
);
|
||||||
|
const navigateToProcessInstance = () => {
|
||||||
|
navigate(
|
||||||
|
`${processInstanceShowPathPrefix}/${modifiedModelId}/${row.id}`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const navigateToProcessModel = () => {
|
||||||
|
navigate(`/admin/process-models/${modifiedModelId}`);
|
||||||
|
};
|
||||||
|
|
||||||
if (column.accessor === 'status') {
|
if (column.accessor === 'status') {
|
||||||
return (
|
return (
|
||||||
<td data-qa={`process-instance-status-${value}`}>
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||||
|
<td
|
||||||
|
onClick={navigateToProcessInstance}
|
||||||
|
onKeyDown={navigateToProcessInstance}
|
||||||
|
data-qa={`process-instance-status-${value}`}
|
||||||
|
>
|
||||||
{formatter(row, value)}
|
{formatter(row, value)}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <td>{formatter(row, value)}</td>;
|
console.log(column.accessor);
|
||||||
|
if (column.accessor === 'process_model_display_name') {
|
||||||
|
const pmStyle = { background: 'rgba(0, 0, 0, .02)' };
|
||||||
|
return (
|
||||||
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||||
|
<td
|
||||||
|
style={pmStyle}
|
||||||
|
onClick={navigateToProcessModel}
|
||||||
|
onKeyDown={navigateToProcessModel}
|
||||||
|
>
|
||||||
|
{formatter(row, value)}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||||
|
<td
|
||||||
|
data-qa={`process-instance-show-link-${column.accessor}`}
|
||||||
|
onKeyDown={navigateToProcessModel}
|
||||||
|
onClick={navigateToProcessInstance}
|
||||||
|
>
|
||||||
|
{formatter(row, value)}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const rows = processInstances.map((row: any) => {
|
const rows = processInstances.map((row: any) => {
|
||||||
const currentRow = reportColumns().map((column: any) => {
|
const currentRow = reportColumns().map((column: any) => {
|
||||||
return formattedColumn(row, column);
|
return formattedColumn(row, column);
|
||||||
});
|
});
|
||||||
return <tr key={row.id}>{currentRow}</tr>;
|
const rowStyle = { cursor: 'pointer' };
|
||||||
|
return (
|
||||||
|
<tr style={rowStyle} key={row.id}>
|
||||||
|
{currentRow}
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue