mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-20 23:08:55 +00:00
split out completed instances by group as well
This commit is contained in:
parent
0bbe67971f
commit
7153045e66
@ -595,6 +595,12 @@ paths:
|
|||||||
description: Specifies the identifier of a report to use, if any
|
description: Specifies the identifier of a report to use, if any
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
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:
|
get:
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list
|
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list
|
||||||
summary: Returns a list of process instances for a given process model
|
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,
|
user_filter: Optional[bool] = False,
|
||||||
report_identifier: Optional[str] = None,
|
report_identifier: Optional[str] = None,
|
||||||
report_id: Optional[int] = None,
|
report_id: Optional[int] = None,
|
||||||
|
group_identifier: Optional[str] = None,
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
"""Process_instance_list."""
|
"""Process_instance_list."""
|
||||||
process_instance_report = ProcessInstanceReportService.report_with_identifier(
|
process_instance_report = ProcessInstanceReportService.report_with_identifier(
|
||||||
@ -960,10 +961,16 @@ def process_instance_list(
|
|||||||
process_instance_query = process_instance_query.filter(
|
process_instance_query = process_instance_query.filter(
|
||||||
SpiffLoggingModel.spiff_step == SpiffStepDetailsModel.spiff_step
|
SpiffLoggingModel.spiff_step == SpiffStepDetailsModel.spiff_step
|
||||||
)
|
)
|
||||||
process_instance_query = process_instance_query.join(
|
if (group_identifier):
|
||||||
GroupModel,
|
process_instance_query = process_instance_query.join(
|
||||||
GroupModel.id == SpiffStepDetailsModel.lane_assignment_id,
|
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(
|
process_instance_query = process_instance_query.join(
|
||||||
UserGroupAssignmentModel,
|
UserGroupAssignmentModel,
|
||||||
UserGroupAssignmentModel.group_id == GroupModel.id,
|
UserGroupAssignmentModel.group_id == GroupModel.id,
|
||||||
|
@ -79,6 +79,7 @@ type OwnProps = {
|
|||||||
textToShowIfEmpty?: string;
|
textToShowIfEmpty?: string;
|
||||||
paginationClassName?: string;
|
paginationClassName?: string;
|
||||||
autoReload?: boolean;
|
autoReload?: boolean;
|
||||||
|
additionalParams?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface dateParameters {
|
interface dateParameters {
|
||||||
@ -90,6 +91,7 @@ export default function ProcessInstanceListTable({
|
|||||||
processModelFullIdentifier,
|
processModelFullIdentifier,
|
||||||
paginationQueryParamPrefix,
|
paginationQueryParamPrefix,
|
||||||
perPageOptions,
|
perPageOptions,
|
||||||
|
additionalParams,
|
||||||
showReports = true,
|
showReports = true,
|
||||||
reportIdentifier,
|
reportIdentifier,
|
||||||
textToShowIfEmpty,
|
textToShowIfEmpty,
|
||||||
@ -253,6 +255,10 @@ export default function ProcessInstanceListTable({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (additionalParams) {
|
||||||
|
queryParamString += `&${additionalParams}`;
|
||||||
|
}
|
||||||
|
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/process-instances?${queryParamString}`,
|
path: `/process-instances?${queryParamString}`,
|
||||||
successCallback: setProcessInstancesFromResult,
|
successCallback: setProcessInstancesFromResult,
|
||||||
@ -315,6 +321,7 @@ export default function ProcessInstanceListTable({
|
|||||||
processModelFullIdentifier,
|
processModelFullIdentifier,
|
||||||
perPageOptions,
|
perPageOptions,
|
||||||
reportIdentifier,
|
reportIdentifier,
|
||||||
|
additionalParams,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// This sets the filter data using the saved reports returned from the initial instance_list query.
|
// 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}`;
|
let params = `?per_page=${perPage}&page=${page}`;
|
||||||
if (additionalParams) {
|
if (additionalParams) {
|
||||||
params = `${params}&${additionalParams}`;
|
params += `&${additionalParams}`;
|
||||||
}
|
}
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `${apiPath}${params}`,
|
path: `${apiPath}${params}`,
|
||||||
|
@ -11,6 +11,7 @@ export default function TasksWaitingForMyGroups() {
|
|||||||
successCallback: setUserGroups,
|
successCallback: setUserGroups,
|
||||||
});
|
});
|
||||||
}, [setUserGroups]);
|
}, [setUserGroups]);
|
||||||
|
|
||||||
const tableComponents = () => {
|
const tableComponents = () => {
|
||||||
if (!userGroups) {
|
if (!userGroups) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,6 +1,45 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
import ProcessInstanceListTable from '../components/ProcessInstanceListTable';
|
import ProcessInstanceListTable from '../components/ProcessInstanceListTable';
|
||||||
|
import HttpService from '../services/HttpService';
|
||||||
|
|
||||||
export default function CompletedInstances() {
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2>My completed instances</h2>
|
<h2>My completed instances</h2>
|
||||||
@ -30,19 +69,7 @@ export default function CompletedInstances() {
|
|||||||
textToShowIfEmpty="You have no completed tasks at this time."
|
textToShowIfEmpty="You have no completed tasks at this time."
|
||||||
paginationClassName="with-large-bottom-margin"
|
paginationClassName="with-large-bottom-margin"
|
||||||
/>
|
/>
|
||||||
<h2>Tasks completed by my groups</h2>
|
{groupTableComponents()}
|
||||||
<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."
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user