Skip to content

Commit

Permalink
feat(dashboard): add build link on test details
Browse files Browse the repository at this point in the history
Closes #259
  • Loading branch information
Lucas Bracher committed Sep 20, 2024
1 parent 96c292c commit 314a34a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions dashboard/src/locales/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const messages = {
'testDetails.gitCommitHash': 'Git Commit Hash',
'testDetails.gitRepositoryBranch': 'Git Repository Branch',
'testDetails.gitRepositoryUrl': 'Git Repository Url',
'testDetails.logBuildDetails': 'Log Build Details',
'testDetails.logExcerpt': 'Log Excerpt',
'testDetails.logUrl': 'Log Url',
'testDetails.notFound': 'Test not found',
Expand Down
4 changes: 3 additions & 1 deletion dashboard/src/pages/BuildDetails/BuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { ISection } from '@/components/Section/Section';
import { useBuildDetails } from '@/api/BuildDetails';
import UnexpectedError from '@/components/UnexpectedError/UnexpectedError';

import { formatDate } from '@/utils/utils';

import {
Breadcrumb,
BreadcrumbItem,
Expand Down Expand Up @@ -85,7 +87,7 @@ const BuildDetails = (): JSX.Element => {
},
{
title: intl.formatMessage({ id: 'global.date' }),
linkText: valueOrEmpty(data.timestamp),
linkText: formatDate(valueOrEmpty(data.start_time)),
},
{
title: intl.formatMessage({ id: 'global.defconfig' }),
Expand Down
11 changes: 11 additions & 0 deletions dashboard/src/pages/TestDetails/TestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => {
? JSON.parse(misc).platform
: intl.formatMessage({ id: 'global.unknown' });

const buildDetailsLink =
`${window.location.origin}` +
`/tree/${test.git_commit_hash}/build/${test.build_id}` +
`${window.location.search}`;

const infos: ISubsection['infos'] = useMemo(() => {
const baseInfo = [
{
Expand Down Expand Up @@ -95,6 +100,11 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => {
title: intl.formatMessage({ id: 'testDetails.gitRepositoryBranch' }),
linkText: valueOrEmpty(test.git_repository_branch),
},
{
title: intl.formatMessage({ id: 'testDetails.logBuildDetails' }),
linkText: truncateBigText(buildDetailsLink),
link: buildDetailsLink,
},
{
title: intl.formatMessage({ id: 'testDetails.platform' }),
linkText: platform,
Expand All @@ -113,6 +123,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => {
test.path,
test.status,
platform,
buildDetailsLink,
]);
return <Subsection infos={infos} />;
};
Expand Down

0 comments on commit 314a34a

Please sign in to comment.