ROX-34186: Render collection and entity scope in Resources step#20321
Open
pedrottimark wants to merge 1 commit intomasterfrom
Open
ROX-34186: Render collection and entity scope in Resources step#20321pedrottimark wants to merge 1 commit intomasterfrom
pedrottimark wants to merge 1 commit intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20321 +/- ##
========================================
Coverage 49.83% 49.84%
========================================
Files 2773 2780 +7
Lines 210794 211480 +686
========================================
+ Hits 105055 105414 +359
- Misses 97974 98260 +286
- Partials 7765 7806 +41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
🚀 Build Images ReadyImages are ready for commit d5d01de. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-814-gd5d01deeb6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Objective
Provide equivalent filter for scheduled reports as view-based reports
Analysis
As a potential alternative, I considered auth provider Rules:
Seeing 3 fields rememinded me to use compound search filter for both Resources and Filters
With appropriate configuration:
Resources:
searchFilterConfigForClusterNamespaceDeploymentFilters:
searchFilterConfigForImageVulnerabilityReportalready existsWith pure functions so that
resourceScope.entityScope.rulesis source of truth, although reusable elements havesearchFilterprop.getEntityScopeRulesFromSearchFilterForClusterNamespaceDeploymentalready existsgetSearchFilterFromEntityScopeRulesForClusterNamespaceDeploymentAlthough the round-trip conversion seems to work for Name field with either exact or regex match, key-value for annotation and label deserves closer investigation and unit tests. See Residue item 1.
Solution
Add ImageTypeSelect.tsx files because form element was inline.
Add CollectionScopeSelect.tsx file because CollectionSelection.tsx
Edit entityScopeRules.ts file.
getSearchFilterFromEntityScopeRulesfunction.Add searchFilterConfig.ts file.
Because Cluster has additional attributes in results that do not correspond to entity scope,
specify relevant attributes only to prevent irrelevant attributes from leaking in from results.
Add EntityScopeCompoundSearchFilter.tsx file.
Generic component receives which entites of cluster, namespace, deployment via props.
Edit ImageVulnerabilityResourcesStep.tsx file.
CollectionScopeSelectelementEntityScopeCompoundSearchFilterelementsApologies for so many secondary changes to add
isDisabledprop.Edit ImageVulnerabilitiesReviewStep file.
ImageVulnerabilitiesReportViewelement for consistency with future view page.Residue
Although the round-trip conversion seems to work for Name field with either exact or regex match, key-value for annotation and label deserves closer investigation and unit tests. See Analysis item 2.
David might advise how to either reuse or add to searchUtils.ts file
Get wording for absence of resources or filters and decide how to display.
Although collection scope is required even for Watched images only, it seems required for entity scope if Deployed images is selected, but not if Watched images only is selected.
Alertelement in viewAlertelement?To reduce changed files, and because Filters step is in review, follow up with option to hide Clear filters link in compound search filter labels.
Form validation! Brad might help,
Add file to render view or wizard when
ROX_VULNERABILITY_REPORTS_ENHANCED_FILTERINGia enabled.User-facing documentation
Testing and quality
Automated testing
How I validated my change
npm run tscin ui/apps/platform folder.npm run lint:fast-devin ui/apps/platform folder.npm run startin ui/apps/platform folder with staging demo as central.Manual testing
Temporary edit ViewVulnReportPage.tsx files to render wizard for report configuration.
Visit /main/vulnerabilities/reports/configuration click a link, and then advance to Resources step.
Collection scope is existing report configuration

Select a different collection

Advance to Review step.

Go back to Resources step and select Custom scope.
Although I deleted the code, pending Residue item 2, here is what a warning

Alertelement might look like.Select Cluster name and Namespace name exact and Deployment name not exact.

Advance to Review step.

On Resources step
console.logunderstand that advance to Review step and then return to Resources step loses its memory of the other scope selection because it was in component instance state (duh).