split out completed instances by group as well
This commit is contained in:
parent
ec754cbee7
commit
95be029656
|
@ -595,6 +595,12 @@ paths:
|
|||
description: Specifies the identifier of a report to use, if any
|
||||
schema:
|
||||
type: integer
|
||||
- name: group_identifier
|
||||
in: query
|
||||
required: false
|
||||
description: The identifier of the group to get the process instances for
|
||||
schema:
|
||||
type: string
|
||||
get:
|
||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list
|
||||
summary: Returns a list of process instances for a given process model
|
||||
|
|
|
@ -821,6 +821,7 @@ def process_instance_list(
|
|||
user_filter: Optional[bool] = False,
|
||||
report_identifier: Optional[str] = None,
|
||||
report_id: Optional[int] = None,
|
||||
group_identifier: Optional[str] = None,
|
||||
) -> flask.wrappers.Response:
|
||||
"""Process_instance_list."""
|
||||
process_instance_report = ProcessInstanceReportService.report_with_identifier(
|
||||
|
@ -960,10 +961,16 @@ def process_instance_list(
|
|||
process_instance_query = process_instance_query.filter(
|
||||
SpiffLoggingModel.spiff_step == SpiffStepDetailsModel.spiff_step
|
||||
)
|
||||
process_instance_query = process_instance_query.join(
|
||||
GroupModel,
|
||||
GroupModel.id == SpiffStepDetailsModel.lane_assignment_id,
|
||||
)
|
||||
if (group_identifier):
|
||||
process_instance_query = process_instance_query.join(
|
||||
GroupModel,
|
||||
GroupModel.identifier == group_identifier,
|
||||
)
|
||||
else:
|
||||
process_instance_query = process_instance_query.join(
|
||||
GroupModel,
|
||||
GroupModel.id == SpiffStepDetailsModel.lane_assignment_id,
|
||||
)
|
||||
process_instance_query = process_instance_query.join(
|
||||
UserGroupAssignmentModel,
|
||||
UserGroupAssignmentModel.group_id == GroupModel.id,
|
||||
|
|
|
@ -79,6 +79,7 @@ type OwnProps = {
|
|||
textToShowIfEmpty?: string;
|
||||
paginationClassName?: string;
|
||||
autoReload?: boolean;
|
||||
additionalParams?: string;
|
||||
};
|
||||
|
||||
interface dateParameters {
|
||||
|
@ -90,6 +91,7 @@ export default function ProcessInstanceListTable({
|
|||
processModelFullIdentifier,
|
||||
paginationQueryParamPrefix,
|
||||
perPageOptions,
|
||||
additionalParams,
|
||||
showReports = true,
|
||||
reportIdentifier,
|
||||
textToShowIfEmpty,
|
||||
|
@ -253,6 +255,10 @@ export default function ProcessInstanceListTable({
|
|||
}
|
||||
);
|
||||
|
||||
if (additionalParams) {
|
||||
queryParamString += `&${additionalParams}`;
|
||||
}
|
||||
|
||||
HttpService.makeCallToBackend({
|
||||
path: `/process-instances?${queryParamString}`,
|
||||
successCallback: setProcessInstancesFromResult,
|
||||
|
@ -315,6 +321,7 @@ export default function ProcessInstanceListTable({
|
|||
processModelFullIdentifier,
|
||||
perPageOptions,
|
||||
reportIdentifier,
|
||||
additionalParams,
|
||||
]);
|
||||
|
||||
// This sets the filter data using the saved reports returned from the initial instance_list query.
|
||||
|
|
|
@ -58,7 +58,7 @@ export default function TasksTable({
|
|||
};
|
||||
let params = `?per_page=${perPage}&page=${page}`;
|
||||
if (additionalParams) {
|
||||
params = `${params}&${additionalParams}`;
|
||||
params += `&${additionalParams}`;
|
||||
}
|
||||
HttpService.makeCallToBackend({
|
||||
path: `${apiPath}${params}`,
|
||||
|
|
|
@ -11,6 +11,7 @@ export default function TasksWaitingForMyGroups() {
|
|||
successCallback: setUserGroups,
|
||||
});
|
||||
}, [setUserGroups]);
|
||||
|
||||
const tableComponents = () => {
|
||||
if (!userGroups) {
|
||||
return null;
|
||||
|
|
|
@ -1,6 +1,45 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
import ProcessInstanceListTable from '../components/ProcessInstanceListTable';
|
||||
import HttpService from '../services/HttpService';
|
||||
|
||||
export default function CompletedInstances() {
|
||||
const [userGroups, setUserGroups] = useState<string[] | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
HttpService.makeCallToBackend({
|
||||
path: `/user-groups/for-current-user`,
|
||||
successCallback: setUserGroups,
|
||||
});
|
||||
}, [setUserGroups]);
|
||||
|
||||
const groupTableComponents = () => {
|
||||
if (!userGroups) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return userGroups.map((userGroup: string) => {
|
||||
return (
|
||||
<>
|
||||
<h2>Tasks completed by {userGroup} group</h2>
|
||||
<p className="data-table-description">
|
||||
This is a list of instances with tasks that were completed by the{' '}
|
||||
{userGroup} group.
|
||||
</p>
|
||||
<ProcessInstanceListTable
|
||||
filtersEnabled={false}
|
||||
paginationQueryParamPrefix="group_completed_tasks"
|
||||
paginationClassName="with-large-bottom-margin"
|
||||
perPageOptions={[2, 5, 25]}
|
||||
reportIdentifier="system_report_instances_with_tasks_completed_by_my_groups"
|
||||
showReports={false}
|
||||
textToShowIfEmpty="Your group has no completed tasks at this time."
|
||||
additionalParams={`group_identifier=${userGroup}`}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2>My completed instances</h2>
|
||||
|
@ -30,19 +69,7 @@ export default function CompletedInstances() {
|
|||
textToShowIfEmpty="You have no completed tasks at this time."
|
||||
paginationClassName="with-large-bottom-margin"
|
||||
/>
|
||||
<h2>Tasks completed by my groups</h2>
|
||||
<p className="data-table-description">
|
||||
This is a list of instances with tasks that were completed by groups you
|
||||
belong to.
|
||||
</p>
|
||||
<ProcessInstanceListTable
|
||||
filtersEnabled={false}
|
||||
paginationQueryParamPrefix="group_completed_tasks"
|
||||
perPageOptions={[2, 5, 25]}
|
||||
reportIdentifier="system_report_instances_with_tasks_completed_by_my_groups"
|
||||
showReports={false}
|
||||
textToShowIfEmpty="Your group has no completed tasks at this time."
|
||||
/>
|
||||
{groupTableComponents()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue