added typeahead search for bpmn name and identifier in process instance event list w/ burnettk
This commit is contained in:
parent
3a3d5a86fc
commit
9aa9fe913b
|
@ -1999,10 +1999,10 @@ paths:
|
||||||
description: The number of items to show per page. Defaults to page 10.
|
description: The number of items to show per page. Defaults to page 10.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
- name: detailed
|
- name: events
|
||||||
in: query
|
in: query
|
||||||
required: false
|
required: false
|
||||||
description: Show the detailed view, which includes all log entries
|
description: Show the events view, which includes all log entries
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
- name: bpmn_name
|
- name: bpmn_name
|
||||||
|
@ -2042,11 +2042,30 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/ProcessInstanceLog"
|
$ref: "#/components/schemas/ProcessInstanceLog"
|
||||||
|
|
||||||
/logs/types:
|
/logs/typeahead-filter-values/{modified_process_model_identifier}/{process_instance_id}:
|
||||||
|
parameters:
|
||||||
|
- name: process_instance_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: the id of the process instance
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- name: modified_process_model_identifier
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The process_model_id, modified to replace slashes (/)
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: task_type
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
description: The task type of the typehead filter values to get.
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Process Instance Events
|
- Process Instance Events
|
||||||
operationId: spiffworkflow_backend.routes.process_instance_events_controller.types
|
operationId: spiffworkflow_backend.routes.process_instance_events_controller.typeahead_filter_values
|
||||||
summary: returns a list of task types and event typs. useful for building log queries.
|
summary: returns a list of task types and event typs. useful for building log queries.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
@ -2079,7 +2098,7 @@ paths:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Process Instance Events
|
- Process Instance Events
|
||||||
operationId: spiffworkflow_backend.routes.process_instance_events_controller.error_details
|
operationId: spiffworkflow_backend.routes.process_instance_events_controller.error_detail_show
|
||||||
summary: returns the error details for a given process instance event.
|
summary: returns the error details for a given process instance event.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
@ -2206,12 +2225,12 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Secret"
|
$ref: "#/components/schemas/Secret"
|
||||||
|
|
||||||
/connector-proxy/type-ahead/{category}:
|
/connector-proxy/typeahead/{category}:
|
||||||
parameters:
|
parameters:
|
||||||
- name: category
|
- name: category
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The category for the type-ahead search
|
description: The category for the typeahead search
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
- name: prefix
|
- name: prefix
|
||||||
|
@ -2227,7 +2246,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
get:
|
get:
|
||||||
operationId: spiffworkflow_backend.routes.connector_proxy_controller.type_ahead
|
operationId: spiffworkflow_backend.routes.connector_proxy_controller.typeahead
|
||||||
summary: Return type ahead search results
|
summary: Return type ahead search results
|
||||||
tags:
|
tags:
|
||||||
- Type Ahead
|
- Type Ahead
|
||||||
|
|
|
@ -6,13 +6,13 @@ from flask import current_app
|
||||||
from flask.wrappers import Response
|
from flask.wrappers import Response
|
||||||
|
|
||||||
|
|
||||||
def connector_proxy_type_ahead_url() -> Any:
|
def connector_proxy_typeahead_url() -> Any:
|
||||||
"""Returns the connector proxy type ahead url."""
|
"""Returns the connector proxy type ahead url."""
|
||||||
return current_app.config["SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_TYPE_AHEAD_URL"]
|
return current_app.config["SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_TYPE_AHEAD_URL"]
|
||||||
|
|
||||||
|
|
||||||
def type_ahead(category: str, prefix: str, limit: int) -> flask.wrappers.Response:
|
def typeahead(category: str, prefix: str, limit: int) -> flask.wrappers.Response:
|
||||||
url = f"{connector_proxy_type_ahead_url()}/v1/type-ahead/{category}?prefix={prefix}&limit={limit}"
|
url = f"{connector_proxy_typeahead_url()}/v1/type-ahead/{category}?prefix={prefix}&limit={limit}"
|
||||||
|
|
||||||
proxy_response = requests.get(url)
|
proxy_response = requests.get(url)
|
||||||
status = proxy_response.status_code
|
status = proxy_response.status_code
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from typing import Set
|
||||||
|
|
||||||
import flask.wrappers
|
import flask.wrappers
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
@ -23,7 +24,7 @@ def log_list(
|
||||||
process_instance_id: int,
|
process_instance_id: int,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
per_page: int = 100,
|
per_page: int = 100,
|
||||||
detailed: bool = False,
|
events: bool = False,
|
||||||
bpmn_name: Optional[str] = None,
|
bpmn_name: Optional[str] = None,
|
||||||
bpmn_identifier: Optional[str] = None,
|
bpmn_identifier: Optional[str] = None,
|
||||||
task_type: Optional[str] = None,
|
task_type: Optional[str] = None,
|
||||||
|
@ -41,7 +42,7 @@ def log_list(
|
||||||
BpmnProcessDefinitionModel.id == TaskDefinitionModel.bpmn_process_definition_id,
|
BpmnProcessDefinitionModel.id == TaskDefinitionModel.bpmn_process_definition_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if not detailed:
|
if not events:
|
||||||
log_query = log_query.filter(
|
log_query = log_query.filter(
|
||||||
and_(
|
and_(
|
||||||
TaskModel.state.in_(["COMPLETED"]), # type: ignore
|
TaskModel.state.in_(["COMPLETED"]), # type: ignore
|
||||||
|
@ -87,14 +88,48 @@ def log_list(
|
||||||
return make_response(jsonify(response_json), 200)
|
return make_response(jsonify(response_json), 200)
|
||||||
|
|
||||||
|
|
||||||
def types() -> flask.wrappers.Response:
|
def typeahead_filter_values(
|
||||||
|
modified_process_model_identifier: str,
|
||||||
|
process_instance_id: int,
|
||||||
|
task_type: Optional[str] = None,
|
||||||
|
) -> flask.wrappers.Response:
|
||||||
|
process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
|
||||||
query = db.session.query(TaskDefinitionModel.typename).distinct() # type: ignore
|
query = db.session.query(TaskDefinitionModel.typename).distinct() # type: ignore
|
||||||
task_types = [t.typename for t in query]
|
task_types = [t.typename for t in query]
|
||||||
event_types = ProcessInstanceEventType.list()
|
event_types = ProcessInstanceEventType.list()
|
||||||
return make_response(jsonify({"task_types": task_types, "event_types": event_types}), 200)
|
task_definition_query = (
|
||||||
|
db.session.query(TaskDefinitionModel.bpmn_identifier, TaskDefinitionModel.bpmn_name)
|
||||||
|
.distinct(TaskDefinitionModel.bpmn_identifier, TaskDefinitionModel.bpmn_name) # type: ignore
|
||||||
|
.join(TaskModel, TaskModel.task_definition_id == TaskDefinitionModel.id)
|
||||||
|
.join(ProcessInstanceEventModel, ProcessInstanceEventModel.task_guid == TaskModel.guid)
|
||||||
|
.filter(TaskModel.process_instance_id == process_instance.id)
|
||||||
|
)
|
||||||
|
if task_type is not None:
|
||||||
|
task_definition_query = task_definition_query.filter(TaskDefinitionModel.typename == task_type)
|
||||||
|
task_definitions = task_definition_query.all()
|
||||||
|
|
||||||
|
task_bpmn_names: Set[str] = set()
|
||||||
|
task_bpmn_identifiers: Set[str] = set()
|
||||||
|
for task_definition in task_definitions:
|
||||||
|
# not checking for None so we also exclude empty strings
|
||||||
|
if task_definition.bpmn_name:
|
||||||
|
task_bpmn_names.add(task_definition.bpmn_name)
|
||||||
|
task_bpmn_identifiers.add(task_definition.bpmn_identifier)
|
||||||
|
|
||||||
|
return make_response(
|
||||||
|
jsonify(
|
||||||
|
{
|
||||||
|
"task_types": task_types,
|
||||||
|
"event_types": event_types,
|
||||||
|
"task_bpmn_names": list(task_bpmn_names),
|
||||||
|
"task_bpmn_identifiers": list(task_bpmn_identifiers),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
200,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def error_details(
|
def error_detail_show(
|
||||||
modified_process_model_identifier: str,
|
modified_process_model_identifier: str,
|
||||||
process_instance_id: int,
|
process_instance_id: int,
|
||||||
process_instance_event_id: int,
|
process_instance_event_id: int,
|
||||||
|
|
|
@ -75,6 +75,7 @@ class PermissionToAssign:
|
||||||
PATH_SEGMENTS_FOR_PERMISSION_ALL = [
|
PATH_SEGMENTS_FOR_PERMISSION_ALL = [
|
||||||
{"path": "/event-error-details", "relevant_permissions": ["read"]},
|
{"path": "/event-error-details", "relevant_permissions": ["read"]},
|
||||||
{"path": "/logs", "relevant_permissions": ["read"]},
|
{"path": "/logs", "relevant_permissions": ["read"]},
|
||||||
|
{"path": "/logs/typeahead-filter-values", "relevant_permissions": ["read"]},
|
||||||
{
|
{
|
||||||
"path": "/process-instances",
|
"path": "/process-instances",
|
||||||
"relevant_permissions": ["create", "read", "delete"],
|
"relevant_permissions": ["create", "read", "delete"],
|
||||||
|
@ -546,6 +547,7 @@ class AuthorizationService:
|
||||||
for target_uri in [
|
for target_uri in [
|
||||||
f"/process-instances/for-me/{process_related_path_segment}",
|
f"/process-instances/for-me/{process_related_path_segment}",
|
||||||
f"/logs/{process_related_path_segment}",
|
f"/logs/{process_related_path_segment}",
|
||||||
|
f"/logs/typeahead-filter-values/{process_related_path_segment}",
|
||||||
f"/process-data-file-download/{process_related_path_segment}",
|
f"/process-data-file-download/{process_related_path_segment}",
|
||||||
f"/event-error-details/{process_related_path_segment}",
|
f"/event-error-details/{process_related_path_segment}",
|
||||||
]:
|
]:
|
||||||
|
@ -572,7 +574,6 @@ class AuthorizationService:
|
||||||
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/processes"))
|
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/processes"))
|
||||||
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/service-tasks"))
|
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/service-tasks"))
|
||||||
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/user-groups/for-current-user"))
|
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/user-groups/for-current-user"))
|
||||||
permissions_to_assign.append(PermissionToAssign(permission="read", target_uri="/logs/types"))
|
|
||||||
permissions_to_assign.append(PermissionToAssign(permission="create", target_uri="/users/exists/by-username"))
|
permissions_to_assign.append(PermissionToAssign(permission="create", target_uri="/users/exists/by-username"))
|
||||||
permissions_to_assign.append(
|
permissions_to_assign.append(
|
||||||
PermissionToAssign(permission="read", target_uri="/process-instances/find-by-id/*")
|
PermissionToAssign(permission="read", target_uri="/process-instances/find-by-id/*")
|
||||||
|
|
|
@ -53,7 +53,7 @@ class TestLoggingService(BaseTest):
|
||||||
|
|
||||||
headers = self.logged_in_headers(with_super_admin_user)
|
headers = self.logged_in_headers(with_super_admin_user)
|
||||||
log_response = client.get(
|
log_response = client.get(
|
||||||
f"/v1.0/logs/{self.modify_process_identifier_for_path_param(process_model.id)}/{process_instance.id}?detailed=true",
|
f"/v1.0/logs/{self.modify_process_identifier_for_path_param(process_model.id)}/{process_instance.id}?events=true",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
assert log_response.status_code == 200
|
assert log_response.status_code == 200
|
||||||
|
|
|
@ -46,6 +46,11 @@ class TestGetAllPermissions(BaseTest):
|
||||||
"uri": "/logs/hey:group:*",
|
"uri": "/logs/hey:group:*",
|
||||||
"permissions": ["read"],
|
"permissions": ["read"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"group_identifier": "my_test_group",
|
||||||
|
"uri": "/logs/typeahead-filter-values/hey:group:*",
|
||||||
|
"permissions": ["read"],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"group_identifier": "my_test_group",
|
"group_identifier": "my_test_group",
|
||||||
"uri": "/process-instances/hey:group:*",
|
"uri": "/process-instances/hey:group:*",
|
||||||
|
|
|
@ -126,6 +126,7 @@ class TestAuthorizationService(BaseTest):
|
||||||
[
|
[
|
||||||
("/event-error-details/some-process-group:some-process-model:*", "read"),
|
("/event-error-details/some-process-group:some-process-model:*", "read"),
|
||||||
("/logs/some-process-group:some-process-model:*", "read"),
|
("/logs/some-process-group:some-process-model:*", "read"),
|
||||||
|
("/logs/typeahead-filter-values/some-process-group:some-process-model:*", "read"),
|
||||||
("/process-data/some-process-group:some-process-model:*", "read"),
|
("/process-data/some-process-group:some-process-model:*", "read"),
|
||||||
(
|
(
|
||||||
"/process-data-file-download/some-process-group:some-process-model:*",
|
"/process-data-file-download/some-process-group:some-process-model:*",
|
||||||
|
@ -179,6 +180,10 @@ class TestAuthorizationService(BaseTest):
|
||||||
"/logs/some-process-group:some-process-model:*",
|
"/logs/some-process-group:some-process-model:*",
|
||||||
"read",
|
"read",
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"/logs/typeahead-filter-values/some-process-group:some-process-model:*",
|
||||||
|
"read",
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"/process-data-file-download/some-process-group:some-process-model:*",
|
"/process-data-file-download/some-process-group:some-process-model:*",
|
||||||
"read",
|
"read",
|
||||||
|
@ -210,6 +215,7 @@ class TestAuthorizationService(BaseTest):
|
||||||
"/process-data-file-download/some-process-group:some-process-model/*",
|
"/process-data-file-download/some-process-group:some-process-model/*",
|
||||||
"read",
|
"read",
|
||||||
),
|
),
|
||||||
|
("/logs/typeahead-filter-values/some-process-group:some-process-model/*", "read"),
|
||||||
("/process-data/some-process-group:some-process-model/*", "read"),
|
("/process-data/some-process-group:some-process-model/*", "read"),
|
||||||
(
|
(
|
||||||
"/process-instance-suspend/some-process-group:some-process-model/*",
|
"/process-instance-suspend/some-process-group:some-process-model/*",
|
||||||
|
@ -258,6 +264,7 @@ class TestAuthorizationService(BaseTest):
|
||||||
"/logs/some-process-group:some-process-model/*",
|
"/logs/some-process-group:some-process-model/*",
|
||||||
"read",
|
"read",
|
||||||
),
|
),
|
||||||
|
("/logs/typeahead-filter-values/some-process-group:some-process-model/*", "read"),
|
||||||
(
|
(
|
||||||
"/process-data-file-download/some-process-group:some-process-model/*",
|
"/process-data-file-download/some-process-group:some-process-model/*",
|
||||||
"read",
|
"read",
|
||||||
|
@ -282,7 +289,6 @@ class TestAuthorizationService(BaseTest):
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test_explode_permissions_basic."""
|
"""Test_explode_permissions_basic."""
|
||||||
expected_permissions = [
|
expected_permissions = [
|
||||||
("/logs/types", "read"),
|
|
||||||
("/process-instances/find-by-id/*", "read"),
|
("/process-instances/find-by-id/*", "read"),
|
||||||
("/process-instances/for-me", "read"),
|
("/process-instances/for-me", "read"),
|
||||||
("/process-instances/reports/*", "create"),
|
("/process-instances/reports/*", "create"),
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
FormLabel,
|
FormLabel,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
} from '@carbon/react';
|
} from '@carbon/react';
|
||||||
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
import {
|
import {
|
||||||
PROCESS_STATUSES,
|
PROCESS_STATUSES,
|
||||||
DATE_FORMAT_CARBON,
|
DATE_FORMAT_CARBON,
|
||||||
|
@ -247,6 +248,14 @@ export default function ProcessInstanceListTable({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addDebouncedSearchProcessInitiator = useDebouncedCallback(
|
||||||
|
(value: string) => {
|
||||||
|
searchForProcessInitiator(value);
|
||||||
|
},
|
||||||
|
// delay in ms
|
||||||
|
250
|
||||||
|
);
|
||||||
|
|
||||||
const parametersToGetFromSearchParams = useMemo(() => {
|
const parametersToGetFromSearchParams = useMemo(() => {
|
||||||
const figureOutProcessInitiator = (processInitiatorSearchText: string) => {
|
const figureOutProcessInitiator = (processInitiatorSearchText: string) => {
|
||||||
searchForProcessInitiator(processInitiatorSearchText);
|
searchForProcessInitiator(processInitiatorSearchText);
|
||||||
|
@ -1179,7 +1188,7 @@ export default function ProcessInstanceListTable({
|
||||||
if (hasAccess) {
|
if (hasAccess) {
|
||||||
return (
|
return (
|
||||||
<ComboBox
|
<ComboBox
|
||||||
onInputChange={searchForProcessInitiator}
|
onInputChange={addDebouncedSearchProcessInitiator}
|
||||||
onChange={(event: any) => {
|
onChange={(event: any) => {
|
||||||
setProcessInitiatorSelection(event.selectedItem);
|
setProcessInitiatorSelection(event.selectedItem);
|
||||||
setRequiresRefilter(true);
|
setRequiresRefilter(true);
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ButtonSet,
|
ButtonSet,
|
||||||
Button,
|
Button,
|
||||||
TextInput,
|
|
||||||
ComboBox,
|
ComboBox,
|
||||||
Modal,
|
Modal,
|
||||||
Loading,
|
Loading,
|
||||||
|
@ -21,7 +20,6 @@ import {
|
||||||
useParams,
|
useParams,
|
||||||
useSearchParams,
|
useSearchParams,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
|
||||||
import PaginationForTable from '../components/PaginationForTable';
|
import PaginationForTable from '../components/PaginationForTable';
|
||||||
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
||||||
import {
|
import {
|
||||||
|
@ -54,11 +52,10 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
const [processInstanceLogs, setProcessInstanceLogs] = useState([]);
|
const [processInstanceLogs, setProcessInstanceLogs] = useState([]);
|
||||||
const [pagination, setPagination] = useState(null);
|
const [pagination, setPagination] = useState(null);
|
||||||
|
|
||||||
const [taskName, setTaskName] = useState<string>('');
|
|
||||||
const [taskIdentifier, setTaskIdentifier] = useState<string>('');
|
|
||||||
|
|
||||||
const [taskTypes, setTaskTypes] = useState<string[]>([]);
|
const [taskTypes, setTaskTypes] = useState<string[]>([]);
|
||||||
const [eventTypes, setEventTypes] = useState<string[]>([]);
|
const [eventTypes, setEventTypes] = useState<string[]>([]);
|
||||||
|
const [taskBpmnNames, setTaskBpmnNames] = useState<string[]>([]);
|
||||||
|
const [taskBpmnIdentifiers, setTaskBpmnIdentifiers] = useState<string[]>([]);
|
||||||
|
|
||||||
const [eventForModal, setEventForModal] =
|
const [eventForModal, setEventForModal] =
|
||||||
useState<ProcessInstanceLogEntry | null>(null);
|
useState<ProcessInstanceLogEntry | null>(null);
|
||||||
|
@ -84,8 +81,8 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
if (variant === 'all') {
|
if (variant === 'all') {
|
||||||
processInstanceShowPageBaseUrl = `/admin/process-instances/${params.process_model_id}`;
|
processInstanceShowPageBaseUrl = `/admin/process-instances/${params.process_model_id}`;
|
||||||
}
|
}
|
||||||
const isDetailedView = searchParams.get('detailed') === 'true';
|
const isEventsView = searchParams.get('events') === 'true';
|
||||||
const taskNameHeader = isDetailedView ? 'Task Name' : 'Milestone';
|
const taskNameHeader = isEventsView ? 'Task Name' : 'Milestone';
|
||||||
|
|
||||||
const updateSearchParams = (value: string, key: string) => {
|
const updateSearchParams = (value: string, key: string) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -96,14 +93,6 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addDebouncedSearchParams = useDebouncedCallback(
|
|
||||||
(value: string, key: string) => {
|
|
||||||
updateSearchParams(value, key);
|
|
||||||
},
|
|
||||||
// delay in ms
|
|
||||||
1000
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Clear out any previous results to avoid a "flicker" effect where columns
|
// Clear out any previous results to avoid a "flicker" effect where columns
|
||||||
// are updated above the incorrect data.
|
// are updated above the incorrect data.
|
||||||
|
@ -116,7 +105,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchParamsToInclude = [
|
const searchParamsToInclude = [
|
||||||
'detailed',
|
'events',
|
||||||
'page',
|
'page',
|
||||||
'per_page',
|
'per_page',
|
||||||
'bpmn_name',
|
'bpmn_name',
|
||||||
|
@ -129,31 +118,31 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
searchParamsToInclude
|
searchParamsToInclude
|
||||||
);
|
);
|
||||||
|
|
||||||
if ('bpmn_name' in pickedSearchParams) {
|
|
||||||
setTaskName(pickedSearchParams.bpmn_name);
|
|
||||||
}
|
|
||||||
if ('bpmn_identifier' in pickedSearchParams) {
|
|
||||||
setTaskIdentifier(pickedSearchParams.bpmn_identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `${targetUris.processInstanceLogListPath}?${createSearchParams(
|
path: `${targetUris.processInstanceLogListPath}?${createSearchParams(
|
||||||
pickedSearchParams
|
pickedSearchParams
|
||||||
)}`,
|
)}`,
|
||||||
successCallback: setProcessInstanceLogListFromResult,
|
successCallback: setProcessInstanceLogListFromResult,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let typeaheadQueryParamString = '';
|
||||||
|
if (!isEventsView) {
|
||||||
|
typeaheadQueryParamString = '?task_type=IntermediateThrowEvent';
|
||||||
|
}
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/v1.0/logs/types`,
|
path: `/v1.0/logs/typeahead-filter-values/${params.process_model_id}/${params.process_instance_id}${typeaheadQueryParamString}`,
|
||||||
successCallback: (result: any) => {
|
successCallback: (result: any) => {
|
||||||
setTaskTypes(result.task_types);
|
setTaskTypes(result.task_types);
|
||||||
setEventTypes(result.event_types);
|
setEventTypes(result.event_types);
|
||||||
|
setTaskBpmnNames(result.task_bpmn_names);
|
||||||
|
setTaskBpmnIdentifiers(result.task_bpmn_identifiers);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
searchParams,
|
searchParams,
|
||||||
params,
|
params,
|
||||||
targetUris.processInstanceLogListPath,
|
targetUris.processInstanceLogListPath,
|
||||||
isDetailedView,
|
isEventsView,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleErrorEventModalClose = () => {
|
const handleErrorEventModalClose = () => {
|
||||||
|
@ -251,20 +240,14 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
|
|
||||||
const getTableRow = (logEntry: ProcessInstanceLogEntry) => {
|
const getTableRow = (logEntry: ProcessInstanceLogEntry) => {
|
||||||
const tableRow = [];
|
const tableRow = [];
|
||||||
const taskNameCell = (
|
const taskNameCell = <td>{logEntry.task_definition_name}</td>;
|
||||||
<td>
|
|
||||||
{logEntry.task_definition_name ||
|
|
||||||
(logEntry.bpmn_task_type === 'StartEvent' ? 'Process Started' : '') ||
|
|
||||||
(logEntry.bpmn_task_type === 'EndEvent' ? 'Process Ended' : '')}
|
|
||||||
</td>
|
|
||||||
);
|
|
||||||
const bpmnProcessCell = (
|
const bpmnProcessCell = (
|
||||||
<td>
|
<td>
|
||||||
{logEntry.bpmn_process_definition_name ||
|
{logEntry.bpmn_process_definition_name ||
|
||||||
logEntry.bpmn_process_definition_identifier}
|
logEntry.bpmn_process_definition_identifier}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
if (isDetailedView) {
|
if (isEventsView) {
|
||||||
tableRow.push(
|
tableRow.push(
|
||||||
<>
|
<>
|
||||||
<td data-qa="paginated-entity-id">{logEntry.id}</td>
|
<td data-qa="paginated-entity-id">{logEntry.id}</td>
|
||||||
|
@ -280,7 +263,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isDetailedView) {
|
if (isEventsView) {
|
||||||
tableRow.push(
|
tableRow.push(
|
||||||
<>
|
<>
|
||||||
<td>{logEntry.task_definition_identifier}</td>
|
<td>{logEntry.task_definition_identifier}</td>
|
||||||
|
@ -324,7 +307,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableHeaders = [];
|
const tableHeaders = [];
|
||||||
if (isDetailedView) {
|
if (isEventsView) {
|
||||||
tableHeaders.push(
|
tableHeaders.push(
|
||||||
<>
|
<>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
|
@ -340,7 +323,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isDetailedView) {
|
if (isEventsView) {
|
||||||
tableHeaders.push(
|
tableHeaders.push(
|
||||||
<>
|
<>
|
||||||
<th>Task Identifier</th>
|
<th>Task Identifier</th>
|
||||||
|
@ -362,13 +345,13 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilters = () => {
|
const resetFilters = () => {
|
||||||
setTaskIdentifier('');
|
|
||||||
setTaskName('');
|
|
||||||
|
|
||||||
['bpmn_name', 'bpmn_identifier', 'task_type', 'event_type'].forEach(
|
['bpmn_name', 'bpmn_identifier', 'task_type', 'event_type'].forEach(
|
||||||
(value: string) => searchParams.delete(value)
|
(value: string) => searchParams.delete(value)
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetFiltersAndRun = () => {
|
||||||
|
resetFilters();
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -391,34 +374,48 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterElements = [];
|
const filterElements = [];
|
||||||
|
let taskNameFilterPlaceholder = 'Choose a milestone';
|
||||||
|
if (isEventsView) {
|
||||||
|
taskNameFilterPlaceholder = 'Choose a task bpmn name';
|
||||||
|
}
|
||||||
filterElements.push(
|
filterElements.push(
|
||||||
<Column md={4}>
|
<Column md={4}>
|
||||||
<TextInput
|
<ComboBox
|
||||||
id="task-name-filter"
|
onChange={(value: any) => {
|
||||||
labelText={taskNameHeader}
|
updateSearchParams(value.selectedItem, 'bpmn_name');
|
||||||
value={taskName}
|
|
||||||
onChange={(event: any) => {
|
|
||||||
const newValue = event.target.value;
|
|
||||||
setTaskName(newValue);
|
|
||||||
addDebouncedSearchParams(newValue, 'bpmn_name');
|
|
||||||
}}
|
}}
|
||||||
|
id="task-name-filter"
|
||||||
|
data-qa="task-type-select"
|
||||||
|
items={taskBpmnNames}
|
||||||
|
itemToString={(value: string) => {
|
||||||
|
return value;
|
||||||
|
}}
|
||||||
|
shouldFilterItem={shouldFilterStringItem}
|
||||||
|
placeholder={taskNameFilterPlaceholder}
|
||||||
|
titleText={taskNameHeader}
|
||||||
|
selectedItem={searchParams.get('bpmn_name')}
|
||||||
/>
|
/>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isDetailedView) {
|
if (isEventsView) {
|
||||||
filterElements.push(
|
filterElements.push(
|
||||||
<>
|
<>
|
||||||
<Column md={4}>
|
<Column md={4}>
|
||||||
<TextInput
|
<ComboBox
|
||||||
id="task-identifier-filter"
|
onChange={(value: any) => {
|
||||||
labelText="Task Identifier"
|
updateSearchParams(value.selectedItem, 'bpmn_identifier');
|
||||||
value={taskIdentifier}
|
|
||||||
onChange={(event: any) => {
|
|
||||||
const newValue = event.target.value;
|
|
||||||
setTaskIdentifier(newValue);
|
|
||||||
addDebouncedSearchParams(newValue, 'bpmn_identifier');
|
|
||||||
}}
|
}}
|
||||||
|
id="task-identifier-filter"
|
||||||
|
data-qa="task-type-select"
|
||||||
|
items={taskBpmnIdentifiers}
|
||||||
|
itemToString={(value: string) => {
|
||||||
|
return value;
|
||||||
|
}}
|
||||||
|
shouldFilterItem={shouldFilterStringItem}
|
||||||
|
placeholder="Choose a task bpmn identifier"
|
||||||
|
titleText="Task Identifier"
|
||||||
|
selectedItem={searchParams.get('bpmn_identifier')}
|
||||||
/>
|
/>
|
||||||
</Column>
|
</Column>
|
||||||
<Column md={4}>
|
<Column md={4}>
|
||||||
|
@ -470,7 +467,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
<Button
|
<Button
|
||||||
kind=""
|
kind=""
|
||||||
className="button-white-background narrow-button"
|
className="button-white-background narrow-button"
|
||||||
onClick={resetFilters}
|
onClick={resetFiltersAndRun}
|
||||||
>
|
>
|
||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -491,7 +488,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const tabs = () => {
|
const tabs = () => {
|
||||||
const selectedTabIndex = isDetailedView ? 1 : 0;
|
const selectedTabIndex = isEventsView ? 1 : 0;
|
||||||
return (
|
return (
|
||||||
<Tabs selectedIndex={selectedTabIndex}>
|
<Tabs selectedIndex={selectedTabIndex}>
|
||||||
<TabList aria-label="List of tabs">
|
<TabList aria-label="List of tabs">
|
||||||
|
@ -499,7 +496,8 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
title="Only show a subset of the logs, and show fewer columns"
|
title="Only show a subset of the logs, and show fewer columns"
|
||||||
data-qa="process-instance-log-simple"
|
data-qa="process-instance-log-simple"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
searchParams.set('detailed', 'false');
|
resetFilters();
|
||||||
|
searchParams.set('events', 'false');
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -507,9 +505,10 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab
|
<Tab
|
||||||
title="Show all logs for this process instance, and show extra columns that may be useful for debugging"
|
title="Show all logs for this process instance, and show extra columns that may be useful for debugging"
|
||||||
data-qa="process-instance-log-detailed"
|
data-qa="process-instance-log-events"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
searchParams.set('detailed', 'true');
|
resetFilters();
|
||||||
|
searchParams.set('events', 'true');
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
@ -33,7 +33,7 @@ function TypeAheadWidget({
|
||||||
options: any;
|
options: any;
|
||||||
}) {
|
}) {
|
||||||
const pathForCategory = (inputText: string) => {
|
const pathForCategory = (inputText: string) => {
|
||||||
return `/connector-proxy/type-ahead/${category}?prefix=${inputText}&limit=100`;
|
return `/connector-proxy/typeahead/${category}?prefix=${inputText}&limit=100`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lastSearchTerm = useRef('');
|
const lastSearchTerm = useRef('');
|
||||||
|
|
Loading…
Reference in New Issue