Skip to content

Commit

Permalink
feat(dashboard): allow links boot and test status
Browse files Browse the repository at this point in the history
Links over boot and test statuses are now allowed.

Closes #263
  • Loading branch information
Lucas Bracher committed Sep 11, 2024
1 parent 4ce5e29 commit 232c84b
Showing 1 changed file with 71 additions and 38 deletions.
109 changes: 71 additions & 38 deletions dashboard/src/components/Table/TreeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { BuildStatus, GroupedTestStatus } from '@/components/Status/Status';
import {
possibleBuildsTableFilter,
possibleTestsTableFilter,
PossibleTabs,
} from '@/types/tree/TreeDetails';

import { TreeTableBody, zOrigin } from '@/types/tree/Tree';
Expand Down Expand Up @@ -60,41 +61,51 @@ const TreeTableRow = (row: TreeTableBody): JSX.Element => {

const navigate = useNavigate({ from: '/tree' });

const navigateToTreeDetailPage = useCallback(() => {
navigate({
to: '/tree/$treeId',
params: { treeId: row.id },
search: {
tableFilter: {
bootsTable: possibleTestsTableFilter[0],
buildsTable: possibleBuildsTableFilter[2],
testsTable: possibleTestsTableFilter[0],
const navigateToTreeDetailPage = useCallback(
(event: React.MouseEvent<HTMLButtonElement>) => {
const el = event.currentTarget;
const target = el.getAttribute('data-target');

Check failure on line 67 in dashboard/src/components/Table/TreeTable.tsx

View workflow job for this annotation

GitHub Actions / lint-js

'target' is assigned a value but never used. Allowed unused vars must match /^_/u
const pageTarget: PossibleTabs = el.getAttribute('data-target');

navigate({
to: '/tree/$treeId',
params: { treeId: row.id },
search: {
tableFilter: {
bootsTable: possibleTestsTableFilter[0],
buildsTable: possibleBuildsTableFilter[2],
testsTable: possibleTestsTableFilter[0],
},
origin: origin,
currentTreeDetailsTab: pageTarget,
diffFilter: {},
treeInfo: {
gitUrl: row.url,
gitBranch: row.branch,
treeName: row.tree_names[0],
commitName: row.commitName,
headCommitHash: row.id,
},
},
origin: origin,
currentTreeDetailsTab: 'treeDetails.builds',
diffFilter: {},
treeInfo: {
gitUrl: row.url,
gitBranch: row.branch,
treeName: row.tree_names[0],
commitName: row.commitName,
headCommitHash: row.id,
},
},
});
}, [
navigate,
row.id,
origin,
row.url,
row.branch,
row.tree_names,
row.commitName,
]);
});
},
[
navigate,
row.id,
origin,
row.url,
row.branch,
row.tree_names,
row.commitName,
],
);

return (
<TableRow onClick={navigateToTreeDetailPage}>
<TableCell>
<TableRow>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.builds"
>
<Tooltip>
<TooltipTrigger>
<div>{sanitizeTableValue(row.tree_names.join(', '), false)}</div>
Expand All @@ -106,19 +117,38 @@ const TreeTableRow = (row: TreeTableBody): JSX.Element => {
</TooltipContent>
</Tooltip>
</TableCell>
<TableCell>{sanitizeTableValue(row.branch, false)}</TableCell>
<TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.builds"
>
{sanitizeTableValue(row.branch, false)}
</TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.builds"
>
{sanitizeTableValue(row.commitName ? row.commitName : row.commitHash)}
</TableCell>
<TableCell>{sanitizeTableValue(row.date.split('T')[0] ?? '')}</TableCell>
<TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.builds"
>
{sanitizeTableValue(row.date.split('T')[0] ?? '')}
</TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.builds"
>
<BuildStatus
valid={row.buildStatus.valid}
invalid={row.buildStatus.invalid}
unknown={row.buildStatus.null}
/>
</TableCell>
<TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.boots"
>
<GroupedTestStatus
pass={row.bootStatus.pass}
skip={row.bootStatus.skip}
Expand All @@ -128,7 +158,10 @@ const TreeTableRow = (row: TreeTableBody): JSX.Element => {
error={row.bootStatus.error}
/>
</TableCell>
<TableCell>
<TableCell
onClick={navigateToTreeDetailPage}
data-target="treeDetails.tests"
>
<GroupedTestStatus
pass={row.testStatus.pass}
skip={row.testStatus.skip}
Expand Down

0 comments on commit 232c84b

Please sign in to comment.