Privacy: Make the progress indicator for export and erasure visible even if not hovered over.

Follow-up to [47246].

Props pbiron, garrett-eclipse.
Fixes #44264.
Built from https://develop.svn.wordpress.org/trunk@47395


git-svn-id: http://core.svn.wordpress.org/trunk@47182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-29 23:45:07 +00:00
parent 46674e2367
commit fcff974c33
7 changed files with 35 additions and 16 deletions

View File

@ -1207,6 +1207,10 @@ table.form-table td .updated p {
color: #72777c;
}
.privacy_requests .row-actions.processing {
position: static;
}
.privacy_requests tbody .has-request-results th {
box-shadow: none;
}

File diff suppressed because one or more lines are too long

View File

@ -1206,6 +1206,10 @@ table.form-table td .updated p {
color: #72777c;
}
.privacy_requests .row-actions.processing {
position: static;
}
.privacy_requests tbody .has-request-results th {
box-shadow: none;
}

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,7 @@ jQuery( document ).ready( function( $ ) {
$action = $this.parents( '.export-personal-data' ),
$requestRow = $this.parents( 'tr' ),
$progress = $requestRow.find( '.export-progress' ),
$rowActions = $this.parents( '.row-actions' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
exportersCount = $action.data( 'exporters-count' ),
@ -68,6 +69,8 @@ jQuery( document ).ready( function( $ ) {
event.preventDefault();
event.stopPropagation();
$rowActions.addClass( 'processing' );
$action.blur();
clearResultsAfterRow( $requestRow );
setExportProgress( 0 );
@ -78,13 +81,14 @@ jQuery( document ).ready( function( $ ) {
setActionState( $action, 'export-personal-data-success' );
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] );
$this.hide();
if ( 'undefined' !== typeof zipUrl ) {
window.location = zipUrl;
} else if ( ! sendAsEmail ) {
onExportFailure( strings.noExportFile );
}
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
}
function onExportFailure( errorMessage ) {
@ -92,6 +96,8 @@ jQuery( document ).ready( function( $ ) {
if ( errorMessage ) {
appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
}
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
}
function setExportProgress( exporterIndex ) {
@ -118,26 +124,24 @@ jQuery( document ).ready( function( $ ) {
var responseData = response.data;
if ( ! response.success ) {
// e.g. invalid request ID.
onExportFailure( response.data );
setTimeout( function(){ onExportFailure( response.data ); }, 500 );
return;
}
if ( ! responseData.done ) {
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
} else {
setExportProgress( exporterIndex );
if ( exporterIndex < exportersCount ) {
setExportProgress( exporterIndex );
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
} else {
onExportDoneSuccess( responseData.url );
setTimeout( function(){ onExportDoneSuccess( responseData.url ); }, 500 );
}
}
}).fail( function( jqxhr, textStatus, error ) {
// e.g. Nonce failure.
onExportFailure( error );
setTimeout( function(){ onExportFailure( error ); }, 500 );
});
}
@ -151,6 +155,7 @@ jQuery( document ).ready( function( $ ) {
$action = $this.parents( '.remove-personal-data' ),
$requestRow = $this.parents( 'tr' ),
$progress = $requestRow.find( '.erasure-progress' ),
$rowActions = $this.parents( '.row-actions' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
erasersCount = $action.data( 'erasers-count' ),
@ -158,8 +163,11 @@ jQuery( document ).ready( function( $ ) {
hasRetained = false,
messages = [];
event.preventDefault();
event.stopPropagation();
$rowActions.addClass( 'processing' );
$action.blur();
clearResultsAfterRow( $requestRow );
setErasureProgress( 0 );
@ -186,12 +194,15 @@ jQuery( document ).ready( function( $ ) {
}
}
appendResultsAfterRow( $requestRow, classes, summaryMessage, messages );
$this.hide();
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
}
function onErasureFailure() {
setActionState( $action, 'remove-personal-data-failed' );
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
setTimeout( function(){ $rowActions.removeClass( 'processing' ); }, 500 );
}
function setErasureProgress( eraserIndex ) {
@ -215,7 +226,7 @@ jQuery( document ).ready( function( $ ) {
var responseData = response.data;
if ( ! response.success ) {
onErasureFailure();
setTimeout( function(){ onErasureFailure(); }, 500 );
return;
}
if ( responseData.items_removed ) {
@ -230,15 +241,15 @@ jQuery( document ).ready( function( $ ) {
if ( ! responseData.done ) {
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
} else {
setErasureProgress( eraserIndex );
if ( eraserIndex < erasersCount ) {
setErasureProgress( eraserIndex );
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
} else {
onErasureDoneSuccess();
setTimeout( function(){ onErasureDoneSuccess(); }, 500 );
}
}
}).fail( function() {
onErasureFailure();
setTimeout( function(){ onErasureFailure(); }, 500 );
});
}

View File

@ -1,2 +1,2 @@
/*! This file is auto-generated */
jQuery(document).ready(function(f){var h=window.privacyToolsL10n||{};function g(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function x(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function w(e,t,a,n){var o="",r="request-results";x(e),n.length&&(f.each(n,function(e,t){o=o+"<li>"+t+"</li>"}),o="<ul>"+o+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(r+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(r+=" status-request-failed"),e.after(function(){return'<tr class="'+r+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+a+"</p>"+o+"</div></td></tr>"})}f(".export-personal-data-handle").click(function(e){var r=f(this),s=r.parents(".export-personal-data"),i=r.parents("tr"),n=i.find(".export-progress"),t=s.data("request-id"),d=s.data("nonce"),c=s.data("exporters-count"),l=!!s.data("send-as-email");function u(e){g(s,"export-personal-data-failed"),e&&w(i,"notice-error",h.exportError,[e])}function p(e){var t=0<c?e/c:0,a=Math.round(100*t).toString()+"%";n.html(a)}e.preventDefault(),e.stopPropagation(),s.blur(),x(i),p(0),g(s,"export-personal-data-processing"),function a(n,o){f.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:n,id:t,page:o,security:d,sendAsEmail:l},method:"post"}).done(function(e){var t=e.data;e.success?t.done?n<c?(p(n),setTimeout(a(n+1,1))):function(e){var t=h.emailSent;g(s,"export-personal-data-success"),w(i,"notice-success",t,[]),r.hide(),void 0!==e?window.location=e:l||u(h.noExportFile)}(t.url):setTimeout(a(n,o+1)):u(e.data)}).fail(function(e,t,a){u(a)})}(1,1)}),f(".remove-personal-data-handle").click(function(e){var r=f(this),s=r.parents(".remove-personal-data"),i=r.parents("tr"),n=i.find(".erasure-progress"),t=s.data("request-id"),d=s.data("nonce"),c=s.data("erasers-count"),l=!1,u=!1,p=[];function m(){g(s,"remove-personal-data-failed"),w(i,"notice-error",h.removalError,[])}function v(e){var t=0<c?e/c:0,a=Math.round(100*t).toString()+"%";n.html(a)}e.stopPropagation(),s.blur(),x(i),v(0),g(s,"remove-personal-data-processing"),function a(n,o){f.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:n,id:t,page:o,security:d},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(l=l||t.items_removed),t.items_retained&&(u=u||t.items_retained),t.messages&&(p=p.concat(t.messages)),t.done?n<c?(v(n),setTimeout(a(n+1,1))):function(){var e=h.noDataFound,t="notice-success";g(s,"remove-personal-data-success"),!1===l?!1===u?e=h.noDataFound:(e=h.noneRemoved,t="notice-warning"):!1===u?e=h.foundAndRemoved:(e=h.someNotRemoved,t="notice-warning"),w(i,t,e,p),r.hide()}():setTimeout(a(n,o+1))):m()}).fail(function(){m()})}(1,1)}),f(document).on("click",function(e){var t,a,n,o=f(e.target);if(o.is("button.privacy-text-copy")&&((a=(t=o.parent().parent()).find("div.wp-suggested-text")).length||(a=t.find("div.policy-text")),a.length))try{window.getSelection().removeAllRanges(),n=document.createRange(),a.addClass("hide-privacy-policy-tutorial"),n.selectNodeContents(a[0]),window.getSelection().addRange(n),document.execCommand("copy"),a.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(e){}})});
jQuery(document).ready(function(g){var h=window.privacyToolsL10n||{};function w(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function x(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function C(e,t,n,a){var o="",s="request-results";x(e),a.length&&(g.each(a,function(e,t){o=o+"<li>"+t+"</li>"}),o="<ul>"+o+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(s+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(s+=" status-request-failed"),e.after(function(){return'<tr class="'+s+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+n+"</p>"+o+"</div></td></tr>"})}g(".export-personal-data-handle").click(function(e){var t=g(this),s=t.parents(".export-personal-data"),r=t.parents("tr"),a=r.find(".export-progress"),i=t.parents(".row-actions"),c=s.data("request-id"),d=s.data("nonce"),u=s.data("exporters-count"),l=!!s.data("send-as-email");function p(e){w(s,"export-personal-data-failed"),e&&C(r,"notice-error",h.exportError,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){var t=0<u?e/u:0,n=Math.round(100*t).toString()+"%";a.html(n)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),s.blur(),x(r),m(0),w(s,"export-personal-data-processing"),function n(a,o){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:a,id:c,page:o,security:d,sendAsEmail:l},method:"post"}).done(function(e){var t=e.data;e.success?t.done?(m(a),a<u?setTimeout(n(a+1,1)):setTimeout(function(){!function(e){var t=h.emailSent;w(s,"export-personal-data-success"),C(r,"notice-success",t,[]),void 0!==e?window.location=e:l||p(h.noExportFile),setTimeout(function(){i.removeClass("processing")},500)}(t.url)},500)):setTimeout(n(a,o+1)):setTimeout(function(){p(e.data)},500)}).fail(function(e,t,n){setTimeout(function(){p(n)},500)})}(1,1)}),g(".remove-personal-data-handle").click(function(e){var t=g(this),s=t.parents(".remove-personal-data"),r=t.parents("tr"),a=r.find(".erasure-progress"),i=t.parents(".row-actions"),c=s.data("request-id"),d=s.data("nonce"),u=s.data("erasers-count"),l=!1,p=!1,m=[];function f(){w(s,"remove-personal-data-failed"),C(r,"notice-error",h.removalError,[]),setTimeout(function(){i.removeClass("processing")},500)}function v(e){var t=0<u?e/u:0,n=Math.round(100*t).toString()+"%";a.html(n)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),s.blur(),x(r),v(0),w(s,"remove-personal-data-processing"),function n(a,o){g.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:a,id:c,page:o,security:d},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(l=l||t.items_removed),t.items_retained&&(p=p||t.items_retained),t.messages&&(m=m.concat(t.messages)),t.done?(v(a),a<u?setTimeout(n(a+1,1)):setTimeout(function(){!function(){var e=h.noDataFound,t="notice-success";w(s,"remove-personal-data-success"),!1===l?!1===p?e=h.noDataFound:(e=h.noneRemoved,t="notice-warning"):!1===p?e=h.foundAndRemoved:(e=h.someNotRemoved,t="notice-warning"),C(r,t,e,m),setTimeout(function(){i.removeClass("processing")},500)}()},500)):setTimeout(n(a,o+1))):setTimeout(function(){f()},500)}).fail(function(){setTimeout(function(){f()},500)})}(1,1)}),g(document).on("click",function(e){var t,n,a,o=g(e.target);if(o.is("button.privacy-text-copy")&&((n=(t=o.parent().parent()).find("div.wp-suggested-text")).length||(n=t.find("div.policy-text")),n.length))try{window.getSelection().removeAllRanges(),a=document.createRange(),n.addClass("hide-privacy-policy-tutorial"),a.selectNodeContents(n[0]),window.getSelection().addRange(a),document.execCommand("copy"),n.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(e){}})});

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-beta3-47394';
$wp_version = '5.4-beta3-47395';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.