feat(integrations): details modal and Run now for integration logs#4757
Open
chickenn00dle wants to merge 14 commits into
Open
feat(integrations): details modal and Run now for integration logs#4757chickenn00dle wants to merge 14 commits into
chickenn00dle wants to merge 14 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d unset Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the Audience → Integrations → Logs experience by adding per-action troubleshooting tools: a details modal (full payload + Action Scheduler log trail) and a “Run now” action for pending jobs, backed by new wizard-gated REST endpoints.
Changes:
- Add DataViews row actions for View details (modal) and Run now (POST + refresh + snackbar).
- Introduce shared JS constants/helpers for status labeling (including
in-progress) and timestamp formatting. - Add REST endpoints to fetch per-action detail (including extended args) and to synchronously run pending actions, plus Action Scheduler helper methods to fetch a single action and its logs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/wizards/audience/views/integrations/style.scss | Adds styling for the new action-details modal layout (meta grid, args pre block, logs list). |
| src/wizards/audience/views/integrations/logs-view.js | Adds DataViews row actions: details modal + “Run now” trigger with notices and refetch. |
| src/wizards/audience/views/integrations/log-details-modal.js | New modal component that fetches and renders action payload, metadata, and AS log entries. |
| src/wizards/audience/views/integrations/constants.js | New shared constants for API base, status map (incl. in-progress), and timestamp formatting. |
| includes/wizards/audience/class-audience-integrations.php | Registers two new REST routes and implements detail + run handlers with integration ownership checks. |
| includes/reader-activation/class-integrations.php | Adds action_belongs_to_integration() helper to gate per-integration action access. |
| includes/class-action-scheduler.php | Adds helper methods to fetch a single AS action and normalized per-action logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Adds two affordances to the per-integration activity logs view (Audience › Integrations › Logs) to make troubleshooting Action Scheduler retries practical:
args, withextended_argspreferred when the indexed column was truncated), metadata (action ID, group, scheduled date, attempts, last attempt), and the per-action Action Scheduler log trail.pendingactions only, runs the Action Scheduler action immediately and refreshes the row with the post-run status. Mirrors WooCommerce's default AS admin behavior.Both REST endpoints sit behind the existing wizard permission gate. The detail endpoint validates that the action belongs to the integration before responding, returning a generic 404 on cross-group access so other-group actions can't be probed through it. Errors thrown by the action's callback during a Run are surfaced as a 200 response with
status: 'failed'and the last AS log message — AS itself records the failure and writes the log, so the UI just refetches and shows the result in a snackbar.Follow-up to #4671 per Miguel's non-blocking review feedback.
Closes DSGNEWS-160.
How to test the changes in this Pull Request:
n env create dsgnews-160 --worktree newspack-plugin:feat/improve-integrations-activity-logs --up && n setup --env dsgnews-160 --yes --woocommerce.pendingrow, open the row "…" menu → View details. Verify the modal shows: event label + status badge, action ID, scheduled (GMT), group, attempts, last attempt (or—), pretty-printed args JSON in a<pre>block, and the AS log list.pendingrow, click Run now. Verify a success snackbar appears ("Action completed.") and the row's status flips to Success in place.complete,failed, orcanceledrow, confirm Run now is hidden from the row menu but View details still opens correctly.action_idsegment of the request in the devtools network tab and re-issue. The modal should show "This action no longer exists."in-progressaction in the list, confirm its status badge renders as "In progress" (no raw-string fallback).Other information:
Automated tests were intentionally not added — Action Scheduler is heavy to mock for low value here. Verification is via the manual QA steps above in an isolated env. PHP/JS/SCSS linting and
n buildall pass.