From 4ea56a5463ca192218cacb8a74fbff0df109a051 Mon Sep 17 00:00:00 2001 From: Lucas Bracher Date: Mon, 16 Sep 2024 19:46:17 -0300 Subject: [PATCH] feat(dashboard): add build link on test details Closes #259 --- dashboard/src/locales/messages/index.ts | 1 + .../src/pages/TestDetails/TestDetails.tsx | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dashboard/src/locales/messages/index.ts b/dashboard/src/locales/messages/index.ts index fe578f52..a3459da1 100644 --- a/dashboard/src/locales/messages/index.ts +++ b/dashboard/src/locales/messages/index.ts @@ -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', diff --git a/dashboard/src/pages/TestDetails/TestDetails.tsx b/dashboard/src/pages/TestDetails/TestDetails.tsx index c98d3e3e..f764ab33 100644 --- a/dashboard/src/pages/TestDetails/TestDetails.tsx +++ b/dashboard/src/pages/TestDetails/TestDetails.tsx @@ -1,3 +1,5 @@ +import { MdLink } from 'react-icons/md'; + import { useParams, useSearch } from '@tanstack/react-router'; import { FormattedMessage, useIntl } from 'react-intl'; @@ -58,6 +60,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 = [ { @@ -80,7 +87,8 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { { title: intl.formatMessage({ id: 'testDetails.logUrl' }), linkText: truncateBigText(valueOrEmpty(test.log_url)), - link: valueOrEmpty(test.log_url), + link: test.log_url && valueOrEmpty(test.log_url), + icon: test.log_url && , }, { title: intl.formatMessage({ id: 'testDetails.gitCommitHash' }), @@ -89,12 +97,19 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { { title: intl.formatMessage({ id: 'testDetails.gitRepositoryUrl' }), linkText: truncateBigText(valueOrEmpty(test.git_repository_url)), - link: valueOrEmpty(test.git_repository_url), + link: test.git_repository_url && valueOrEmpty(test.git_repository_url), + icon: , }, { 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, + icon: , + }, { title: intl.formatMessage({ id: 'testDetails.platform' }), linkText: platform, @@ -105,6 +120,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { }, [ intl, test.architecture, + test.build_id, test.compiler, test.git_commit_hash, test.git_repository_branch, @@ -113,6 +129,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { test.path, test.status, platform, + buildDetailsLink, ]); return ; };