Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RHINENG-8615): Fix "View ${n} affected clusters" link missing #728

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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