ROX-29492: Compute conditional colSpan according to Advisory column#15453
ROX-29492: Compute conditional colSpan according to Advisory column#15453pedrottimark merged 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Hey @pedrottimark - I've reviewed your changes - here's some feedback:
- Consider extracting the repeated colSpan calculation logic (base count ± hidden columns ± advisory) into a shared util or hook to reduce duplication across tables.
- The
8 + -hiddenColumnCount(and similar) expressions are a bit hard to parse—using8 - hiddenColumnCountwould be clearer. - Variable names like
colSpanForComponentVulnerabilitiesTablevscolSpanForDockerfileLayercould be made more consistent or descriptive (e.g.componentTableColSpan,dockerfileLayerColSpan).
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Images are ready for the commit at 3ffcd88. To use with deploy scripts, first |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #15453 +/- ##
==========================================
- Coverage 49.23% 49.23% -0.01%
==========================================
Files 2578 2578
Lines 189182 189182
==========================================
- Hits 93153 93149 -4
- Misses 88692 88694 +2
- Partials 7337 7339 +2
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:
|
dvail
left a comment
There was a problem hiding this comment.
Great catches Mark! I'm contemplating a change to a more descriptor style pattern for table columns in VM, due to the upcoming needs of the dynamic plugin. If we go that route, we can likely determine colSpan in a better way without manual adjustments going forward.
Description
Problems
colspan="5"attribute oftdelement when presence of Advisory column increases total to 6.Therefore layer has less than available width.
tdelement, I also found inconsistentcolspanattribute for component table itself.colspan={7}attribute is out-of-date and too small.colspan={6}attribute is up-to-date, becamebut incorrect when I substituted inline value with computed value, becausecolspan={8}attribute ofTbodyUnifiedfor filtered empty state is incorrect. Maybe copy-paste from images?Solution
Follow conditional
colSpanpattern from elsewhere.User-facing documentation
Testing and quality
Automated testing
How I validated my change
npm run tscin ui/apps/platform folder.npm run lintin ui/apps/platform folder.Manual testing with Advisory column
Temporarily edit code to simulate
ROX_FLATTEN_CVE_DATAfeature flag enabled, because it is not yet enabled for staging demo.Visit /main/vulnerabilities/user-workloads/cves/id with and expand vulnerability row to see
ImageComponentVulnerabilitiesTableelement.Before changes, with constant

colSpan={5}prop, see inconsistentcolspan="5"attribute oftdelement, therefore layer has less than available width.After changes, with conditional

colSpan={colSpanForDockerfileLayer}prop, consistentcolspan="6"attribute oftdelement, therefore layer has available width.Click Deployments and then expand vulnerability row to see
DeploymentComponentVulnerabilitiesTableelement.Before changes, with constant

colSpan={8}prop, see inconsistentcolspan="8"attribute oftdelement, therefore layer has less than available width.After changes, with conditional

colSpan={colSpanForDockerfileLayer}prop, consistentcolspan="9"attribute oftdelement, therefore layer has available width.Manual testing without Advisory column
Visit /main/vulnerabilities/user-workloads/cves/id with and expand vulnerability row to see
ImageComponentVulnerabilitiesTableelement.colSpan={colSpanForDockerfileLayer}prop, see consistentcolspan="5"attribute oftdelement, therefore layer has available width.Click Deployments and then expand vulnerability row to see
DeploymentComponentVulnerabilitiesTableelement.colSpan={colSpanForDockerfileLayer}prop, see consistentcolspan="8"attribute oftdelement, therefore layer has available width.Bonus
Visit /main/vulnerabilities/user-workloads/cves/id with and expand vulnerability row to see
ImageComponentVulnerabilitiesTableelement.Before changes, with constant

colSpan={7}prop, see inconsistentcolspan="7"attribute oftdelement, therefore component table has less than available width.After changes, with conditional

colSpan={colSpanForComponentVulnerabilitiesTable}prop, consistentcolspan="8"attribute oftdelement, therefore component table has available width.Click Deployments filter for no matches, and then expand vulnerability row to see
DeploymentComponentVulnerabilitiesTableelement.Before changes, with incorrect

8 + -hiddenColumnCountprop, see inconsistentcolspan="8"attribute oftdelement, althoughTbodyFilteredEmptyhas available width.After changes, with conditional

7 + -hiddenColumnCountprop, see consistentcolspan="7"attribute oftdelement, thereforeTbodyFilteredEmptyhas available width.