home page tables are working again w/ burnettk

This commit is contained in:
jasquat 2023-04-28 12:36:16 -04:00
parent 80ec1194db
commit b179b66e26
5 changed files with 28 additions and 17 deletions

View File

@ -527,7 +527,7 @@ class ProcessInstanceReportService:
results = cls.add_metadata_columns_to_process_instance(process_instances.items, report_metadata["columns"])
for value in cls.check_filter_value(filters, "oldest_open_human_task_fields"):
results = cls.add_human_task_fields(results, value)
results = cls.add_human_task_fields(results, value.split(","))
response_json = {
"report_metadata": report_metadata,
"results": results,

View File

@ -6,7 +6,7 @@ import {
Modal,
// @ts-ignore
} from '@carbon/react';
import { ProcessInstanceReport, ReportMetadata } from '../interfaces';
import { ProcessInstanceReport } from '../interfaces';
import HttpService from '../services/HttpService';
type OwnProps = {

View File

@ -87,7 +87,7 @@ type OwnProps = {
textToShowIfEmpty?: string;
paginationClassName?: string;
autoReload?: boolean;
additionalParams?: string;
additionalReportFilters?: ReportFilter[];
variant?: string;
canCompleteAllTasks?: boolean;
showActionsColumn?: boolean;
@ -102,7 +102,7 @@ export default function ProcessInstanceListTable({
processModelFullIdentifier,
paginationQueryParamPrefix,
perPageOptions,
additionalParams,
additionalReportFilters,
showReports = true,
reportIdentifier,
textToShowIfEmpty,
@ -330,6 +330,9 @@ export default function ProcessInstanceListTable({
}
}
// this is the code to re-populate the widgets on the page
// with values from the report metadata, which is derived
// from the searchParams (often report_hash)
let selectedProcessModelIdentifier = processModelFullIdentifier;
reportMetadataBodyToUse.filter_by.forEach(
(reportFilter: ReportFilter) => {
@ -360,7 +363,6 @@ export default function ProcessInstanceListTable({
}
}
);
processModelSelectionItemsForUseEffect.forEach(
(processModel: ProcessModel) => {
if (processModel.id === selectedProcessModelIdentifier) {
@ -384,9 +386,13 @@ export default function ProcessInstanceListTable({
// eslint-disable-next-line prefer-destructuring
perPage = perPageOptions[1];
}
let queryParamString = `per_page=${perPage}&page=${page}`;
if (additionalParams) {
queryParamString += `&${additionalParams}`;
const queryParamString = `per_page=${perPage}&page=${page}`;
if (additionalReportFilters) {
additionalReportFilters.forEach((arf: ReportFilter) => {
if (!reportMetadataBodyToUse.filter_by.includes(arf)) {
reportMetadataBodyToUse.filter_by.push(arf);
}
});
}
HttpService.makeCallToBackend({
@ -405,13 +411,14 @@ export default function ProcessInstanceListTable({
return;
}
const queryParams: string[] = [];
['report_hash', 'report_id', 'report_identifier'].forEach(
(paramName: string) => {
if (searchParams.get(paramName)) {
queryParams.push(`${paramName}=${searchParams.get(paramName)}`);
}
['report_hash', 'report_id'].forEach((paramName: string) => {
if (searchParams.get(paramName)) {
queryParams.push(`${paramName}=${searchParams.get(paramName)}`);
}
);
});
if (reportIdentifier) {
queryParams.push(`report_identifier=${reportIdentifier}`);
}
if (queryParams.length > 0) {
const queryParamString = `?${queryParams.join('&')}`;
@ -476,7 +483,7 @@ export default function ProcessInstanceListTable({
processModelFullIdentifier,
perPageOptions,
reportIdentifier,
additionalParams,
additionalReportFilters,
processInstanceApiSearchPath,
permissionsLoaded,
listHasBeenFiltered,

View File

@ -32,7 +32,9 @@ export default function CompletedInstances() {
reportIdentifier="system_report_completed_instances_with_tasks_completed_by_my_groups"
showReports={false}
textToShowIfEmpty="This group has no completed instances at this time."
additionalParams={`user_group_identifier=${userGroup}`}
additionalReportFilters={[
{ field_name: 'user_group_identifier', field_value: userGroup },
]}
showActionsColumn
/>
</>

View File

@ -35,7 +35,9 @@ export default function InProgressInstances() {
reportIdentifier="system_report_in_progress_instances_with_tasks_for_my_group"
showReports={false}
textToShowIfEmpty="This group has no instances waiting on it at this time."
additionalParams={`user_group_identifier=${userGroup}`}
additionalReportFilters={[
{ field_name: 'user_group_identifier', field_value: userGroup },
]}
canCompleteAllTasks
showActionsColumn
autoReload