wp.updates.updateError = function( response ) {
var $message, name;
wp.updates.updateDoneSuccessfully = false;
- if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' ) {
+ if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' && wp.updates.shouldRequestFilesystemCredentials ) {
wp.updates.credentialError( response, 'update-plugin' );
return;
}
$message.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', name ) );
}
$message.removeClass( 'updating-message' );
- $message.text( wp.updates.l10n.updateFailed );
+ $message.html( wp.updates.l10n.updateFailed + ': ' + response.error );
wp.a11y.speak( wp.updates.l10n.updateFailed );
+ /*
+ * The lock can be released since this failure was
+ * after the credentials form.
+ */
+ wp.updates.updateLock = false;
+
$(document).trigger( 'wp-plugin-update-error', response );
+
+ wp.updates.queueChecker();
};
/**
wp.updates.requestForCredentialsModalCancel();
});
+ // Hide SSH fields when not selected
+ $( '#request-filesystem-credentials-dialog input[name="connection_type"]' ).on( 'change', function() {
+ $( this ).parents( 'form' ).find( '#private_key, #public_key' ).parents( 'label' ).toggle( ( 'ssh' == $( this ).val() ) );
+ }).change();
+
// Click handler for plugin updates in List Table view.
$( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) {
e.preventDefault();
wp.updates.updatePlugin( $button.data( 'plugin' ), $button.data( 'slug' ) );
} );
- //
$( '#plugin_update_from_iframe' ).on( 'click' , function( e ) {
var target, data;