Skip to content

Connect Audit Logs UI to Case Retention API with Sorting, Search, and Overflow Handling#8758

Merged
sanjacornelius merged 3 commits intoepic/FOUR-29101from
task/FOUR-29764
Mar 25, 2026
Merged

Connect Audit Logs UI to Case Retention API with Sorting, Search, and Overflow Handling#8758
sanjacornelius merged 3 commits intoepic/FOUR-29101from
task/FOUR-29764

Conversation

@sanjacornelius
Copy link
Copy Markdown
Contributor

@sanjacornelius sanjacornelius commented Mar 24, 2026

This PR integrates the Audit Logs frontend with the backend by introducing an API to retrieve Case Retention logs and rendering them within the UI.

It also enhances the table experience by adding sorting, expanded search capabilities, and improved handling of large case_ids arrays. When more than 6 case IDs are present, the UI truncates the list and displays a +N indicator. Clicking this opens a popout containing the full list of associated case IDs.

Solution

  • Added API endpoint to retrieve Case Retention logs
  • Integrated Audit Logs UI with backend data
  • Implemented table column sorting
  • Expanded search to include all columns except `created_at and deleted_at
  • Added overflow handling for case_ids with popout display for full list

How to Test

  1. Ensure records exist in the case_retention_policy_logs table
  2. Navigate to Admin > Cases Retention Logs
  3. Verify logs are displayed correctly
  4. Validate column-based search functionality (excluding created_at and deleted_at)
  5. Validate sorting across table headers
  6. For records with more than 6 case_ids:
    • Confirm truncation with +N indicator
    • Click the indicator and verify the popout displays all case IDs

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

Introduce CasesRetentionController with a logs() action to expose case retention policy logs. The endpoint supports text filtering, validated ordering (whitelisted columns), order direction, and paginated results (per_page default 10); when no valid order_by is provided it falls back to created_at descending. The controller uses DB::raw to transform dotted column notation into JSON extraction for ordering and returns results as an ApiCollection. Also registers the GET api/1.0/cases-retention/logs route under the existing authenticated API middleware group.
Treat case_ids as a native array across backend and frontend. Add a $casts entry on CaseRetentionPolicyLog and stop json-encoding case_ids in EvaluateProcessRetentionJob and the factory; update the unit test to assert the array value. On the UI side, introduce a dedicated CaseIdsTableCell Vue component (with preview + popover for overflow) and wire it into CasesRetentionLogs, replacing fake data with an API fetch and adjusting sorting/preview behavior.
Introduce applyLogsFilter to perform flexible searching across id, process_id, numeric columns (deleted_count, total_time_taken) and JSON case_ids, using driver-specific casting (ILIKE for pgsql, CAST(... AS CHAR) otherwise). Use request->filled('filter') and trim empty terms to avoid spurious queries. Replace the previous lowercase process_id-only filter with this broader implementation and remove unused imports (Response, DB, Log).
@processmaker-sonarqube
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@sanjacornelius sanjacornelius merged commit e2646cd into epic/FOUR-29101 Mar 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants