Skip to content

Commit

Permalink
fix(RHINENG-8615): Fix "View ${n} affected clusters" link missing (#728)
Browse files Browse the repository at this point in the history
* chore: package-lock.json update

* fix(RHINENG-8615): Pass ViewAffectedLink instead of showViewAffected

Fixes https://issues.redhat.com/browse/RHINENG-8615.
  • Loading branch information
gkarat authored Apr 9, 2024
1 parent b6d8be5 commit ea8be87
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 8 deletions.
40 changes: 34 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions src/Components/RecsListTable/RecsListTable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
removeAllChips,
urlParamConvert,
checkEmptyState,
TABLE_ROW,
} from '@redhat-cloud-services/frontend-components-utilities';

import { SORTING_ORDERS } from '../../../cypress/utils/globals';
Expand Down Expand Up @@ -256,6 +257,14 @@ describe('data', () => {
_.filter(filterData(), (it) => it.impacted_clusters_count > 1)
).to.have.length.gte(1);
});
it('at least one rule has no affecting clutsers', () => {
expect(
filterData({
impacting: ['None'],
}),
(it) => it.impacted_clusters_count === 0
).to.have.length.gte(1);
});
it('at least one recommendation in default list has resolution risk set to non 0 value', () => {
expect(
filterData().filter(
Expand Down Expand Up @@ -705,6 +714,29 @@ describe('successful non-empty recommendations list table', () => {
.find('.ins-c-rule-details__risk-of-ch-label')
.should('have.text', 'High');
});

it('view affected link is present for rules affecting at least one cluster', () => {
cy.getRowByName(
'Super atomic nuclear cluster on the brink of the world destruction'
)
.find('[aria-label="Details"]')
.click();
cy.get(EXPANDABLES)
.first()
.contains(/View [\d\w,]* affected clusters/);
});

it('view affected link is missing for non-affecting rules', () => {
removeAllChips();
filterApply({
impacting: ['None'],
});
cy.get(TABLE_ROW).first().find('[aria-label="Details"]').click();
cy.get(EXPANDABLES)
.first()
.contains(/View [\d\w,]* affected clusters/)
.should('not.exist');
});
});

describe('enabling/disabling', () => {
Expand Down
16 changes: 14 additions & 2 deletions src/Components/RecsListTable/RecsListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,20 @@ const RecsListTable = ({ query }) => {
product={AdvisorProduct.ocp}
rule={adjustOCPRule(value)}
isDetailsPage={false}
showViewAffected
linkComponent={Link}
{...(value.impacted_clusters_count > 0
? {
ViewAffectedLink: (
<Link to={value.rule_id}>
{intl.formatMessage(
messages.viewAffectedClusters,
{
clusters: value.impacted_clusters_count,
}
)}
</Link>
),
}
: {})}
{...(inRange(value?.resolution_risk, 1, 5) // resolution risk can be 0 (not defined for particular rule)
? {
resolutionRisk: value?.resolution_risk,
Expand Down

0 comments on commit ea8be87

Please sign in to comment.