updated log list view in frontend w/ burnettk

This commit is contained in:
jasquat 2023-03-17 10:30:29 -04:00
parent 8dc7c5fb2f
commit 44b166fba8
No known key found for this signature in database
3 changed files with 17 additions and 14 deletions

View File

@ -257,9 +257,13 @@ def process_instance_log_list(
TaskDefinitionModel.typename.in_(["IntermediateThrowEvent"]), # type: ignore
)
)
else:
log_query = log_query.filter(
TaskModel.state.in_(["COMPLETED"]), # type: ignore
)
logs = (
log_query.order_by(TaskModel.end_in_seconds.desc()) # type: ignore
log_query.order_by(TaskModel.end_in_seconds.desc(), TaskModel.id.desc()) # type: ignore
.outerjoin(HumanTaskModel, HumanTaskModel.task_model_id == TaskModel.id)
.outerjoin(UserModel, UserModel.id == HumanTaskModel.completed_by_user_id)
.add_columns(
@ -269,7 +273,7 @@ def process_instance_log_list(
BpmnProcessDefinitionModel.bpmn_name.label("bpmn_process_definition_name"), # type: ignore
TaskDefinitionModel.bpmn_identifier.label("task_definition_identifier"), # type: ignore
TaskDefinitionModel.bpmn_name.label("task_definition_name"), # type: ignore
TaskDefinitionModel.typename.label("bpmn_type"), # type: ignore
TaskDefinitionModel.typename.label("bpmn_task_type"), # type: ignore
)
.paginate(page=page, per_page=per_page, error_out=False)
)

View File

@ -59,7 +59,7 @@ class TestLoggingService(BaseTest):
assert log_response.status_code == 200
assert log_response.json
logs: list = log_response.json["results"]
assert len(logs) == 9
assert len(logs) == 4
for log in logs:
assert log["process_instance_id"] == process_instance.id
@ -71,7 +71,7 @@ class TestLoggingService(BaseTest):
"bpmn_process_definition_name",
"task_definition_identifier",
"task_definition_name",
"bpmn_type",
"bpmn_task_type",
]:
assert key in log.keys()
@ -129,4 +129,4 @@ class TestLoggingService(BaseTest):
for log in logs:
assert log["process_instance_id"] == process_instance.id
assert log["bpmn_type"] == "IntermediateThrowEvent"
assert log["bpmn_task_type"] == "IntermediateThrowEvent"

View File

@ -54,15 +54,16 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
const tableRow = [];
const taskNameCell = (
<td>
{row.bpmn_task_name ||
(row.bpmn_task_type === 'Default Start Event'
? 'Process Started'
: '') ||
(row.bpmn_task_type === 'End Event' ? 'Process Ended' : '')}
{row.task_definition_name ||
(row.bpmn_task_type === 'StartEvent' ? 'Process Started' : '') ||
(row.bpmn_task_type === 'EndEvent' ? 'Process Ended' : '')}
</td>
);
const bpmnProcessCell = (
<td>{row.bpmn_process_name || row.bpmn_process_identifier}</td>
<td>
{row.bpmn_process_definition_name ||
row.bpmn_process_definition_identifier}
</td>
);
if (isDetailedView) {
tableRow.push(
@ -84,7 +85,6 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
tableRow.push(
<>
<td>{row.bpmn_task_type}</td>
<td>{row.message}</td>
<td>
{row.username || (
<span className="system-user-log-entry">system</span>
@ -99,7 +99,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
data-qa="process-instance-show-link"
to={`${processInstanceShowPageBaseUrl}/${row.process_instance_id}/${row.spiff_step}`}
>
{convertSecondsToFormattedDateTime(row.timestamp)}
{convertSecondsToFormattedDateTime(row.end_in_seconds)}
</Link>
</td>
);
@ -132,7 +132,6 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
tableHeaders.push(
<>
<th>Task Type</th>
<th>Message</th>
<th>User</th>
</>
);