Skip to content

Commit

Permalink
Check for v2 testFormatVersion where applicable and hide link (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e authored Dec 5, 2023
1 parent 6962cef commit 457caea
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 19 deletions.
25 changes: 21 additions & 4 deletions client/components/DataManagement/DataManagementRow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ const DataManagementRow = ({
}
};

// TODO: Remove this testFormatVersion check when #745 is implemented
const getLinkHref = version =>
version.metadata?.testFormatVersion === 2
? null
: `/test-review/${version.id}`;

switch (phase) {
case 'RD': {
// If the latest version of the plan is in the draft, candidate, or recommended
Expand Down Expand Up @@ -548,12 +554,15 @@ const DataManagementRow = ({
// Otherwise, show VERSION_STRING link with a draft transition button. Phase is
// "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list" aria-setsize={isAdmin ? 2 : 1}>
<VersionString
role="listitem"
iconColor="#2BA51C"
linkHref={`/test-review/${latestVersion.id}`}
linkHref={linkHref}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -676,13 +685,15 @@ const DataManagementRow = ({
// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list" aria-setsize={isAdmin ? 3 : 2}>
<VersionString
role="listitem"
iconColor="#2BA51C"
linkRef={draftVersionStringRef}
linkHref={`/test-review/${latestVersion.id}`}
linkHref={linkHref}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -880,6 +891,9 @@ const DataManagementRow = ({

// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell
role="list"
Expand All @@ -889,7 +903,7 @@ const DataManagementRow = ({
role="listitem"
iconColor="#2BA51C"
linkRef={candidateVersionStringRef}
linkHref={`/test-review/${latestVersion.id}`}
linkHref={linkHref}
>
{latestVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -998,13 +1012,16 @@ const DataManagementRow = ({

// Phase is "active"
insertActivePhaseForTestPlan(latestVersion);

// TODO: Remove this testFormatVersion check when #745 is implemented
const linkHref = getLinkHref(latestVersion);
return (
<PhaseCell role="list">
<VersionString
role="listitem"
iconColor="#2BA51C"
linkRef={recommendedVersionStringRef}
linkHref={`/test-review/${latestVersion.id}`}
linkHref={linkHref}
>
{latestVersion.versionString}
</VersionString>
Expand Down
3 changes: 3 additions & 0 deletions client/components/DataManagement/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const DATA_MANAGEMENT_PAGE_QUERY = gql`
}
}
}
metadata
}
}
`;
Expand Down Expand Up @@ -133,6 +134,7 @@ export const UPDATE_TEST_PLAN_VERSION_PHASE = gql`
feedbackType
}
}
metadata
}
}
}
Expand Down Expand Up @@ -179,6 +181,7 @@ export const UPDATE_TEST_PLAN_VERSION_RECOMMENDED_TARGET_DATE = gql`
feedbackType
}
}
metadata
}
}
}
Expand Down
42 changes: 27 additions & 15 deletions client/components/TestPlanVersionsPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,13 @@ const TestPlanVersionsPage = () => {
testPlanVersion
)}
autoWidth={false}
linkHref={`/test-review/${testPlanVersion.id}`}
// TODO: Remove this testFormatVersion check when #745 is implemented
linkHref={
testPlanVersion.metadata
?.testFormatVersion === 2
? null
: `/test-review/${testPlanVersion.id}`
}
>
{testPlanVersion.versionString}
</VersionString>
Expand Down Expand Up @@ -673,21 +679,27 @@ const TestPlanVersionsPage = () => {
: {testPlanVersion.gitMessage}
</a>
</li>
<li>
<a
href={`/test-review/${testPlanVersion.id}`}
>
<FontAwesomeIcon
icon={
faArrowUpRightFromSquare
{/* TODO: Remove this testFormatVersion check when #745 is implemented */}
{testPlanVersion.metadata
.testFormatVersion === 2 ? null : (
<li>
<a
href={`/test-review/${testPlanVersion.id}`}
>
<FontAwesomeIcon
icon={
faArrowUpRightFromSquare
}
size="xs"
color="#818F98"
/>
View tests in{' '}
{
testPlanVersion.versionString
}
size="xs"
color="#818F98"
/>
View tests in{' '}
{testPlanVersion.versionString}
</a>
</li>
</a>
</li>
)}
{!hasFinalReports ? null : (
<li>
<a
Expand Down
1 change: 1 addition & 0 deletions client/components/TestPlanVersionsPage/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const TEST_PLAN_VERSIONS_PAGE_QUERY = gql`
name
}
}
metadata
}
}
}
Expand Down

0 comments on commit 457caea

Please # to comment.