@@ -4,7 +4,6 @@ import { Helmet } from 'react-helmet';
44import { Link } from 'react-router-dom' ;
55import { Container , Table } from 'react-bootstrap' ;
66import clsx from 'clsx' ;
7- import alphabetizeObjectBy from '../../utils/alphabetizeObjectBy' ;
87import { derivePhaseName } from '../../utils/aria' ;
98import { None } from '@components/common/None' ;
109import { getTestPlanTargetTitle , getTestPlanVersionTitle } from './getTitles' ;
@@ -50,11 +49,14 @@ const SummarizeTestPlanReports = ({
5049 testPlanTargetsById [ testPlanTarget . id ] = testPlanTarget ;
5150 } ) ;
5251 } ) ;
53- testPlanTargetsById = alphabetizeObjectBy ( testPlanTargetsById , keyValue =>
54- getTestPlanTargetTitle ( keyValue [ 1 ] )
52+ const orderedColumns = Object . entries ( testPlanTargetsById ) . map (
53+ ( [ , data ] ) => data
54+ ) ;
55+ orderedColumns . sort ( ( a , b ) =>
56+ getTestPlanTargetTitle ( a ) . localeCompare ( getTestPlanTargetTitle ( b ) )
5557 ) ;
5658
57- const none = None ( ) ;
59+ const none = None ( 'No Data' ) ;
5860
5961 return (
6062 < Container
@@ -92,13 +94,11 @@ const SummarizeTestPlanReports = ({
9294 < thead >
9395 < tr >
9496 < th > Test Plan</ th >
95- { Object . values ( testPlanTargetsById ) . map (
96- testPlanTarget => (
97- < th key = { testPlanTarget . id } >
98- { getTestPlanTargetTitle ( testPlanTarget ) }
99- </ th >
100- )
101- ) }
97+ { orderedColumns . map ( testPlanTarget => (
98+ < th key = { testPlanTarget . id } >
99+ { getTestPlanTargetTitle ( testPlanTarget ) }
100+ </ th >
101+ ) ) }
102102 </ tr >
103103 </ thead >
104104 < tbody >
@@ -128,43 +128,41 @@ const SummarizeTestPlanReports = ({
128128 { derivePhaseName ( phase ) }
129129 </ span >
130130 </ td >
131- { Object . values ( testPlanTargetsById ) . map (
132- testPlanTarget => {
133- const testPlanReport = testPlanReports . find (
134- testPlanReport =>
135- testPlanReport . at . id ===
136- testPlanTarget . at . id &&
137- testPlanReport . browser . id ===
138- testPlanTarget . browser . id
139- ) ;
131+ { orderedColumns . map ( testPlanTarget => {
132+ const testPlanReport = testPlanReports . find (
133+ testPlanReport =>
134+ testPlanReport . at . id ===
135+ testPlanTarget . at . id &&
136+ testPlanReport . browser . id ===
137+ testPlanTarget . browser . id
138+ ) ;
140139
141- if ( ! testPlanReport ) {
142- return (
143- < td
144- key = { `${ testPlanVersion . id } -${ testPlanTarget . id } ` }
145- >
146- { none }
147- </ td >
148- ) ;
149- }
150- const metrics = testPlanReport . metrics ;
140+ if ( ! testPlanReport ) {
151141 return (
152- < td key = { testPlanReport . id } >
153- < Link
154- to = {
155- `/report/${ testPlanVersion . id } ` +
156- `/targets/${ testPlanReport . id } `
157- }
158- aria-label = { `${ metrics . supportPercent } %` }
159- >
160- < ProgressBar
161- progress = { metrics . supportPercent }
162- />
163- </ Link >
142+ < td
143+ key = { `${ testPlanVersion . id } -${ testPlanTarget . id } ` }
144+ >
145+ { none }
164146 </ td >
165147 ) ;
166148 }
167- ) }
149+ const metrics = testPlanReport . metrics ;
150+ return (
151+ < td key = { testPlanReport . id } >
152+ < Link
153+ to = {
154+ `/report/${ testPlanVersion . id } ` +
155+ `/targets/${ testPlanReport . id } `
156+ }
157+ aria-label = { `${ metrics . supportPercent } %` }
158+ >
159+ < ProgressBar
160+ progress = { metrics . supportPercent }
161+ />
162+ </ Link >
163+ </ td >
164+ ) ;
165+ } ) }
168166 </ tr >
169167 ) ;
170168 } ) }
0 commit comments