Skip to content

Port Activity Log to Jetpack wp-admin as a native page #48242

@keoshi

Description

@keoshi

Replace the external "Activity Log ↗" sidebar item (currently registered in projects/packages/my-jetpack/src/class-activitylog.php, pointing at Cloud via Redirect::get_url( 'cloud-activity-log-wp-menu' )) with a native in-wp-admin page inside the Jetpack plugin. Source: Calypso Dashboard's client/dashboard/sites/logs-activity/. Architecture follows the projects/packages/backup/ package's pattern.

Plan

  • Phase 0 — Package scaffold. Create projects/packages/activity-log/ mirroring projects/packages/backup/. Main PHP class + menu registration (placeholder page), Initial_State bootstrap, REST controller stub, React root with TanStack Query + @wordpress/data.
  • Phase 1 — Menu swap. Remove the Cloud redirect from my-jetpack/src/class-activitylog.php; new package owns the Activity Log menu item.
  • Phase 2 — REST surface. GET /jetpack/v4/activity-log + /count/group, user-signed WPCOM proxies.
  • Phase 3 — UI port. DataViews-based admin page ported from Calypso's logs-activity/: search, activity-type filter, sort, pagination, Event/User cells with gridicon→WP-icon mapping. FormattedBlock resolves entity tokens (post, person, plugin, theme, comment) to their wp-admin screens via three fallbacks (typed range → section-tagged anchor → entry-level object). View state (columns, density, sort, perPage) persists across refresh via localStorage. Reset view button wired to DataViews' native onReset. SCSS colors migrated to --wpds-* design tokens. Deliberate scope simplifications documented in the PR body — no analytics, no URL params.
  • Phase 4 — Tier gating & upsell. Free tier sees the 20 most recent events with search, filters, sort and pagination disabled; paid (Backup-enabled) tier sees the full log. Access signal comes from WPCOM's /sites/{id}/rewind endpoint (same source Jetpack_Backup::has_backup_plan() uses), cached in a site transient for 5 minutes. Server-side clamp in the REST proxy forces number≤20 + page=1 when gated so DevTools/wp.apiFetch can't bypass. UI-side: DataViews' search/filters/sort/view-config hidden via children={<DataViews.Layout />} plus config.perPageSizes=[20]. UpsellCallout below the table ports Calypso's copy + illustration 1:1; CTA routes through useProductCheckoutWorkflow to jetpack_security_t1_yearly with source=activity-log-page-purchase. On return from checkout a nonce-protected refresh_access query arg drops the access cache immediately (pattern from Publicize\Social_Admin_Page).
  • Date range picker. Full 1:1 port of Calypso's components/date-range-picker/ — Dropdown toggle, preset sidebar (Today, Yesterday, Last 7/30 days, Month/Year to date, Last 12 months, Last 3 years, Custom), dual-month calendar (collapses to one on mobile), start/end inputs. Threads into REST after / before params for list + group-counts queries. Defaults to last-7-days anchored at the site's calendar today. Paid tier only.
  • Phase 5 — Cross-links to Backup (stubs). Blocked: waits for the Backup package port to land (Backup: New overview UI #48236). Activity-item actions for "restore to this point" / "download from this point" link into the Backup package's admin page. Stubbed with a disabled state.

Branch & PR

All work lands as commits on the try-jetpack-activity-log-page branch, tracked by a single PR: #48244. Phase checkboxes above are ticked manually as each phase's commit lands on the branch.

Deferred follow-ups

  • Add phpunit scaffolding + full test coverage — in-flight at Activity Log: phpunit scaffolding + gating tests #48264 (scaffold + 5 gating tests landed; follow-up commits on that branch will cover has_activity_logs_access() transient behavior, REST permission callback branches, and the free-tier clamp on get_activity_log()).
  • Swap localStorage-backed view persistence for user-meta-backed persistence once we want cross-device sync. Interface already encapsulated in usePersistentView.
  • Link the User column (actor cell) to user-edit.php using actor.external_user_id. Deferred to keep link treatment scoped to event-description entities for now.

Out of scope

  • Agency / multi-site flows.
  • Cross-site clone.
  • Net-new features beyond Calypso parity.
  • PHP errors / Web server log tabs (those data sources are WordPress.com Hosting–only).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions