← All changes
|
modules/optimization/assets/js/classes/control/control-sync.js
+6
-0
1.6.3
→
1.7.7
View file →
| @@ -29,8 +29,9 @@ | ||
| 29 | 29 | |
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + // Required check as the status endpoint doesn't return validation errors | |
| 33 | 34 | if ( currentStatus === 'error' && ! new ControlMeta( controlWrapper ).allowRetry() ) { |
| 34 | 35 | return; |
| 35 | 36 | } |
| 36 | 37 | |
| @@ -56,8 +57,9 @@ | ||
| 56 | 57 | break; |
| 57 | 58 | |
| 58 | 59 | case 'optimized': |
| 59 | 60 | const statsData = { |
| 61 | + sizesTotal: imageData.stats.total_image_count, | |
| 60 | 62 | sizesOptimized: imageData.stats.optimized_image_count, |
| 61 | 63 | saved: { |
| 62 | 64 | absolute: imageData.stats.initial_image_size - imageData.stats.current_image_size, |
| 63 | 65 | relative: Math.max( 100 - Math.round( imageData.stats.current_image_size / imageData.stats.initial_image_size * 100 ), 0 ), |
| @@ -70,9 +72,11 @@ | ||
| 70 | 72 | |
| 71 | 73 | case 'optimization-failed': |
| 72 | 74 | controlStates.renderError( { |
| 73 | 75 | message: imageData.message, |
| 76 | + errorType: imageData.error_type, | |
| 74 | 77 | imagesLeft: imageData.images_left, |
| 78 | + allowRetry: new ControlMeta( controlWrapper ).allowRetry(), | |
| 75 | 79 | action: 'optimize', |
| 76 | 80 | } ); |
| 77 | 81 | |
| 78 | 82 | break; |
| @@ -79,9 +83,11 @@ | ||
| 79 | 83 | |
| 80 | 84 | case 'reoptimizing-failed': |
| 81 | 85 | controlStates.renderError( { |
| 82 | 86 | message: imageData.message, |
| 87 | + errorType: imageData.error_type, | |
| 83 | 88 | imagesLeft: imageData.images_left, |
| 89 | + allowRetry: new ControlMeta( controlWrapper ).allowRetry(), | |
| 84 | 90 | action: 'reoptimize', |
| 85 | 91 | } ); |
| 86 | 92 | |
| 87 | 93 | break; |