Plugins: Rotate the Updates icon in the admin bar when performing inline updates on the Plugins screen.

This provides better indication within the viewport about ongoing processes on the page when updating several plugins at the same time, but without using the bulk updater.

Props ravipatel, audrasjb, johnjamesjacoby, paaljoachim, hellofromTonya, sabernhardt, mdwolinski, karmatosed, SergeyBiryukov.
Fixes #51476.
Built from https://develop.svn.wordpress.org/trunk@50027


git-svn-id: http://core.svn.wordpress.org/trunk@49728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-01-27 10:59:02 +00:00
parent 11ea669f7f
commit 3a695a7be2
7 changed files with 26 additions and 7 deletions

View File

@ -443,7 +443,8 @@
* decorated with an abort() method. * decorated with an abort() method.
*/ */
wp.updates.updatePlugin = function( args ) { wp.updates.updatePlugin = function( args ) {
var $updateRow, $card, $message, message; var $updateRow, $card, $message, message,
$adminBarUpdates = $( '#wp-admin-bar-updates' );
args = _.extend( { args = _.extend( {
success: wp.updates.updatePluginSuccess, success: wp.updates.updatePluginSuccess,
@ -471,6 +472,8 @@
$card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove(); $card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove();
} }
$adminBarUpdates.addClass( 'spin' );
if ( $message.html() !== __( 'Updating...' ) ) { if ( $message.html() !== __( 'Updating...' ) ) {
$message.data( 'originaltext', $message.html() ); $message.data( 'originaltext', $message.html() );
} }
@ -499,7 +502,8 @@
* @param {string} response.newVersion New version of the plugin. * @param {string} response.newVersion New version of the plugin.
*/ */
wp.updates.updatePluginSuccess = function( response ) { wp.updates.updatePluginSuccess = function( response ) {
var $pluginRow, $updateMessage, newText; var $pluginRow, $updateMessage, newText,
$adminBarUpdates = $( '#wp-admin-bar-updates' );
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' ) $pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
@ -521,6 +525,8 @@
.addClass( 'button-disabled updated-message' ); .addClass( 'button-disabled updated-message' );
} }
$adminBarUpdates.removeClass( 'spin' );
$updateMessage $updateMessage
.attr( .attr(
'aria-label', 'aria-label',
@ -553,7 +559,8 @@
* @param {string} response.errorMessage The error that occurred. * @param {string} response.errorMessage The error that occurred.
*/ */
wp.updates.updatePluginError = function( response ) { wp.updates.updatePluginError = function( response ) {
var $card, $message, errorMessage; var $card, $message, errorMessage,
$adminBarUpdates = $( '#wp-admin-bar-updates' );
if ( ! wp.updates.isValidResponse( response, 'update' ) ) { if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
return; return;
@ -631,6 +638,8 @@
} ); } );
} }
$adminBarUpdates.removeClass( 'spin' );
wp.a11y.speak( errorMessage, 'assertive' ); wp.a11y.speak( errorMessage, 'assertive' );
$document.trigger( 'wp-plugin-update-error', response ); $document.trigger( 'wp-plugin-update-error', response );

File diff suppressed because one or more lines are too long

View File

@ -589,6 +589,11 @@ html:lang(he-il) .rtl #wpadminbar * {
top: 2px; top: 2px;
} }
#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before {
display: inline-block;
animation: rotation 2s infinite linear;
}
/** /**
* Search * Search
*/ */

File diff suppressed because one or more lines are too long

View File

@ -588,6 +588,11 @@ html:lang(he-il) .rtl #wpadminbar * {
top: 2px; top: 2px;
} }
#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before {
display: inline-block;
animation: rotation 2s infinite linear;
}
/** /**
* Search * Search
*/ */

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7-alpha-50026'; $wp_version = '5.7-alpha-50027';
/** /**
* 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.