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 ),
|
var $this = $( this ),
|
||||||
$action = $this.parents( '.export-personal-data' ),
|
$action = $this.parents( '.export-personal-data' ),
|
||||||
$requestRow = $this.parents( 'tr' ),
|
$requestRow = $this.parents( 'tr' ),
|
||||||
|
$progress = $requestRow.find( '.export-progress' );
|
||||||
requestID = $action.data( 'request-id' ),
|
requestID = $action.data( 'request-id' ),
|
||||||
nonce = $action.data( 'nonce' ),
|
nonce = $action.data( 'nonce' ),
|
||||||
exportersCount = $action.data( 'exporters-count' ),
|
exportersCount = $action.data( 'exporters-count' ),
|
||||||
@ -69,6 +70,7 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
|
|
||||||
$action.blur();
|
$action.blur();
|
||||||
clearResultsAfterRow( $requestRow );
|
clearResultsAfterRow( $requestRow );
|
||||||
|
setExportProgress( 0 );
|
||||||
|
|
||||||
function onExportDoneSuccess( zipUrl ) {
|
function onExportDoneSuccess( zipUrl ) {
|
||||||
var summaryMessage = strings.emailSent;
|
var summaryMessage = strings.emailSent;
|
||||||
@ -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 ) {
|
function doNextExport( exporterIndex, pageIndex ) {
|
||||||
$.ajax(
|
$.ajax(
|
||||||
{
|
{
|
||||||
@ -120,6 +128,7 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
|
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
|
||||||
} else {
|
} else {
|
||||||
if ( exporterIndex < exportersCount ) {
|
if ( exporterIndex < exportersCount ) {
|
||||||
|
setExportProgress( exporterIndex );
|
||||||
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
||||||
} else {
|
} else {
|
||||||
onExportDoneSuccess( responseData.url );
|
onExportDoneSuccess( responseData.url );
|
||||||
@ -141,6 +150,7 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
var $this = $( this ),
|
var $this = $( this ),
|
||||||
$action = $this.parents( '.remove-personal-data' ),
|
$action = $this.parents( '.remove-personal-data' ),
|
||||||
$requestRow = $this.parents( 'tr' ),
|
$requestRow = $this.parents( 'tr' ),
|
||||||
|
$progress = $requestRow.find( '.erasure-progress' );
|
||||||
requestID = $action.data( 'request-id' ),
|
requestID = $action.data( 'request-id' ),
|
||||||
nonce = $action.data( 'nonce' ),
|
nonce = $action.data( 'nonce' ),
|
||||||
erasersCount = $action.data( 'erasers-count' ),
|
erasersCount = $action.data( 'erasers-count' ),
|
||||||
@ -152,6 +162,7 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
|
|
||||||
$action.blur();
|
$action.blur();
|
||||||
clearResultsAfterRow( $requestRow );
|
clearResultsAfterRow( $requestRow );
|
||||||
|
setErasureProgress( 0 );
|
||||||
|
|
||||||
function onErasureDoneSuccess() {
|
function onErasureDoneSuccess() {
|
||||||
var summaryMessage = strings.noDataFound;
|
var summaryMessage = strings.noDataFound;
|
||||||
@ -183,6 +194,12 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
|
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 ) {
|
function doNextErasure( eraserIndex, pageIndex ) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: window.ajaxurl,
|
url: window.ajaxurl,
|
||||||
@ -214,6 +231,7 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
|
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
|
||||||
} else {
|
} else {
|
||||||
if ( eraserIndex < erasersCount ) {
|
if ( eraserIndex < erasersCount ) {
|
||||||
|
setErasureProgress( eraserIndex );
|
||||||
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
||||||
} else {
|
} else {
|
||||||
onErasureDoneSuccess();
|
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>' .
|
$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-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>';
|
'<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-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-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>
|
<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
|
<?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>' .
|
$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-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>';
|
'<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-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-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>
|
<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
|
<?php
|
||||||
|
Loading…
Reference in New Issue
Block a user