Privacy: Give progress indication for export and erasure.
This adds a progress indicator for "Download Personal Data" and "Erase Personal Data" row actions, which can take a while with a lot of data. Props garrett-eclipse, allendav, dominic_ks, xkon, karmatosed, birgire. Fixes #44264. git-svn-id: https://develop.svn.wordpress.org/trunk@47246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c0c2fd3f63
commit
a6a02eaca7
@ -59,6 +59,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
var $this = $( this ),
|
||||
$action = $this.parents( '.export-personal-data' ),
|
||||
$requestRow = $this.parents( 'tr' ),
|
||||
$progress = $requestRow.find( '.export-progress' );
|
||||
requestID = $action.data( 'request-id' ),
|
||||
nonce = $action.data( 'nonce' ),
|
||||
exportersCount = $action.data( 'exporters-count' ),
|
||||
@ -69,6 +70,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$action.blur();
|
||||
clearResultsAfterRow( $requestRow );
|
||||
setExportProgress( 0 );
|
||||
|
||||
function onExportDoneSuccess( zipUrl ) {
|
||||
var summaryMessage = strings.emailSent;
|
||||
@ -77,7 +79,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
|
||||
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] );
|
||||
$this.hide();
|
||||
|
||||
|
||||
if ( 'undefined' !== typeof zipUrl ) {
|
||||
window.location = zipUrl;
|
||||
} else if ( ! sendAsEmail ) {
|
||||
@ -92,6 +94,12 @@ jQuery( document ).ready( function( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
function setExportProgress( exporterIndex ) {
|
||||
var progress = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 );
|
||||
var progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
$progress.html( progressString );
|
||||
}
|
||||
|
||||
function doNextExport( exporterIndex, pageIndex ) {
|
||||
$.ajax(
|
||||
{
|
||||
@ -120,6 +128,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
|
||||
} else {
|
||||
if ( exporterIndex < exportersCount ) {
|
||||
setExportProgress( exporterIndex );
|
||||
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
||||
} else {
|
||||
onExportDoneSuccess( responseData.url );
|
||||
@ -141,6 +150,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
var $this = $( this ),
|
||||
$action = $this.parents( '.remove-personal-data' ),
|
||||
$requestRow = $this.parents( 'tr' ),
|
||||
$progress = $requestRow.find( '.erasure-progress' );
|
||||
requestID = $action.data( 'request-id' ),
|
||||
nonce = $action.data( 'nonce' ),
|
||||
erasersCount = $action.data( 'erasers-count' ),
|
||||
@ -152,6 +162,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$action.blur();
|
||||
clearResultsAfterRow( $requestRow );
|
||||
setErasureProgress( 0 );
|
||||
|
||||
function onErasureDoneSuccess() {
|
||||
var summaryMessage = strings.noDataFound;
|
||||
@ -183,6 +194,12 @@ jQuery( document ).ready( function( $ ) {
|
||||
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
|
||||
}
|
||||
|
||||
function setErasureProgress( eraserIndex ) {
|
||||
var progress = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 );
|
||||
var progressString = Math.round( progress * 100 ).toString() + '%';
|
||||
$progress.html( progressString );
|
||||
}
|
||||
|
||||
function doNextErasure( eraserIndex, pageIndex ) {
|
||||
$.ajax({
|
||||
url: window.ajaxurl,
|
||||
@ -214,6 +231,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
|
||||
} else {
|
||||
if ( eraserIndex < erasersCount ) {
|
||||
setErasureProgress( eraserIndex );
|
||||
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
||||
} else {
|
||||
onErasureDoneSuccess();
|
||||
|
@ -57,7 +57,7 @@ class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Tab
|
||||
'">';
|
||||
|
||||
$download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
|
||||
'<span class="export-personal-data-processing hidden">' . __( 'Downloading Data...' ) . '</span>' .
|
||||
'<span class="export-personal-data-processing hidden">' . __( 'Downloading Data...' ) . ' <span class="export-progress"></span></span>' .
|
||||
'<span class="export-personal-data-success hidden"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
|
||||
'<span class="export-personal-data-failed hidden">' . __( 'Download failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
|
||||
|
||||
@ -100,7 +100,7 @@ class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Tab
|
||||
|
||||
?>
|
||||
<span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Send Export Link' ); ?></button></span>
|
||||
<span class="export-personal-data-processing button updating-message hidden"><?php _e( 'Sending Email...' ); ?></span>
|
||||
<span class="export-personal-data-processing button updating-message hidden"><?php _e( 'Sending Email...' ); ?> <span class="export-progress"></span></span>
|
||||
<span class="export-personal-data-success success-message hidden"><?php _e( 'Email sent.' ); ?></span>
|
||||
<span class="export-personal-data-failed hidden"><?php _e( 'Email could not be sent.' ); ?> <button type="button" class="button export-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||
<?php
|
||||
|
@ -62,7 +62,7 @@ class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Ta
|
||||
'">';
|
||||
|
||||
$remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force Erase Personal Data' ) . '</button></span>' .
|
||||
'<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . '</span>' .
|
||||
'<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . ' <span class="erasure-progress"></span></span>' .
|
||||
'<span class="remove-personal-data-success hidden">' . __( 'Erasure completed.' ) . '</span>' .
|
||||
'<span class="remove-personal-data-failed hidden">' . __( 'Force Erasure has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
|
||||
|
||||
@ -106,7 +106,7 @@ class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Ta
|
||||
|
||||
?>
|
||||
<span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
|
||||
<span class="remove-personal-data-processing button updating-message hidden"><?php _e( 'Erasing Data...' ); ?></span>
|
||||
<span class="remove-personal-data-processing button updating-message hidden"><?php _e( 'Erasing Data...' ); ?> <span class="erasure-progress"></span></span>
|
||||
<span class="remove-personal-data-success success-message hidden" ><?php _e( 'Erasure completed.' ); ?></span>
|
||||
<span class="remove-personal-data-failed hidden"><?php _e( 'Data Erasure has failed.' ); ?> <button type="button" class="button remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||
<?php
|
||||
|
@ -156,8 +156,8 @@ class Tests_User_WpPrivacySendRequestConfirmationNotification extends WP_UnitTes
|
||||
*
|
||||
* @since 4.9.8
|
||||
*
|
||||
* @param string $admin_email The email address of the notification recipient.
|
||||
* @param WP_User_Request $request The request that is initiating the notification.
|
||||
* @param string $admin_email The email address of the notification recipient.
|
||||
* @param WP_User_Request $request The request that is initiating the notification.
|
||||
* @return string Admin email address.
|
||||
*/
|
||||
public function modify_email_address( $admin_email, $request ) {
|
||||
|
Loading…
Reference in New Issue
Block a user