Site health: Add a menu bubble with the critical issues count to the Tools -> Site Health submenu.

Props: Clorith
See: #56199

Built from https://develop.svn.wordpress.org/trunk@54165


git-svn-id: http://core.svn.wordpress.org/trunk@53724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2022-09-14 21:14:14 +00:00
parent ae532c8ef2
commit 136dc2b108
41 changed files with 74 additions and 21 deletions

View File

@ -428,6 +428,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* @todo: consider to use a single rule for these counters and the list table comments counters. */ /* @todo: consider to use a single rule for these counters and the list table comments counters. */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
display: inline-block; display: inline-block;

File diff suppressed because one or more lines are too long

View File

@ -427,6 +427,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* @todo: consider to use a single rule for these counters and the list table comments counters. */ /* @todo: consider to use a single rule for these counters and the list table comments counters. */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
display: inline-block; display: inline-block;

File diff suppressed because one or more lines are too long

View File

@ -350,6 +350,7 @@ ul#adminmenu > li.current > a.current:after {
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: $menu-bubble-text; color: $menu-bubble-text;

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -292,6 +292,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -292,6 +292,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -292,6 +292,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -292,6 +292,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -325,6 +325,7 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: bubble */ /* Admin Menu: bubble */
#adminmenu .menu-counter,
#adminmenu .awaiting-mod, #adminmenu .awaiting-mod,
#adminmenu .update-plugins { #adminmenu .update-plugins {
color: #fff; color: #fff;

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,8 @@ jQuery( function( $ ) {
isStatusTab = $( '.health-check-body.health-check-status-tab' ).length, isStatusTab = $( '.health-check-body.health-check-status-tab' ).length,
isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length, isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length,
pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ), pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ),
menuCounterWrapper = $( '#adminmenu .site-health-counter' ),
menuCounter = $( '#adminmenu .site-health-counter .count' ),
successTimeout; successTimeout;
// Debug information copy section. // Debug information copy section.
@ -164,8 +166,14 @@ jQuery( function( $ ) {
$( '.site-health-issue-count-title', issueWrapper ).html( heading ); $( '.site-health-issue-count-title', issueWrapper ).html( heading );
} }
menuCounter.text( SiteHealth.site_status.issues.critical );
if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) { if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
$( '#health-check-issues-critical' ).removeClass( 'hidden' ); $( '#health-check-issues-critical' ).removeClass( 'hidden' );
menuCounterWrapper.removeClass( 'count-0' );
} else {
menuCounterWrapper.addClass( 'count-0' );
} }
if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) { if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
$( '#health-check-issues-recommended' ).removeClass( 'hidden' ); $( '#health-check-issues-recommended' ).removeClass( 'hidden' );

File diff suppressed because one or more lines are too long

View File

@ -342,11 +342,37 @@ if ( current_user_can( 'list_users' ) ) {
} }
} }
$site_health_count = '';
if ( ! is_multisite() && current_user_can( 'view_site_health_checks' ) ) {
$get_issues = get_transient( 'health-check-site-status-result' );
$issue_counts = array();
if ( false !== $get_issues ) {
$issue_counts = json_decode( $get_issues, true );
}
if ( ! is_array( $issue_counts ) || ! $issue_counts ) {
$issue_counts = array(
'good' => 0,
'recommended' => 0,
'critical' => 0,
);
}
$site_health_count = sprintf(
'<span class="menu-counter site-health-counter count-%s"><span class="count">%s</span></span>',
$issue_counts['critical'],
number_format_i18n( $issue_counts['critical'] )
);
}
$menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' ); $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
$submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' ); $submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' ); $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' ); $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
$submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' ); /* translators: %s: Number of critical Site Health checks. */
$submenu['tools.php'][20] = array( sprintf( __( 'Site Health %s' ), $site_health_count ), 'view_site_health_checks', 'site-health.php' );
$submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' ); $submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
$submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' ); $submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
if ( is_multisite() && ! is_main_site() ) { if ( is_multisite() && ! is_main_site() ) {

View File

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