Changeset 46106
- Timestamp:
- 09/14/2019 02:28:47 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/site-health.js
r45241 r46106 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 … … 99 100 } 100 101 101 $ progress.removeClass( 'loading' );102 $wrapper.removeClass( 'loading' ); 102 103 103 104 r = $circle.attr( 'r' ); … … 123 124 } 124 125 125 if ( 50 <= val ) { 126 $circle.addClass( 'orange' ).removeClass( 'red' ); 127 } 128 129 if ( 90 <= val ) { 130 $circle.addClass( 'green' ).removeClass( 'orange' ); 131 } 132 133 if ( 100 === val ) { 134 $( '.site-status-all-clear' ).removeClass( 'hide' ); 135 $( '.site-status-has-issues' ).addClass( 'hide' ); 136 } 137 138 $progressCount.text( val + '%' ); 126 if ( 80 <= val && 0 === parseInt( SiteHealth.site_status.issues.critical, 0 ) ) { 127 $wrapper.addClass( 'green' ).removeClass( 'orange' ); 128 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' ); 133 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 } 139 137 140 138 if ( ! isDebugTab ) { … … 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 } -
trunk/src/wp-admin/css/site-health.css
r45522 r46106 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; … … 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%; … … 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; … … 89 85 } 90 86 91 . site-health-progress svg #bar.green{87 .green .site-health-progress #bar { 92 88 stroke: #46b450; 93 89 } 94 95 .site-health-progress svg #bar.orange { 90 .green .site-health-progress .site-health-progress-label { 91 color: #46b450; 92 } 93 94 .orange .site-health-progress #bar { 96 95 stroke: #ffb900; 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; 97 105 } 98 106 -
trunk/src/wp-admin/site-health-info.php
r45932 r46106 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> -
trunk/src/wp-admin/site-health.php
r45932 r46106 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>
Note: See TracChangeset
for help on using the changeset viewer.