From d73399a79f5b410b569c7437ed70ebf228f618a8 Mon Sep 17 00:00:00 2001 From: lfjnascimento Date: Tue, 10 Sep 2024 16:47:27 -0300 Subject: [PATCH] fix: wrong usage of misc platform field - misc fields are json strings and must be parsed before being used as an object --- dashboard/src/pages/TestDetails/TestDetails.tsx | 13 +++++++------ dashboard/src/types/tree/TestDetails.tsx | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dashboard/src/pages/TestDetails/TestDetails.tsx b/dashboard/src/pages/TestDetails/TestDetails.tsx index f4331405..c98d3e3e 100644 --- a/dashboard/src/pages/TestDetails/TestDetails.tsx +++ b/dashboard/src/pages/TestDetails/TestDetails.tsx @@ -53,6 +53,11 @@ const LogExcerpt = ({ test }: TTestDetailsDefaultProps): JSX.Element => { const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { const intl = useIntl(); + const misc = test.environment_misc ?? test.misc; + const platform: string = misc + ? JSON.parse(misc).platform + : intl.formatMessage({ id: 'global.unknown' }); + const infos: ISubsection['infos'] = useMemo(() => { const baseInfo = [ { @@ -92,10 +97,7 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { }, { title: intl.formatMessage({ id: 'testDetails.platform' }), - linkText: - test.misc?.platform ?? - test.environment_misc?.platform ?? - intl.formatMessage({ id: 'global.unknown' }), + linkText: platform, icon: , }, ]; @@ -104,14 +106,13 @@ const TestDetailsSection = ({ test }: { test: TTestDetails }): JSX.Element => { intl, test.architecture, test.compiler, - test.environment_misc?.platform, test.git_commit_hash, test.git_repository_branch, test.git_repository_url, test.log_url, - test.misc?.platform, test.path, test.status, + platform, ]); return ; }; diff --git a/dashboard/src/types/tree/TestDetails.tsx b/dashboard/src/types/tree/TestDetails.tsx index fde7713e..f128d45a 100644 --- a/dashboard/src/types/tree/TestDetails.tsx +++ b/dashboard/src/types/tree/TestDetails.tsx @@ -3,14 +3,14 @@ export type TTestDetails = { build_id: string; compiler: string; config_name: string; - environment_misc: Record | undefined; + environment_misc: string | undefined; git_commit_hash: string; git_repository_branch: string; git_repository_url: string; id: string; log_excerpt: string | undefined; log_url: string | undefined; - misc: Record | undefined; + misc: string | undefined; path: string; start_time: string; status: string;