Site Health: Don't show issue groups unless there are items in them.

The Site Health Status screen groups issues into the categories `good`, `recommended`, and `critical` when displaying them to the end user.

Initially, this screen would show `0 critical issues` while the checks were being performed, and then hide the group if no issues were discovered after all checks had completed, this not being an ideal user experience, as it is a better experience to show areas that have content, instead of hiding them after the fact.

This change makes the groups hidden by default, and also changes the logic to see if a group should be displayed when an item is added to the list (as opposed to the previous approach which only did this check once every single test had completed).

Props DavidAnderson, palmiak.
Fixes #47222.
Built from https://develop.svn.wordpress.org/trunk@53950


git-svn-id: http://core.svn.wordpress.org/trunk@53509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Clorith 2022-08-28 19:17:11 +00:00
parent 6f9dd431da
commit 7518c75208
4 changed files with 16 additions and 13 deletions

View File

@ -168,6 +168,13 @@ jQuery( function( $ ) {
$( '.site-health-issue-count-title', issueWrapper ).html( heading );
}
if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
$( '#health-check-issues-critical' ).removeClass( 'hidden' );
}
if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
$( '#health-check-issues-recommended' ).removeClass( 'hidden' );
}
$( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) );
}
@ -210,14 +217,6 @@ jQuery( function( $ ) {
$circle.css( { strokeDashoffset: pct } );
if ( 1 > parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
$( '#health-check-issues-critical' ).addClass( 'hidden' );
}
if ( 1 > parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
$( '#health-check-issues-recommended' ).addClass( 'hidden' );
}
if ( 80 <= val && 0 === parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
$wrapper.addClass( 'green' ).removeClass( 'orange' );

File diff suppressed because one or more lines are too long

View File

@ -233,9 +233,9 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
<?php _e( 'Site Health Status' ); ?>
</h2>
<p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
<p><?php _e( 'The site health check shows information about your WordPress configuration and items that may need your attention.' ); ?></p>
<div class="site-health-issues-wrapper" id="health-check-issues-critical">
<div class="site-health-issues-wrapper hidden" id="health-check-issues-critical">
<h3 class="site-health-issue-count-title">
<?php
/* translators: %s: Number of critical issues found. */
@ -243,10 +243,12 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
?>
</h3>
<p><?php _e( 'Critical issues are items that may have a high impact on your sites performance or security, and resolving these issues should be prioritized.' ); ?></p>
<div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
</div>
<div class="site-health-issues-wrapper" id="health-check-issues-recommended">
<div class="site-health-issues-wrapper hidden" id="health-check-issues-recommended">
<h3 class="site-health-issue-count-title">
<?php
/* translators: %s: Number of recommended improvements. */
@ -254,6 +256,8 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
?>
</h3>
<p><?php _e( 'Recommended items are considered beneficial to your site, although not as important to prioritize as a critical issue, they may include improvements to things such as; Performance, user experience, and more.' ); ?></p>
<div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
</div>
</div>

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53949';
$wp_version = '6.1-alpha-53950';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.