mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-12 10:34:17 +00:00
only show task instruction text if process instance is active and display the view button if instance is suspended
This commit is contained in:
parent
122db8b2b2
commit
c06c54f48e
@ -1578,32 +1578,38 @@ export default function ProcessInstanceListTable({
|
|||||||
headers.push('Action');
|
headers.push('Action');
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows = processInstances.map((row: ProcessInstance) => {
|
const rows = processInstances.map((processInstance: ProcessInstance) => {
|
||||||
const currentRow = reportColumns().map((column: ReportColumn) => {
|
const currentRow = reportColumns().map((column: ReportColumn) => {
|
||||||
return formattedColumn(row, column);
|
return formattedColumn(processInstance, column);
|
||||||
});
|
});
|
||||||
if (showActionsColumn) {
|
if (showActionsColumn) {
|
||||||
let buttonElement = null;
|
let buttonElement = null;
|
||||||
const interstitialUrl = `/process/${modifyProcessIdentifierForPathParam(
|
const interstitialUrl = `/process/${modifyProcessIdentifierForPathParam(
|
||||||
row.process_model_identifier
|
processInstance.process_model_identifier
|
||||||
)}/${row.id}/interstitial`;
|
)}/${processInstance.id}/interstitial`;
|
||||||
const regex = new RegExp(`\\b(${preferredUsername}|${userEmail})\\b`);
|
const regex = new RegExp(`\\b(${preferredUsername}|${userEmail})\\b`);
|
||||||
let hasAccessToCompleteTask = false;
|
let hasAccessToCompleteTask = false;
|
||||||
if (
|
if (
|
||||||
canCompleteAllTasks ||
|
canCompleteAllTasks ||
|
||||||
(row.potential_owner_usernames || '').match(regex)
|
(processInstance.potential_owner_usernames || '').match(regex)
|
||||||
) {
|
) {
|
||||||
hasAccessToCompleteTask = true;
|
hasAccessToCompleteTask = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonElement = (
|
let buttonText = 'View';
|
||||||
<Button
|
let buttonKind = 'ghost';
|
||||||
kind={
|
if (
|
||||||
hasAccessToCompleteTask && row.task_id ? 'secondary' : 'ghost'
|
processInstance.status !== 'suspended' &&
|
||||||
|
hasAccessToCompleteTask &&
|
||||||
|
processInstance.task_id
|
||||||
|
) {
|
||||||
|
buttonText = 'Go';
|
||||||
|
buttonKind = 'secondary';
|
||||||
}
|
}
|
||||||
href={interstitialUrl}
|
|
||||||
>
|
buttonElement = (
|
||||||
{hasAccessToCompleteTask && row.task_id ? 'Go' : 'View'}
|
<Button kind={buttonKind} href={interstitialUrl}>
|
||||||
|
{buttonText}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
currentRow.push(<td>{buttonElement}</td>);
|
currentRow.push(<td>{buttonElement}</td>);
|
||||||
@ -1611,18 +1617,18 @@ export default function ProcessInstanceListTable({
|
|||||||
|
|
||||||
const rowStyle = { cursor: 'pointer' };
|
const rowStyle = { cursor: 'pointer' };
|
||||||
const modifiedModelId = modifyProcessIdentifierForPathParam(
|
const modifiedModelId = modifyProcessIdentifierForPathParam(
|
||||||
row.process_model_identifier
|
processInstance.process_model_identifier
|
||||||
);
|
);
|
||||||
const navigateToProcessInstance = () => {
|
const navigateToProcessInstance = () => {
|
||||||
navigate(
|
navigate(
|
||||||
`${processInstanceShowPathPrefix}/${modifiedModelId}/${row.id}`
|
`${processInstanceShowPathPrefix}/${modifiedModelId}/${processInstance.id}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||||
<tr
|
<tr
|
||||||
style={rowStyle}
|
style={rowStyle}
|
||||||
key={row.id}
|
key={processInstance.id}
|
||||||
onClick={navigateToProcessInstance}
|
onClick={navigateToProcessInstance}
|
||||||
onKeyDown={navigateToProcessInstance}
|
onKeyDown={navigateToProcessInstance}
|
||||||
>
|
>
|
||||||
|
@ -147,6 +147,7 @@ export default function ProcessInterstitial() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const userMessage = (myTask: ProcessInstanceTask) => {
|
const userMessage = (myTask: ProcessInstanceTask) => {
|
||||||
|
if (!processInstance || processInstance.status === 'completed') {
|
||||||
if (!myTask.can_complete && userTasks.includes(myTask.type)) {
|
if (!myTask.can_complete && userTasks.includes(myTask.type)) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -164,6 +165,7 @@ export default function ProcessInterstitial() {
|
|||||||
if (myTask.error_message) {
|
if (myTask.error_message) {
|
||||||
return <div>{myTask.error_message}</div>;
|
return <div>{myTask.error_message}</div>;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let message =
|
let message =
|
||||||
'There are no additional instructions or information for this task.';
|
'There are no additional instructions or information for this task.';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user