Skip to content

Commit

Permalink
fix(RHINENG-3595): Change system counts inside tables to links (#1263)
Browse files Browse the repository at this point in the history
Fixes https://issues.redhat.com/browse/RHINENG-3595.

* Change system counts inside tables to links

* Test links inside tables
  • Loading branch information
leSamo authored Jun 3, 2024
1 parent 644ae53 commit 6a6a9ee
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ describe('Pathways table tests', () => {
it('renders table header', () => {
checkTableHeaders(TABLE_HEADERS);
});
it('links to the pathway detail page', () => {
cy.get('tbody tr:first [data-label=Name] a')
.should('have.attr', 'href')
.and('include', `/recommendations/pathways/${fixtures.data[0].slug}`);
cy.get('tbody tr:first [data-label=Systems] a')
.should('have.attr', 'href')
.and('include', `/recommendations/pathways/${fixtures.data[0].slug}`);
});
});

describe('defaults', () => {
Expand Down
7 changes: 5 additions & 2 deletions src/PresentationalComponents/PathwaysTable/PathwaysTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ const PathwaysTable = ({ isTabActive }) => {
},
{
title: (
<div
<Link
key={key}
>{`${pathway.impacted_systems_count.toLocaleString()}`}</div>
to={`/recommendations/pathways/${pathway.slug}`}
>
{`${pathway.impacted_systems_count.toLocaleString()}`}
</Link>
),
},
{
Expand Down
8 changes: 8 additions & 0 deletions src/PresentationalComponents/RulesTable/RulesTable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ describe('defaults', () => {
const column = 'Total risk';
tableIsSortedBy(column);
});
it('links to the recommendations detail page', () => {
cy.get('tbody tr:first [data-label=Name] a')
.should('have.attr', 'href')
.and('include', `/recommendations/${fixtures.data[0].rule_id}`);
cy.get('tbody tr:first [data-label=Systems] a')
.should('have.attr', 'href')
.and('include', `/recommendations/${fixtures.data[0].rule_id}`);
});

it('applies total risk "Enabled" and systems impacted "1 or more" filters', () => {
hasChip('Status', 'Enabled');
Expand Down
6 changes: 3 additions & 3 deletions src/PresentationalComponents/RulesTable/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ export const buildRows = (
<span>{intl.formatMessage(messages.nA)}</span>
</Tooltip>
) : (
<div
key={key}
>{`${value.impacted_systems_count.toLocaleString()}`}</div>
<Link key={key} to={`/recommendations/${value.rule_id}`}>
{`${value.impacted_systems_count.toLocaleString()}`}
</Link>
),
},
{
Expand Down
9 changes: 9 additions & 0 deletions src/PresentationalComponents/TopicsTable/TopicsTable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ describe('renders correctly', () => {
it('renders table header', () => {
checkTableHeaders(TABLE_HEADERS);
});

it('links to the topic detail page', () => {
cy.get('tbody tr:first [data-label=Name] a')
.should('have.attr', 'href')
.and('include', `/topics/${fixtures[0].slug}`);
cy.get('tbody tr:first [data-label="Affected systems"] a')
.should('have.attr', 'href')
.and('include', `/topics/${fixtures[0].slug}`);
});
});

describe('defaults', () => {
Expand Down
6 changes: 4 additions & 2 deletions src/PresentationalComponents/TopicsTable/TopicsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ const TopicsTable = ({ props }) => {
{
title: (
<span className="pf-m-center" key={key}>
{' '}
{value.impacted_systems_count}
<Link key={key} to={`/topics/${value.slug}`}>
{' '}
{value.impacted_systems_count}
</Link>
</span>
),
},
Expand Down

0 comments on commit 6a6a9ee

Please sign in to comment.