Skip to content

Commit 7a5a5a7

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@50027 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4ea42e3 commit 7a5a5a7

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/js/_enqueues/wp/updates.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@
443443
* decorated with an abort() method.
444444
*/
445445
wp.updates.updatePlugin = function( args ) {
446-
var $updateRow, $card, $message, message;
446+
var $updateRow, $card, $message, message,
447+
$adminBarUpdates = $( '#wp-admin-bar-updates' );
447448

448449
args = _.extend( {
449450
success: wp.updates.updatePluginSuccess,
@@ -471,6 +472,8 @@
471472
$card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove();
472473
}
473474

475+
$adminBarUpdates.addClass( 'spin' );
476+
474477
if ( $message.html() !== __( 'Updating...' ) ) {
475478
$message.data( 'originaltext', $message.html() );
476479
}
@@ -499,7 +502,8 @@
499502
* @param {string} response.newVersion New version of the plugin.
500503
*/
501504
wp.updates.updatePluginSuccess = function( response ) {
502-
var $pluginRow, $updateMessage, newText;
505+
var $pluginRow, $updateMessage, newText,
506+
$adminBarUpdates = $( '#wp-admin-bar-updates' );
503507

504508
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
505509
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
@@ -521,6 +525,8 @@
521525
.addClass( 'button-disabled updated-message' );
522526
}
523527

528+
$adminBarUpdates.removeClass( 'spin' );
529+
524530
$updateMessage
525531
.attr(
526532
'aria-label',
@@ -553,7 +559,8 @@
553559
* @param {string} response.errorMessage The error that occurred.
554560
*/
555561
wp.updates.updatePluginError = function( response ) {
556-
var $card, $message, errorMessage;
562+
var $card, $message, errorMessage,
563+
$adminBarUpdates = $( '#wp-admin-bar-updates' );
557564

558565
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
559566
return;
@@ -631,6 +638,8 @@
631638
} );
632639
}
633640

641+
$adminBarUpdates.removeClass( 'spin' );
642+
634643
wp.a11y.speak( errorMessage, 'assertive' );
635644

636645
$document.trigger( 'wp-plugin-update-error', response );

src/wp-includes/css/admin-bar.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ html:lang(he-il) .rtl #wpadminbar * {
588588
top: 2px;
589589
}
590590

591+
#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before {
592+
display: inline-block;
593+
animation: rotation 2s infinite linear;
594+
}
595+
591596
/**
592597
* Search
593598
*/

0 commit comments

Comments
 (0)