Save selected process model

This commit is contained in:
Jon Herron 2022-11-28 14:14:35 -05:00
parent 02c113fb54
commit a081c9a93c
2 changed files with 12 additions and 19 deletions

View File

@ -7,13 +7,14 @@ import {
// @ts-ignore // @ts-ignore
} from '@carbon/react'; } from '@carbon/react';
*/ */
import { ProcessModel } from '../interfaces';
import HttpService from '../services/HttpService'; import HttpService from '../services/HttpService';
type OwnProps = { type OwnProps = {
onSuccess: (..._args: any[]) => any; onSuccess: (..._args: any[]) => any;
columnArray: { Header: string; accessor: string }; columnArray: { Header: string; accessor: string };
orderBy: string; orderBy: string;
filterBy: string; processModelSelection: ProcessModel | null;
buttonText?: string; buttonText?: string;
}; };
@ -21,7 +22,7 @@ export default function ProcessInstanceListSaveAsReport({
onSuccess, onSuccess,
columnArray, columnArray,
orderBy, orderBy,
filterBy, processModelSelection,
buttonText = 'Save as Perspective', buttonText = 'Save as Perspective',
}: OwnProps) { }: OwnProps) {
const [identifier, setIdentifier] = useState(''); const [identifier, setIdentifier] = useState('');
@ -33,24 +34,16 @@ export default function ProcessInstanceListSaveAsReport({
const addProcessInstanceReport = (event: any) => { const addProcessInstanceReport = (event: any) => {
event.preventDefault(); event.preventDefault();
console.log(columnArray);
const orderByArray = orderBy.split(',').filter((n) => n); const orderByArray = orderBy.split(',').filter((n) => n);
const filterByArray = filterBy const filterByArray: any = [];
.split(',')
.map((filterByItem) => { if (processModelSelection) {
const [fieldName, fieldValue] = filterByItem.split('='); filterByArray.push({
if (fieldValue) { field_name: 'process_model_identifier',
return { field_value: processModelSelection.id,
field_name: fieldName, });
operator: 'equals', }
field_value: fieldValue,
};
}
return null;
})
.filter((n) => n);
HttpService.makeCallToBackend({ HttpService.makeCallToBackend({
path: `/process-instances/reports`, path: `/process-instances/reports`,

View File

@ -777,7 +777,7 @@ export default function ProcessInstanceListTable({
onSuccess={callback} onSuccess={callback}
columnArray={reportColumns()} columnArray={reportColumns()}
orderBy="" orderBy=""
filterBy="" processModelSelection={processModelSelection}
/> />
); );
}; };