@@ -5,24 +5,24 @@ import { useSearch } from '@tanstack/react-router';
55
66import { Toaster } from '@/components/ui/toaster' ;
77
8- import type { HardwareItemV2 } from '@/types/hardware' ;
8+ import type { HardwareItem } from '@/types/hardware' ;
99
1010import { useHardwareListingV2 } from '@/api/hardware' ;
1111
1212import { dateObjectToTimestampInSeconds , daysToSeconds } from '@/utils/date' ;
1313
14+ import type { RequiredStatusCount , StatusCount } from '@/types/general' ;
15+
1416import {
1517 matchesRegexOrIncludes ,
1618 includesInAnStringOrStringArray ,
1719} from '@/lib/string' ;
1820
1921import { MemoizedKcidevFooter } from '@/components/Footer/KcidevFooter' ;
2022
21- import type { RequiredStatusCount , StatusCountV2 } from '@/types/general' ;
22-
2323import { HardwareTable } from './HardwareTable' ;
2424
25- interface HardwareListingPageProps {
25+ interface HardwareListingPageV2Props {
2626 inputFilter : string ;
2727}
2828
@@ -47,7 +47,7 @@ const useHardwareListingTime = (): {
4747 startTimestampInSeconds : number ;
4848 endTimestampInSeconds : number ;
4949} => {
50- const { intervalInDays } = useSearch ( { from : '/_main/hardware-new ' } ) ;
50+ const { intervalInDays } = useSearch ( { from : '/_main/hardware' } ) ;
5151 const [ timestamps , setTimeStamps ] = useState ( ( ) => {
5252 return calculateTimeStamp ( intervalInDays ) ;
5353 } ) ;
@@ -61,19 +61,19 @@ const useHardwareListingTime = (): {
6161 return { startTimestampInSeconds, endTimestampInSeconds } ;
6262} ;
6363
64- const HardwareListingPage = ( {
64+ const HardwareListingPageV2 = ( {
6565 inputFilter,
66- } : HardwareListingPageProps ) : JSX . Element => {
66+ } : HardwareListingPageV2Props ) : JSX . Element => {
6767 const { startTimestampInSeconds, endTimestampInSeconds } =
6868 useHardwareListingTime ( ) ;
69- const { origin } = useSearch ( { from : '/_main/hardware-new ' } ) ;
69+ const { origin } = useSearch ( { from : '/_main/hardware' } ) ;
7070
7171 const { data, error, status, isLoading } = useHardwareListingV2 (
7272 startTimestampInSeconds ,
7373 endTimestampInSeconds ,
7474 ) ;
7575
76- const listItems : HardwareItemV2 [ ] = useMemo ( ( ) => {
76+ const listItems : HardwareItem [ ] = useMemo ( ( ) => {
7777 if ( ! data || error ) {
7878 return [ ] ;
7979 }
@@ -87,41 +87,35 @@ const HardwareListingPage = ({
8787 includesInAnStringOrStringArray ( hardware . hardware ?? '' , inputFilter )
8888 ) ;
8989 } )
90- . map ( ( hardware ) : HardwareItemV2 => {
90+ . map ( ( hardware ) : HardwareItem => {
9191 const buildCount : RequiredStatusCount = {
92- PASS : hardware . build_status_summary ?. PASS ?? 0 ,
93- FAIL : hardware . build_status_summary ?. FAIL ?? 0 ,
92+ PASS : hardware . build_status_summary ?. PASS ,
93+ FAIL : hardware . build_status_summary ?. FAIL ,
9494 NULL : 0 ,
9595 ERROR : 0 ,
9696 MISS : 0 ,
9797 DONE : 0 ,
98- // TODO: Remove this workaround after migrating to the new hardware listing endpoint
99- // and modify status count to use INCONCLUSIVE field
100- SKIP : hardware . build_status_summary ?. INCONCLUSIVE ?? 0 ,
98+ SKIP : hardware . build_status_summary ?. INCONCLUSIVE ,
10199 } ;
102100
103- const testStatusCount : StatusCountV2 = {
104- PASS : hardware . test_status_summary ?. PASS ,
105- FAIL : hardware . test_status_summary ?. FAIL ,
106- NULL : 0 ,
101+ const testStatusCount : StatusCount = {
102+ DONE : 0 ,
107103 ERROR : 0 ,
104+ FAIL : hardware . test_status_summary . FAIL ,
108105 MISS : 0 ,
109- DONE : 0 ,
110- // TODO: Remove this workaround after migrating to the new hardware listing endpoint
111- // and modify status count to use INCONCLUSIVE field
112- SKIP : hardware . test_status_summary ?. INCONCLUSIVE ,
106+ PASS : hardware . test_status_summary . PASS ,
107+ SKIP : 0 ,
108+ NULL : hardware . test_status_summary . INCONCLUSIVE ,
113109 } ;
114110
115- const bootStatusCount : StatusCountV2 = {
116- PASS : hardware . boot_status_summary ?. PASS ,
117- FAIL : hardware . boot_status_summary ?. FAIL ,
118- NULL : 0 ,
111+ const bootStatusCount : StatusCount = {
112+ DONE : 0 ,
119113 ERROR : 0 ,
114+ FAIL : hardware . boot_status_summary . FAIL ,
120115 MISS : 0 ,
121- DONE : 0 ,
122- // TODO: Remove this workaround after migrating to the new hardware listing endpoint
123- // and modify status count to use INCONCLUSIVE field
124- SKIP : hardware . boot_status_summary ?. INCONCLUSIVE ,
116+ PASS : hardware . boot_status_summary . PASS ,
117+ SKIP : 0 ,
118+ NULL : hardware . boot_status_summary . INCONCLUSIVE ,
125119 } ;
126120
127121 return {
@@ -157,11 +151,12 @@ const HardwareListingPage = ({
157151 queryData = { data }
158152 error = { error }
159153 isLoading = { isLoading }
154+ navigateFrom = "/hardware"
160155 />
161156 </ div >
162157 { kcidevComponent }
163158 </ >
164159 ) ;
165160} ;
166161
167- export default HardwareListingPage ;
162+ export default HardwareListingPageV2 ;
0 commit comments