Ticket #47046: 47046.patch
File 47046.patch, 6.9 KB (added by , 6 years ago) |
---|
-
src/js/_enqueues/admin/site-health.js
87 87 function RecalculateProgression() { 88 88 var r, c, pct; 89 89 var $progress = $( '.site-health-progress' ); 90 var $progressCount = $progress.find( '.site-health-progress-count' ); 90 var $wrapper = $progress.closest( '.site-health-progress-wrapper' ); 91 var $progressLabel = $( '.site-health-progress-label', $wrapper ); 91 92 var $circle = $( '.site-health-progress svg #bar' ); 92 93 var totalTests = parseInt( SiteHealth.site_status.issues.good, 0 ) + parseInt( SiteHealth.site_status.issues.recommended, 0 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 ); 93 var failedTests = parseInt( SiteHealth.site_status.issues.recommended, 0) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 );94 var failedTests = ( parseInt( SiteHealth.site_status.issues.recommended, 0 ) * 0.5 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 ); 94 95 var val = 100 - Math.ceil( ( failedTests / totalTests ) * 100 ); 95 96 96 97 if ( 0 === totalTests ) { … … 98 99 return; 99 100 } 100 101 101 $ progress.removeClass( 'loading' );102 $wrapper.removeClass( 'loading' ); 102 103 103 104 r = $circle.attr( 'r' ); 104 105 c = Math.PI * ( r * 2 ); … … 122 123 $( '#health-check-issues-recommended' ).addClass( 'hidden' ); 123 124 } 124 125 125 if ( 50 <= val ) { 126 $circle.addClass( 'orange' ).removeClass( 'red' ); 127 } 126 if ( 80 <= val && 0 === parseInt( SiteHealth.site_status.issues.critical, 0 ) ) { 127 $wrapper.addClass( 'green' ).removeClass( 'orange' ); 128 128 129 if ( 90 <= val ) { 130 $circle.addClass( 'green' ).removeClass( 'orange' ); 131 } 129 $progressLabel.text( __( 'Good' ) ); 130 wp.a11y.speak( __( 'All site health tests have finished running. Your site is looking good, and the results are now available on the page.' ) ); 131 } else { 132 $wrapper.addClass( 'orange' ).removeClass( 'green' ); 132 133 133 if ( 100 === val ) { 134 $( '.site-status-all-clear' ).removeClass( 'hide' ); 135 $( '.site-status-has-issues' ).addClass( 'hide' ); 134 $progressLabel.text( __( 'Should be improved' ) ); 135 wp.a11y.speak( __( 'All site health tests have finished running. There are items that should be addressed, and the results are now available on the page.' ) ); 136 136 } 137 138 $progressCount.text( val + '%' );139 137 140 138 if ( ! isDebugTab ) { 141 139 $.post( … … 147 145 } 148 146 ); 149 147 150 wp.a11y.speak( sprintf( 151 // translators: %s: The percentage score for the tests. 152 __( 'All site health tests have finished running. Your site scored %s, and the results are now available on the page.' ), 153 val + '%' 154 ) ); 148 if ( 100 === val ) { 149 $( '.site-status-all-clear' ).removeClass( 'hide' ); 150 $( '.site-status-has-issues' ).addClass( 'hide' ); 151 } 155 152 } 156 153 } 157 154 -
src/wp-admin/site-health.php
39 39 <h1> 40 40 <?php _e( 'Site Health' ); ?> 41 41 </h1> 42 </div> 42 43 43 <div class="site-health-progress hide-if-no-js loading"> 44 <div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js"> 45 <div class="site-health-progress"> 44 46 <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"> 45 47 <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> 46 48 <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> 47 49 </svg> 48 <span class="screen-reader-text"><?php _e( 'Current health score:' ); ?></span> 49 <span class="site-health-progress-count"></span> 50 </div> 51 <div class="site-health-progress-label"> 52 <?php _e( 'Results are still loading…' ); ?> 50 53 </div> 51 54 </div> 52 55 -
src/wp-admin/site-health-info.php
34 34 <h1> 35 35 <?php _e( 'Site Health' ); ?> 36 36 </h1> 37 </div> 37 38 38 <div class="site-health-progress hide-if-no-js loading"> 39 <div class="health-check-title-section site-health-progress-wrapper loading hide-if-no-js"> 40 <div class="site-health-progress"> 39 41 <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"> 40 42 <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> 41 43 <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle> 42 44 </svg> 43 <span class="screen-reader-text"><?php _e( 'Current health score:' ); ?></span> 44 <span class="site-health-progress-count"></span> 45 </div> 46 <div class="site-health-progress-label"> 47 <?php _e( 'Results are still loading…' ); ?> 45 48 </div> 46 49 </div> 47 50 -
src/wp-admin/css/site-health.css
7 7 .health-check-header h1 { 8 8 display: inline-block; 9 9 font-weight: 600; 10 margin: 1rem 0.8rem;10 margin: 0 0.8rem 1rem; 11 11 font-size: 23px; 12 12 padding: 9px 0 4px 0; 13 13 line-height: 1.3; … … 37 37 clear: both; 38 38 } 39 39 40 .site-health-progress-wrapper { 41 margin-bottom: 1rem; 42 } 43 40 44 .site-health-progress { 41 45 display: inline-block; 42 height: 40px;43 width: 40px;46 height: 20px; 47 width: 20px; 44 48 margin: 0; 45 49 border-radius: 100%; 46 50 position: relative; … … 62 66 font-size: 2em; 63 67 } 64 68 65 .site-health-progress-count::after { 66 content: ""; 67 } 68 69 .site-health-progress.loading .site-health-progress-count::after { 70 content: "···"; 71 } 72 73 .site-health-progress.loading svg #bar { 69 .loading .site-health-progress svg #bar { 74 70 stroke-dashoffset: 0; 75 71 stroke: #adc5d2; 76 72 animation: loadingPulse 3s infinite ease-in-out; … … 88 84 stroke: #dc3232; 89 85 } 90 86 91 . site-health-progress svg #bar.green{87 .green .site-health-progress #bar { 92 88 stroke: #46b450; 93 89 } 90 .green .site-health-progress .site-health-progress-label { 91 color: #46b450; 92 } 94 93 95 . site-health-progress svg #bar.orange{94 .orange .site-health-progress #bar { 96 95 stroke: #ffb900; 97 96 } 97 .orange .site-health-progress .site-health-progress-label { 98 color: #ffb900; 99 } 100 101 .site-health-progress-label { 102 font-weight: 600; 103 line-height: 20px; 104 margin-left: 0.3rem; 105 } 98 106 99 107 @keyframes loadingPulse { 100 108 0% {