added changes to fix affected project search in vulnerabilities page#1944
added changes to fix affected project search in vulnerabilities page#1944
Conversation
Signed-off-by: Meha Bhargava <meha.bhargava2@gmail.com>
Signed-off-by: Meha Bhargava <meha.bhargava2@gmail.com>
| AND ( | ||
| LOWER("PROJECT"."NAME") LIKE ('%' || LOWER(:searchText) || '%') | ||
| OR LOWER(COALESCE("PROJECT"."VERSION", '')) LIKE ('%' || LOWER(:searchText) || '%') | ||
| OR CAST("PROJECT"."UUID" AS TEXT) LIKE ('%' || :searchText || '%') |
There was a problem hiding this comment.
Is searching by UUID a requirement? I think no other endpoint uses searchText for UUID columns.
None of these expressions are indexed, so the fewer we can use the better.
| @Parameter(description = "Optionally filters affected projects by name, version, or UUID", required = false) | ||
| @QueryParam("searchText") String searchText) { |
There was a problem hiding this comment.
Nit: searchText is an implicit parameter defined at the framework-level, no need to define an explicit one. You can access it directly via getAlpineRequest().getFilter().
Signed-off-by: Meha Bhargava <meha.bhargava2@gmail.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
🟢 Coverage 85.71% diff coverage
Metric Results Coverage variation Report missing for d89d8951 Diff coverage ✅ 85.71% diff coverage (70.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (d89d895) Report Missing Report Missing Report Missing Head commit (2f648d3) 25831 22096 85.54% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#1944) 7 6 85.71% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
TIP This summary will be updated as you push new changes. Give us feedback
nscuro
left a comment
There was a problem hiding this comment.
Let's get the API docs cleaned up, otherwise looks good.
| description = """ | ||
| <p>Requires permission <strong>VIEW_PORTFOLIO</strong></p>\ | ||
| <p>Optional query parameters <code>searchText</code> or <code>filter</code> narrow the list; \ | ||
| both are provided by the Alpine request filter and match the same value.</p>""", |
There was a problem hiding this comment.
This is an implementation detail that doesn't belong in public API documentation.
| description = "<p>Requires permission <strong>VIEW_PORTFOLIO</strong></p>" | ||
| description = """ | ||
| <p>Requires permission <strong>VIEW_PORTFOLIO</strong></p>\ | ||
| <p>Optional query parameters <code>searchText</code> or <code>filter</code> narrow the list; \ |
There was a problem hiding this comment.
Let's commit to only searchText to avoid confusion. Also, when we explicitly mention it, we should also note what it searches (i.e. project name, case-insensitive, "contains" semantics).
| final AlpineRequest alpineRequest = getAlpineRequest(); | ||
| final String affectedProjectsFilter; | ||
| if (alpineRequest == null) { |
There was a problem hiding this comment.
getAlpineRequest should never return null, no need to handle that here.
Description
This PR fixes the affected project search on the vulnerability detail page. Currently this search does not refresh if project name is provided in the search bar
Addressed Issue
If the number of affected projects is too many for a vulnerability, the search box should help us search specific project as needed. Currently even if we type something in the search box, the list does not get refreshed.
Additional Details
Checklist