Skip to content

Commit

Permalink
fix: wrong usage of misc platform field
Browse files Browse the repository at this point in the history
- misc fields are json strings and must be parsed
before being used as an object
  • Loading branch information
lfjnascimento committed Sep 12, 2024
1 parent 8eada70 commit d73399a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions dashboard/src/pages/TestDetails/TestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -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: <GiFlatPlatform className="text-blue" />,
},
];
Expand All @@ -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 <Subsection infos={infos} />;
};
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/types/tree/TestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ export type TTestDetails = {
build_id: string;
compiler: string;
config_name: string;
environment_misc: Record<string, string> | 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<string, string> | undefined;
misc: string | undefined;
path: string;
start_time: string;
status: string;
Expand Down

0 comments on commit d73399a

Please sign in to comment.