feat(RHINENG-25194): CVE Table migration to new library#2587
Conversation
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In
useCvesPage, there is aconsole.login auseEffectthat will fire in production; consider removing it or routing through whatever logging/telemetry mechanism you normally use to avoid noisy console output.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `useCvesPage`, there is a `console.log` in a `useEffect` that will fire in production; consider removing it or routing through whatever logging/telemetry mechanism you normally use to avoid noisy console output.
## Individual Comments
### Comment 1
<location path="src/Helpers/tableToolsSerialisers.js" line_range="9-10" />
<code_context>
+ }
+};
+
+const textFilterSerialiser = (filterConfigItem, value) =>
+ ƒ`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`;
+const checkboxFilterSerialiser = (filterConfigItem, values) =>
+ `.${filterConfigItem.filterAttribute} in [${values
</code_context>
<issue_to_address>
**issue (bug_risk):** The text filter serialiser contains an invalid character and will not compile.
Please replace the `ƒ` usage with a valid function or template-literal syntax. For example:
```js
const textFilterSerialiser = (filterConfigItem, value) =>
`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`;
```
or adjust the string format to whatever the table tools query engine expects.
</issue_to_address>
### Comment 2
<location path="src/Components/SmartComponents/CVEs/useCveTableTableToolsState.js" line_range="29-44" />
<code_context>
+
+ const isEmpty = cves.data.length === 0;
+
+ const emptyRows = useMemo(
+ () => [
+ {
+ heightAuto: true,
+ cells: [
+ {
+ props: { colSpan: header?.length },
+ title: <EmptyStateNoCVEs secondParagraph={emptyMessage} />,
+ },
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Empty-state row colSpan may not cover the selection/expand columns.
`emptyRows` uses `colSpan: header?.length`, but the table can render extra columns for expand/selection (`isExpandable`, `canCollapseAll`, `canSelectAll`). This can leave the empty-state cell too narrow. Please derive `colSpan` from the full rendered column count (including expand/selection), e.g. by computing it from the same header structure as `buildCveExpandableSortHeader` rather than `header.length` alone.
```suggestion
const isEmpty = cves.data.length === 0;
const emptyRows = useMemo(
() => [
{
heightAuto: true,
cells: [
{
props: { colSpan: sortHeaderWithCollapse?.length },
title: <EmptyStateNoCVEs secondParagraph={emptyMessage} />,
},
],
},
],
[emptyMessage, sortHeaderWithCollapse?.length],
);
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| import { SkeletonTable } from '@patternfly/react-component-groups'; | ||
| import { useCveTableTableToolsState } from './useCveTableTableToolsState'; | ||
|
|
||
| const CVEsTableTableToolsInner = ({ header }) => { |
There was a problem hiding this comment.
What was the reason for building a custom table? As far as i can see this seems to only replicate https://github.com/bastilian/tabletools/blob/main/src/components/TableToolsTable/TableToolsTable.js#L20
There was a problem hiding this comment.
😶🌫️ To be honest, there wasn’t a deeper reason. I ran into issues while wiring everything up, so I debugged it step by step and then I forgot to switch the manual Table over to TableToolsTable. Sorry, that’s on me (and my short memory)
I’ll take this back as a follow-up refactor to use the proper component.
There was a problem hiding this comment.
cleaned it up, it should be better overall now
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
useCveTableToolsQueryhook uses a fixedqueryKey: ['cveListByAccount', 'tableTools']while passingparamsseparately; ifuseQueryWithUtilitieskeys only byqueryKeythis will cause different parameter combinations to share cache, so consider incorporatingparams(or a stable hash of them) into the query key to avoid stale or mixed results.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `useCveTableToolsQuery` hook uses a fixed `queryKey: ['cveListByAccount', 'tableTools']` while passing `params` separately; if `useQueryWithUtilities` keys only by `queryKey` this will cause different parameter combinations to share cache, so consider incorporating `params` (or a stable hash of them) into the query key to avoid stale or mixed results.
## Individual Comments
### Comment 1
<location path="src/Helpers/tableToolsSerialisers.js" line_range="9-10" />
<code_context>
+ }
+};
+
+const textFilterSerialiser = (filterConfigItem, value) =>
+ ƒ`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`;
+const checkboxFilterSerialiser = (filterConfigItem, values) =>
+ `.${filterConfigItem.filterAttribute} in [${values
</code_context>
<issue_to_address>
**issue (bug_risk):** The text filter serialiser uses an undefined template tag `ƒ`, which will cause a runtime error.
In `textFilterSerialiser`, ``ƒ`regex(...)` `` is parsed as a tagged template using an identifier `ƒ` that is never defined, so this will throw at runtime when invoked. If this should just be a normal template string, remove the tag:
```js
const textFilterSerialiser = (filterConfigItem, value) =>
`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`;
```
If a tagged template was intended, please add and import the `ƒ` tag implementation.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const textFilterSerialiser = (filterConfigItem, value) => | ||
| ƒ`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`; |
There was a problem hiding this comment.
issue (bug_risk): The text filter serialiser uses an undefined template tag ƒ, which will cause a runtime error.
In textFilterSerialiser, ƒ`regex(...)` is parsed as a tagged template using an identifier ƒ that is never defined, so this will throw at runtime when invoked. If this should just be a normal template string, remove the tag:
const textFilterSerialiser = (filterConfigItem, value) =>
`regex(.${filterConfigItem.filterAttribute}, "${value}", "i")`;If a tagged template was intended, please add and import the ƒ tag implementation.
|
#2642 WIP |
What
vulnerability.table-tools: switch between the old and the new table safely.How to test
vulnerability.table-toolsReload the page and check:.../vulnerabilities/cvesrequest after load.Summary by Sourcery
Introduce a new feature-flagged CVE table implementation using bastilian-tabletools while centralizing CVEs page logic into a dedicated hook and updating data-fetching and state sync behavior.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: