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 4aac24a commit fe6c46d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dashboard/src/components/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FiLink } from 'react-icons/fi';

import { ReactElement, useMemo } from 'react';

import LinkWithIcon, { ILinkWithIcon } from '../LinkWithIcon/LinkWithIcon';
Expand All @@ -21,7 +23,13 @@ export const Subsection = ({ infos }: ISubsection): JSX.Element => {
title={info.title}
link={info.link}
linkText={info.linkText}
icon={info.icon}
icon={
info.link && !info.icon ? (
<FiLink className="text-blue" />
) : (
info.icon
)
}
/>
)),
[infos],
Expand Down
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
12 changes: 12 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(test.build_id),
link: buildDetailsLink,
},
{
title: intl.formatMessage({ id: 'testDetails.platform' }),
linkText: platform,
Expand All @@ -105,6 +115,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => {
}, [
intl,
test.architecture,
test.build_id,
test.compiler,
test.git_commit_hash,
test.git_repository_branch,
Expand All @@ -113,6 +124,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => {
test.path,
test.status,
platform,
buildDetailsLink,
]);
return <Subsection infos={infos} />;
};
Expand Down

0 comments on commit fe6c46d

Please sign in to comment.