Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load full status report on demand with Ajax #4095

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

oscarssanchezz
Copy link
Contributor

@oscarssanchezz oscarssanchezz commented Feb 26, 2025

Description of the Change

This PR adds functionality to load resource intensive reports on demand with a "Generate Full Status Report" button.

If the full status report has not been generated yet, it should show a warning message declared by the specific report, prompting users to generate the full status report to see it.

If the status report has not been generated yet, copy to clipboard and download status report buttons should not be available, as these will contain an incomplete status report.

epreport.mov

Closes #3767

How to test the Change

1.- Open Status Report page.
2.- Check the status reports that should be loaded with ajax are showing the correct notice (only indexables at this point).
3.- Download status report and copy to clipboard buttons should be disabled.
4.- Click on Generate Full status report.
5.- Report should now show all groups and notice should be gone.
6.- Download status report and copy to clipboard should have full Info.
7.- Generate Full status report button should be disabled.

Changelog Entry

Changed - Potentially resource intensive status reports are loaded on demand with AJAX.

Credits

Props @oscarssanchez , @felipeelia

Checklist:

@oscarssanchezz oscarssanchezz changed the title WIP: Load full status report on demand with Ajax Load full status report on demand with Ajax Feb 26, 2025
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to my comments, @oscarssanchezz:

  1. This needs both unit and e2e tests;
  2. It seems the "Indexable Content" information is not present if you download or copy the report
  3. Did you explore breaking ajax reports into separate requests? Right now, we only have one report that relies on ajax, but if we need another in the future, wouldn't it be better if we could fire multiple (parallel) ajax requests instead of a giant single request?
  4. I'm a bit concerned with the UX here. Shouldn't we allow people to download a partial report?


/**
* Internal dependencies.
*/
import Value from './report/value';
// import ReportHeader from './report/header';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a left-over and can be removed?

}

if ( empty( $this->formatted_reports[ $post['report'] ] ) ) {
wp_send_json_error( [ 'message' => 'Report not found.' ], 404 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string needs to be translatable, no?

'groups' => ! $report->is_ajax_report() ? $report->get_groups() : [],
'messages' => $report->get_messages(),
'title' => $report->get_title(),
'is_ajax_report' => $report->is_ajax_report(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for variables we are passing to JS, we are using camelCase, so this will need to be isAjaxReport.

@felipeelia felipeelia removed their assignment Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants