Make WordPress Core

Changeset 47246


Ignore:
Timestamp:
02/10/2020 08:17:58 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/privacy-tools.js

    r47122 r47246  
    6060            $action        = $this.parents( '.export-personal-data' ),
    6161            $requestRow    = $this.parents( 'tr' ),
     62            $progress      = $requestRow.find( '.export-progress' );
    6263            requestID      = $action.data( 'request-id' ),
    6364            nonce          = $action.data( 'nonce' ),
     
    7071        $action.blur();
    7172        clearResultsAfterRow( $requestRow );
     73        setExportProgress( 0 );
    7274
    7375        function onExportDoneSuccess( zipUrl ) {
     
    7880            appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] );
    7981            $this.hide();
    80            
     82
    8183            if ( 'undefined' !== typeof zipUrl ) {
    8284                window.location = zipUrl;
     
    9193                appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
    9294            }
     95        }
     96
     97        function setExportProgress( exporterIndex ) {
     98            var progress       = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 );
     99            var progressString = Math.round( progress * 100 ).toString() + '%';
     100            $progress.html( progressString );
    93101        }
    94102
     
    121129                } else {
    122130                    if ( exporterIndex < exportersCount ) {
     131                        setExportProgress( exporterIndex );
    123132                        setTimeout( doNextExport( exporterIndex + 1, 1 ) );
    124133                    } else {
     
    142151            $action       = $this.parents( '.remove-personal-data' ),
    143152            $requestRow   = $this.parents( 'tr' ),
     153            $progress     = $requestRow.find( '.erasure-progress' );
    144154            requestID     = $action.data( 'request-id' ),
    145155            nonce         = $action.data( 'nonce' ),
     
    153163        $action.blur();
    154164        clearResultsAfterRow( $requestRow );
     165        setErasureProgress( 0 );
    155166
    156167        function onErasureDoneSuccess() {
     
    182193            setActionState( $action, 'remove-personal-data-failed' );
    183194            appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
     195        }
     196
     197        function setErasureProgress( eraserIndex ) {
     198            var progress       = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 );
     199            var progressString = Math.round( progress * 100 ).toString() + '%';
     200            $progress.html( progressString );
    184201        }
    185202
     
    215232                } else {
    216233                    if ( eraserIndex < erasersCount ) {
     234                        setErasureProgress( eraserIndex );
    217235                        setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
    218236                    } else {
  • trunk/src/wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php

    r47198 r47246  
    5858
    5959        $download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
    60             '<span class="export-personal-data-processing hidden">' . __( 'Downloading Data...' ) . '</span>' .
     60            '<span class="export-personal-data-processing hidden">' . __( 'Downloading Data...' ) . ' <span class="export-progress"></span></span>' .
    6161            '<span class="export-personal-data-success hidden"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
    6262            '<span class="export-personal-data-failed hidden">' . __( 'Download failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
     
    101101                ?>
    102102                <span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Send Export Link' ); ?></button></span>
    103                 <span class="export-personal-data-processing button updating-message hidden"><?php _e( 'Sending Email...' ); ?></span>
     103                <span class="export-personal-data-processing button updating-message hidden"><?php _e( 'Sending Email...' ); ?> <span class="export-progress"></span></span>
    104104                <span class="export-personal-data-success success-message hidden"><?php _e( 'Email sent.' ); ?></span>
    105105                <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>
  • trunk/src/wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php

    r47198 r47246  
    6363
    6464            $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>' .
    65                 '<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . '</span>' .
     65                '<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . ' <span class="erasure-progress"></span></span>' .
    6666                '<span class="remove-personal-data-success hidden">' . __( 'Erasure completed.' ) . '</span>' .
    6767                '<span class="remove-personal-data-failed hidden">' . __( 'Force Erasure has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
     
    107107                ?>
    108108                <span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
    109                 <span class="remove-personal-data-processing button updating-message hidden"><?php _e( 'Erasing Data...' ); ?></span>
     109                <span class="remove-personal-data-processing button updating-message hidden"><?php _e( 'Erasing Data...' ); ?> <span class="erasure-progress"></span></span>
    110110                <span class="remove-personal-data-success success-message hidden" ><?php _e( 'Erasure completed.' ); ?></span>
    111111                <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>
  • trunk/tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php

    r47245 r47246  
    157157     * @since 4.9.8
    158158     *
    159      * @param string          $admin_email  The email address of the notification recipient.
    160      * @param WP_User_Request $request The request that is initiating the notification.
     159     * @param string          $admin_email The email address of the notification recipient.
     160     * @param WP_User_Request $request     The request that is initiating the notification.
    161161     * @return string Admin email address.
    162162     */
Note: See TracChangeset for help on using the changeset viewer.