diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index bd3a2e080..6397cc201 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -76,17 +76,7 @@ class ProcessInstanceReportService: # TODO replace with system reports that are loaded on launch (or similar) temp_system_metadata_map = { "default": { - "columns": [ - {"Header": "id", "accessor": "id"}, - { - "Header": "process_model_display_name", - "accessor": "process_model_display_name", - }, - {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, - {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, - {"Header": "username", "accessor": "username"}, - {"Header": "status", "accessor": "status"}, - ], + "columns": cls.builtin_column_options() }, "system_report_instances_initiated_by_me": { "columns": [ @@ -102,33 +92,13 @@ class ProcessInstanceReportService: "filter_by": [{"field_name": "initiated_by_me", "field_value": True}], }, "system_report_instances_with_tasks_completed_by_me": { - "columns": [ - {"Header": "id", "accessor": "id"}, - { - "Header": "process_model_display_name", - "accessor": "process_model_display_name", - }, - {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, - {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, - {"Header": "username", "accessor": "username"}, - {"Header": "status", "accessor": "status"}, - ], + "columns": cls.builtin_column_options(), "filter_by": [ {"field_name": "with_tasks_completed_by_me", "field_value": True} ], }, "system_report_instances_with_tasks_completed_by_my_groups": { - "columns": [ - {"Header": "id", "accessor": "id"}, - { - "Header": "process_model_display_name", - "accessor": "process_model_display_name", - }, - {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, - {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, - {"Header": "username", "accessor": "username"}, - {"Header": "status", "accessor": "status"}, - ], + "columns": cls.builtin_column_options(), "filter_by": [ { "field_name": "with_tasks_completed_by_my_group", @@ -273,13 +243,13 @@ class ProcessInstanceReportService: def builtin_column_options(cls) -> list[dict]: """Builtin_column_options.""" return [ - {"Header": "id", "accessor": "id"}, + {"Header": "Id", "accessor": "id"}, { - "Header": "process_model_display_name", + "Header": "Process", "accessor": "process_model_display_name", }, - {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, - {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, - {"Header": "username", "accessor": "username"}, - {"Header": "status", "accessor": "status"}, + {"Header": "Start", "accessor": "start_in_seconds"}, + {"Header": "End", "accessor": "end_in_seconds"}, + {"Header": "Username", "accessor": "username"}, + {"Header": "Status", "accessor": "status"}, ] diff --git a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx index a518e47bb..79ab8253e 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx @@ -115,7 +115,6 @@ export default function ProcessGroupForm({ labelText="Display Name*" value={processGroup.display_name} onChange={(event: any) => onDisplayNameChanged(event.target.value)} - onBlur={(event: any) => console.log('event', event)} />, ]; diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListSaveAsReport.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListSaveAsReport.tsx index 6c8f5fb90..d70aab3e5 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListSaveAsReport.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListSaveAsReport.tsx @@ -1,12 +1,11 @@ import { useState } from 'react'; -// TODO: carbon controls -/* import { Button, - Textbox, + TextInput, + Form, + Stack, // @ts-ignore } from '@carbon/react'; -*/ import { ProcessModel } from '../interfaces'; import HttpService from '../services/HttpService'; @@ -112,20 +111,21 @@ export default function ProcessInstanceListSaveAsReport({ }; return ( -
- - -
+ + + ); } diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 50b69c0b3..ebf6a4460 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -7,7 +7,7 @@ import { } from 'react-router-dom'; // @ts-ignore -import { Filter } from '@carbon/icons-react'; +import { Filter, Close } from '@carbon/icons-react'; import { Button, ButtonSet, @@ -21,6 +21,7 @@ import { TableHead, TableRow, TimePicker, + Tag, // @ts-ignore } from '@carbon/react'; import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config'; @@ -49,6 +50,7 @@ import { ProcessModel, ProcessInstanceReport, ProcessInstance, + ReportColumn, } from '../interfaces'; import ProcessModelSearch from './ProcessModelSearch'; import ProcessInstanceReportSearch from './ProcessInstanceReportSearch'; @@ -127,6 +129,10 @@ export default function ProcessInstanceListTable({ const [processInstanceReportSelection, setProcessInstanceReportSelection] = useState(null); + const [availableReportColumns, setAvailableReportColumns] = useState< + ReportColumn[] + >([]); + const dateParametersToAlwaysFilterBy: dateParameters = useMemo(() => { return { start_from: [setStartFromDate, setStartFromTime], @@ -554,12 +560,99 @@ export default function ProcessInstanceListTable({ setEndToTime(''); }; + const processInstanceReportDidChange = (selection: any) => { + clearFilters(); + + const selectedReport = selection.selectedItem; + setProcessInstanceReportSelection(selectedReport); + + const queryParamString = selectedReport + ? `&report_identifier=${selectedReport.id}` + : ''; + + setErrorMessage(null); + navigate(`/admin/process-instances?${queryParamString}`); + }; + + const reportColumns = () => { + return (reportMetadata as any).columns; + }; + + const saveAsReportComponent = () => { + // TODO onSuccess reload/select the new report in the report search + const callback = (identifier: string) => { + processInstanceReportDidChange({ + selectedItem: { id: identifier, display_name: identifier }, + }); + }; + const { + valid, + startFromSeconds, + startToSeconds, + endFromSeconds, + endToSeconds, + } = calculateStartAndEndSeconds(); + + if (!valid) { + return null; + } + return ( + + ); + }; + + const columnSelections = () => { + if (reportColumns()) { + const tags: any = []; + + (reportColumns() as any).forEach((reportColumn: ReportColumn) => { + tags.push( + + +