Skip to content

Commit 53e3a3d

Browse files
feat: replace the /hardware with new denormalized view and remove /hardware-new (#1712)
1 parent 2ed1bcf commit 53e3a3d

18 files changed

Lines changed: 144 additions & 683 deletions

File tree

dashboard/src/api/hardware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const useHardwareListing = (
3333
startTimestampInSeconds: number,
3434
endTimestampInSeconds: number,
3535
): UseQueryResult<HardwareListingResponse> => {
36-
const { origin } = useSearch({ from: '/_main/hardware' });
36+
const { origin } = useSearch({ from: '/_main/hardware/v1' });
3737

3838
const queryKey = [
3939
'hardwareListing',
@@ -77,7 +77,7 @@ export const useHardwareListingV2 = (
7777
startTimestampInSeconds: number,
7878
endTimestampInSeconds: number,
7979
): UseQueryResult<HardwareListingResponseV2> => {
80-
const { origin } = useSearch({ from: '/_main/hardware-new' });
80+
const { origin } = useSearch({ from: '/_main/hardware' });
8181

8282
const queryKey = [
8383
'hardwareListingV2',

dashboard/src/components/SideMenu/menuItems.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ export const routeItems: RouteMenuItems[] = [
4545
icon: MonitorHeartIcon,
4646
selected: false,
4747
},
48-
{
49-
navigateTo: '/hardware-new',
50-
idIntl: 'routes.hardwareNewMonitor',
51-
icon: MonitorHeartIcon,
52-
selected: false,
53-
},
5448
{
5549
navigateTo: '/issues',
5650
idIntl: 'routes.issueMonitor',

dashboard/src/components/TopBar/TopBar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ const TitleName = ({ basePath }: { basePath: string }): JSX.Element => {
9494
case 'tree':
9595
return <FormattedMessage id="routes.treeMonitor" />;
9696
case 'hardware':
97+
case 'hardware/v1':
9798
return <FormattedMessage id="routes.hardwareMonitor" />;
98-
case 'hardware-new':
99-
return <FormattedMessage id="routes.hardwareNewMonitor" />;
10099
case 'issues':
101100
return <FormattedMessage id="routes.issueMonitor" />;
102101
case 'build':

dashboard/src/locales/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export const messages = {
207207
'hardwareDetails.selectTreeTitle': 'No Tree Selected',
208208
'hardwareDetails.timeFrame':
209209
'Results from {startDate} and {startTime} to {endDate} {endTime}',
210+
'hardwareListing.bannerTitle': 'Hardware Listing',
210211
'hardwareListing.description': 'List of hardware from kernel tests',
211212
'hardwareListing.notFound': 'No hardware information available',
212213
'hardwareListing.title': 'Hardware Listing ― KCI Dashboard',

dashboard/src/pages/Hardware/Hardware.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ import { useCallback } from 'react';
33

44
import { useIntl } from 'react-intl';
55

6-
import { useNavigate, useSearch, Link } from '@tanstack/react-router';
6+
import { useNavigate, useSearch } from '@tanstack/react-router';
77

88
import HardwareListingPage from '@/pages/Hardware/HardwareListingPage';
99

1010
import DebounceInput from '@/components/DebounceInput/DebounceInput';
1111
import { MemoizedListingOGTags } from '@/components/OpenGraphTags/ListingOGTags';
12+
import { OldPageBanner } from '@/components/Banner/PageBanner';
1213

1314
const Hardware = (): JSX.Element => {
1415
const { hardwareSearch } = useSearch({
15-
from: '/_main/hardware',
16+
from: '/_main/hardware/v1',
1617
});
1718

18-
const navigate = useNavigate({ from: '/hardware' });
19+
const navigate = useNavigate({ from: '/hardware/v1' });
1920

2021
const onInputSearchTextChange = useCallback(
2122
(e: ChangeEvent<HTMLInputElement>) => {
2223
navigate({
23-
from: '/hardware',
24+
from: '/hardware/v1',
2425
search: previousSearch => ({
2526
...previousSearch,
2627
hardwareSearch: e.target.value,
@@ -48,23 +49,10 @@ const Hardware = (): JSX.Element => {
4849
/>
4950
</div>
5051
</div>
51-
<div className="rounded-md bg-yellow-100 p-3 text-sm text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300">
52-
This is the original version of the hardware listing, please refer to
53-
the new, optimized version{' '}
54-
<Link to="/hardware-new" className="underline">
55-
here
56-
</Link>
57-
. If you find any bugs or divergences, please report to{' '}
58-
<a
59-
href="https://github.com/kernelci/dashboard/issues"
60-
target="_blank"
61-
rel="noreferrer"
62-
className="underline"
63-
>
64-
GitHub Issues
65-
</a>
66-
. This page will be deprecated on March 27, 2026.
67-
</div>
52+
<OldPageBanner
53+
pageNameId="hardwareListing.bannerTitle"
54+
pageRoute="/hardware"
55+
/>
6856
<div className="bg-light-gray w-full py-10">
6957
<HardwareListingPage inputFilter={hardwareSearch ?? ''} />
7058
</div>

dashboard/src/pages/Hardware/HardwareListingPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const useHardwareListingTime = (): {
4747
startTimestampInSeconds: number;
4848
endTimestampInSeconds: number;
4949
} => {
50-
const { intervalInDays } = useSearch({ from: '/_main/hardware' });
50+
const { intervalInDays } = useSearch({ from: '/_main/hardware/v1' });
5151
const [timestamps, setTimeStamps] = useState(() => {
5252
return calculateTimeStamp(intervalInDays);
5353
});
@@ -66,7 +66,7 @@ const HardwareListingPage = ({
6666
}: HardwareListingPageProps): JSX.Element => {
6767
const { startTimestampInSeconds, endTimestampInSeconds } =
6868
useHardwareListingTime();
69-
const { origin } = useSearch({ from: '/_main/hardware' });
69+
const { origin } = useSearch({ from: '/_main/hardware/v1' });
7070

7171
const { data, error, status, isLoading } = useHardwareListing(
7272
startTimestampInSeconds,
@@ -151,6 +151,7 @@ const HardwareListingPage = ({
151151
queryData={data}
152152
error={error}
153153
isLoading={isLoading}
154+
navigateFrom="/hardware/v1"
154155
/>
155156
</div>
156157
{kcidevComponent}

dashboard/src/pages/HardwareNew/HardwareListingPage.tsx renamed to dashboard/src/pages/Hardware/HardwareListingPageV2.tsx

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ import { useSearch } from '@tanstack/react-router';
55

66
import { Toaster } from '@/components/ui/toaster';
77

8-
import type { HardwareItemV2 } from '@/types/hardware';
8+
import type { HardwareItem } from '@/types/hardware';
99

1010
import { useHardwareListingV2 } from '@/api/hardware';
1111

1212
import { dateObjectToTimestampInSeconds, daysToSeconds } from '@/utils/date';
1313

14+
import type { RequiredStatusCount, StatusCount } from '@/types/general';
15+
1416
import {
1517
matchesRegexOrIncludes,
1618
includesInAnStringOrStringArray,
1719
} from '@/lib/string';
1820

1921
import { MemoizedKcidevFooter } from '@/components/Footer/KcidevFooter';
2022

21-
import type { RequiredStatusCount, StatusCountV2 } from '@/types/general';
22-
2323
import { 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

Comments
 (0)