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

feat(RHIF-283): extend CVE systems filter with edge #2002

Merged
merged 11 commits into from
Nov 29, 2023

Conversation

mkholjuraev
Copy link
Contributor

@mkholjuraev mkholjuraev commented Oct 10, 2023

Resolves: https://issues.redhat.com/browse/RHIF-283

We need to extend the filter options of the Systems filter on the CVEs table to have

  • 1 or more Conventional systems (RPM-DNF)

  • 1 or more Immutable (OSTree)

  • None

mockup

@mkholjuraev mkholjuraev requested a review from a team as a code owner October 10, 2023 20:40
@jira-linking
Copy link

jira-linking bot commented Oct 10, 2023

Commits missing Jira IDs:
90c6baa
8ce23d1
383b5b8
54244a1
fc4f0a6
e0a0084
6708801
f72f729
978b873
9d60037
02eb3c4

@mkholjuraev mkholjuraev marked this pull request as draft October 10, 2023 20:41
@mkholjuraev mkholjuraev force-pushed the rhif-293 branch 3 times, most recently from c6e0521 to a17db6a Compare November 6, 2023 12:02
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (8ae3f66) 70.13% compared to head (02eb3c4) 71.42%.
Report is 7 commits behind head on master.

Files Patch % Lines
src/Components/SmartComponents/Dashbar/Dashbar.js 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2002      +/-   ##
==========================================
+ Coverage   70.13%   71.42%   +1.29%     
==========================================
  Files         127      127              
  Lines        3328     3353      +25     
  Branches     1019     1028       +9     
==========================================
+ Hits         2334     2395      +61     
+ Misses        994      958      -36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkholjuraev mkholjuraev marked this pull request as ready for review November 7, 2023 14:24
@@ -23,6 +23,11 @@ jest.mock('../../../Store/Actions/Actions', () => ({
}) }
));

jest.mock('../../../Helpers/Hooks', () => ({
...jest.requireActual('../../../Helpers/Hooks'),
useFeatureFlag: () => true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also make sense to add tests with the feature set to false.

We might also want to investigate a wrapper function that we can use to run tests with both the feature turned on and off without having to duplicate the tests.

@@ -9,7 +9,8 @@ import { useSelector } from 'react-redux';
/* Mock function returning permissions */
jest.mock('../../../Helpers/Hooks', () => ({
...jest.requireActual('../../../Helpers/Hooks'),
useRbac: () => [[true, true, true], false]
useRbac: () => [[true, true, true], false],
useFeatureFlag: () => true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests (all in this PR) should by default run with the feature turned off/false. and tests added for the feature should turn them on explicitly.

This way we can ensure that the functionality stays the same until the feature is realeased.

@@ -13,6 +13,7 @@ const affectingFilter = (apply, currentFilter = {}) => {
});
};

const filterItems = getAffectingFilterOptions(isEdgeParityEnabled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to filter out the unwanted items with the feature turned off here and not have to pass down the feature flag into all the functions.

Copy link
Contributor Author

@mkholjuraev mkholjuraev Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also went this way so that I have minimal tech-debt. But there are multiple places where affecting filter values are used e.g. affecting filter, report custom filter, and chip builders. The changes were not clean to read and brought more tech debt. Thus, I changed the approach to use the feature flag in components so that when we get rid of the flag, we can easily remove the flags

@mkholjuraev mkholjuraev requested a review from a team November 14, 2023 14:28
@mkholjuraev
Copy link
Contributor Author

@bastilian I have disabled the feature flag in the ReportPage test file.

@bastilian
Copy link
Member

bastilian commented Nov 14, 2023

@mkholjuraev Yeah, but now there aren't any with it enabled, and just for this one test:

The tests (all in this PR) should by default run with the feature turned off/false. and tests added for the feature should turn them on explicitly.

@@ -25,8 +25,14 @@ const customMiddleWare = store => next => action => {
next(action);
}

jest.mock('../../../Helpers/Hooks', () => ({
...jest.requireActual('../../../Helpers/Hooks'),
useHybridSystemFilterFlag: () => false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am planning to write meaningful tests for changes in ReportConficModal when I am working on RHIF-302.

@@ -23,6 +25,11 @@ jest.mock('../../../Store/Actions/Actions', () => ({
}) }
));

jest.mock('../../../Helpers/Hooks', () => ({
...jest.requireActual('../../../Helpers/Hooks'),
useHybridSystemFilterFlag: jest.fn(() => true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be default false as well and set to true only on line 232?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bastilian Yup, I have made the change and also added test cases covering the flag is both off and on. PTAL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bastilian can I ask for your review on this? Thanks

@gkarat gkarat requested a review from a team November 21, 2023 09:49
@gkarat gkarat added the enhancement New feature or request label Nov 21, 2023
Copy link
Member

@bastilian bastilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @mkholjuraev!

@mkholjuraev mkholjuraev merged commit acde36d into RedHatInsights:master Nov 29, 2023
3 checks passed
LiorKGOW pushed a commit to LiorKGOW/vulnerability-ui that referenced this pull request Jan 8, 2024
…ts#2002)

Fixes https://issues.redhat.com/browse/ESSNTL-5253.

This is another patch for ESSNTL-5253 that makes sure
that all of the params are passed to the tabs components
and the tabs are loaded correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants