-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- reuse test details component in tree and hardware context Close #507
- Loading branch information
1 parent
6ab22f9
commit 8cb0bd9
Showing
9 changed files
with
140 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
dashboard/src/pages/HardwareTestDetails/HardwareTestDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { useParams, useSearch } from '@tanstack/react-router'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from '@/components/Breadcrumb/Breadcrumb'; | ||
|
||
import TestDetails from '@/components/TestDetails/TestDetails'; | ||
|
||
const HardwareTestDetails = (): JSX.Element => { | ||
const searchParams = useSearch({ | ||
from: '/hardware/$hardwareId/test/$testId/', | ||
}); | ||
const { testId, hardwareId } = useParams({ | ||
from: '/hardware/$hardwareId/test/$testId/', | ||
}); | ||
|
||
return ( | ||
<TestDetails | ||
testId={testId} | ||
breadcrumb={ | ||
<Breadcrumb className="pb-6 pt-6"> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink to="/hardware" search={searchParams}> | ||
<FormattedMessage id="hardware.path" /> | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbLink | ||
to={`/hardware/$hardwareId`} | ||
params={{ hardwareId }} | ||
search={searchParams} | ||
> | ||
<FormattedMessage id="hardware.details" /> | ||
</BreadcrumbLink> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage> | ||
<FormattedMessage id="test.details" /> | ||
</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default HardwareTestDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import HardwareTestDetails from './HardwareTestDetails'; | ||
|
||
export default HardwareTestDetails; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useParams, useSearch } from '@tanstack/react-router'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from '@/components/Breadcrumb/Breadcrumb'; | ||
|
||
import TestDetails from '@/components/TestDetails/TestDetails'; | ||
|
||
const TreeTestDetails = (): JSX.Element => { | ||
const searchParams = useSearch({ from: '/tree/$treeId/test/$testId/' }); | ||
const { testId, treeId } = useParams({ from: '/tree/$treeId/test/$testId/' }); | ||
|
||
return ( | ||
<TestDetails | ||
testId={testId} | ||
breadcrumb={ | ||
<Breadcrumb className="pb-6 pt-6"> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink to="/tree" search={searchParams}> | ||
<FormattedMessage id="tree.path" /> | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbLink | ||
to={`/tree/$treeId`} | ||
params={{ treeId: treeId }} | ||
search={searchParams} | ||
> | ||
<FormattedMessage id="tree.details" /> | ||
</BreadcrumbLink> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage> | ||
<FormattedMessage id="test.details" /> | ||
</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default TreeTestDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import TreeTestDetails from './TreeTestDetails'; | ||
|
||
export default TreeTestDetails; |
4 changes: 3 additions & 1 deletion
4
dashboard/src/routes/hardware/$hardwareId/test/$testId/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
|
||
import HardwareTestDetails from '@/pages/HardwareTestDetails'; | ||
|
||
export const Route = createFileRoute('/hardware/$hardwareId/test/$testId/')({ | ||
component: () => <div>Hello /hardware/$hardware/test/$testId/!</div>, | ||
component: () => <HardwareTestDetails />, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
|
||
import TestDetails from '@/pages/TestDetails/TestDetails'; | ||
import TreeTestDetails from '@/pages/TreeTestDetails/TreeTestDetails'; | ||
|
||
export const Route = createFileRoute('/tree/$treeId/test/$testId/')({ | ||
component: () => <TestDetails />, | ||
component: () => <TreeTestDetails />, | ||
}); |