Skip to main content

Rentiva v4.52.0 — Export Page React SPA

· 2 min read
MaxHandMade
Maintainer

The Export admin page is now a full React SPA. 780 lines of legacy PHP render code have been replaced with a REST-backed interface featuring live record preview, export history with per-entry delete, and a preserved admin-post.php CSV download flow.

Written before 6.0.0

This post is the record of a release that shipped before 6.0.0, which renamed the plugin's post types, taxonomies, options, meta keys and hooks. The identifiers below are the names those versions actually used, and they are kept that way on purpose. For the current names — and a conversion table — see the 6.0.7 release post.

What's New

Export Page — React SPA Migration

New REST Endpoints (3)

  • GET /mhm-rentiva/v1/admin/export/history — paginated export log (WP transient, max 50 entries, 1-week TTL)
  • DELETE /mhm-rentiva/v1/admin/export/{id} — remove a specific history entry
  • POST /mhm-rentiva/v1/admin/export/preview — returns total record count + 5-row sample for the selected post type and date filters, before committing to export

New React Components

  • ExportCards — visual card selector for three export types: Bookings, Vehicles, App Logs. Active card is highlighted with a blue border.
  • AdvancedFilters — collapsible date filter panel. Supports preset date ranges (populated from ExportFilters::get_date_ranges()) and custom from/to date inputs.
  • PreviewBar — displays the record count and a 5-row sample table after a preview REST call. Disables the Export CSV button if count is 0.
  • ExportForm — Export CSV button triggers a hidden admin-post.php form submit via useRef — no page reload, no SPA navigation.
  • ExportHistory — loads the export log on mount via REST. Each row has an inline Delete button; optimistic removal on success.

Legacy Code Removed

  • 780 lines of PHP render code moved to a private @deprecated method, unhooked from register()
  • Three legacy AJAX handlers (wp_ajax_mhm_export_*) removed from the hook registry

i18n

  • 33 new Turkish strings translated
  • mhm-rentiva-tr_TR-mhm-rentiva-react-export.json generated for the React bundle

Tests

22 new PHPUnit integration tests covering all three REST endpoints: 401/403 auth, history CRUD, DELETE isolation, preview validation (including enum enforcement), date range filtering, and sample structure. PHPCS: 0 errors.