-
Notifications
You must be signed in to change notification settings - Fork 18
✨ Add date filter and replace dateRange #655
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Reviewer's GuideIntroduce a new "date" filter type and replace all existing dateRange filters with separate before/after date filters across list contexts, update request parameter handling to support the new filter type, and add dedicated DateFilter components and rendering logic. Sequence diagram for applying a date filter in the filter toolbarsequenceDiagram
participant User as actor User
participant FilterToolbar
participant DateFilter
participant getFilterHubRequestParams
User->>FilterToolbar: Selects a date filter
FilterToolbar->>DateFilter: Renders DatePicker
User->>DateFilter: Picks a date
DateFilter->>FilterToolbar: Updates filter value
FilterToolbar->>getFilterHubRequestParams: Prepares request params with date filter
getFilterHubRequestParams->>FilterToolbar: Returns updated params
Class diagram for new and updated filter componentsclassDiagram
class FilterType {
<<enum>>
multiselect
search
numsearch
date
dateRange
autocompleteLabel
}
class DateFilter {
+category
+filterValue
+setFilterValue
+showToolbarItem
+isDisabled
+onDateChange()
}
class DateRangeFilter {
+category
+filterValue
+setFilterValue
+showToolbarItem
+isDisabled
+onDateChange()
}
FilterType <|-- DateFilter
FilterType <|-- DateRangeFilter
class FilterControl {
+category
+props
+render()
}
FilterControl --> DateFilter : uses
FilterControl --> DateRangeFilter : uses
Class diagram for updated filter context interfacesclassDiagram
class IAdvisorySearchContext {
+modifiedBefore
+modifiedAfter
}
class ISbomSearchContext {
+publishedBefore
+publishedAfter
}
class IVulnerabilitySearchContext {
+publishedBefore
+publishedAfter
}
IAdvisorySearchContext o-- FilterType
ISbomSearchContext o-- FilterType
IVulnerabilitySearchContext o-- FilterType
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The two DateFilter implementations in FilterToolbar and FilterPanel are nearly identical—consider consolidating them into a single reusable component to reduce duplication and ensure consistency.
- The date parsing/formatting utilities are duplicated under both FilterToolbar and FilterPanel—extract them into a shared module to avoid code duplication and divergence.
- In getFilterHubRequestParams, add a return or else branch after handling FilterType.date to prevent falling through and unintentionally processing the dateRange logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The two DateFilter implementations in FilterToolbar and FilterPanel are nearly identical—consider consolidating them into a single reusable component to reduce duplication and ensure consistency.
- The date parsing/formatting utilities are duplicated under both FilterToolbar and FilterPanel—extract them into a shared module to avoid code duplication and divergence.
- In getFilterHubRequestParams, add a return or else branch after handling FilterType.date to prevent falling through and unintentionally processing the dateRange logic.
## Individual Comments
### Comment 1
<location> `client/src/app/hooks/table-controls/filtering/getFilterHubRequestParams.ts:146` </location>
<code_context>
},
});
}
+ if (filterCategory.type === "date") {
+ const date = parseAmericanDate(serverFilterValue[0]);
+ pushOrMergeFilter(filters, {
+ field: serverFilterField,
+ operator: filterCategory.operator ?? "=",
</code_context>
<issue_to_address>
Date filter assumes serverFilterValue[0] is always present and valid.
Add a check to ensure serverFilterValue[0] exists and is a valid date before calling parseAmericanDate to prevent downstream errors.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
client/src/app/hooks/table-controls/filtering/getFilterHubRequestParams.ts
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #655 +/- ##
==========================================
- Coverage 57.28% 55.95% -1.33%
==========================================
Files 146 148 +2
Lines 2430 2475 +45
Branches 552 565 +13
==========================================
- Hits 1392 1385 -7
- Misses 833 884 +51
- Partials 205 206 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes: #393, #394, https://issues.redhat.com/browse/TC-2393, and https://issues.redhat.com/browse/TC-2402
date
.The image below is an example of how the date filter is visulized:

Summary by Sourcery
Add a new date filter type and migrate all dateRange filters to separate before/after date filters across multiple list contexts, updating the UI components and request parameter handling to fix related issues
New Features:
Bug Fixes:
Enhancements: