Filter feed type. Closes #421#907
Conversation
|
@regulartim The frontend-tests pass locally but fail on the CI. Any idea why? |
|
I think I have it figured out. |
Happens, no worries!
Ok, nice. If you get stuck, just ping me and I'll take a look. |
|
Hey @armoredvortex! There's a merge conflict unfortunately. Please resolve it. |
regulartim
left a comment
There was a problem hiding this comment.
Hey @armoredvortex ! Thanks for your work! Before going into detail, I want to discuss two fundamental issues I have with this:
- I think the new UI element just looks off. It also grows indefinitely when selecting more feed types. Can't we match the style of the simple dropdown?
- You decided to use intersection semantics when multiple feed types are selected. What was the reason for that? Intuitively, I would expect such a field to use union semantics.
|
There was a problem hiding this comment.
Pull request overview
Adds support for filtering Feeds by chaining multiple feed types (intersection semantics) and removes UI sorting on columns that can’t be correctly sorted server-side under pagination.
Changes:
- Backend: parse comma-separated
feed_type, validate each type, and apply chained feed-type filters in the queryset. - Frontend: switch Feed type filter to a multi-select control and disable sorting for “Feed type” and “Details” columns.
- Tests: add serializer, API view, and frontend component coverage for multi-feed-type behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
api/views/utils.py |
Parses multi feed_type into a list and applies intersection filtering at the queryset level. |
api/serializers.py |
Updates feed_type validation to support comma-separated values. |
frontend/src/components/feeds/Feeds.jsx |
Introduces multi-select feed type UI and updates state/url handling for filters. |
frontend/src/components/feeds/tableColumns.jsx |
Disables sorting for “Feed type” and “Details” columns. |
tests/test_serializers.py |
Adds unit tests for multi-feed-type validation. |
tests/api/views/test_feeds_view.py |
Adds API tests for multi-feed-type intersection and invalid type handling. |
frontend/tests/components/feeds/Feeds.test.jsx |
Adds frontend tests for multi-select behavior and URL/params propagation. |
Comments suppressed due to low confidence (1)
frontend/src/components/feeds/Feeds.jsx:117
DEFAULT_VALUESdefinesfeeds_type, but the initialfeedsStateis built fromDEFAULT_VALUES.feeds_type(missing the "s"), which will beundefinedand produce an invalid raw-data URL and table params on first render. UseDEFAULT_VALUES.feeds_typeconsistently when constructingurlandtableParams.feed_type.
const [feedsState, setFeedsState] = React.useState({
url: `${FEEDS_BASE_URI}/${DEFAULT_VALUES.feeds_type}/${DEFAULT_VALUES.attack_type}/${DEFAULT_VALUES.prioritize}.json`,
tableParams: {
feed_type: DEFAULT_VALUES.feeds_type,
attack_type: DEFAULT_VALUES.attack_type,
ioc_type: DEFAULT_VALUES.ioc_type,
prioritize: DEFAULT_VALUES.prioritize,
},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4bdcb06 to
f15194d
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Yeah, that's what I was afraid of. I am not sure what's the best solution here. If making a simple new component is not too complicated, I think that would be the best solution, right?
I think I prefer the union. |
I believe the button looks a lot better this way now. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Indeed! :D |
* disable sorting by feed type and details * chain filter by feed types on backend * use multiselectdropdowninput from certego, to select feed types * frontend test * Set feeds_type in formik on feed type selection * add backend tests * resolve conflicts using formik state management * fix error in multiselect test * fix feed_type filtering for requests like all,cowrie Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update docstring for feed_type * update feed_type handling to allow multiple selections and adjust URL construction * use union in place of intersection * update test for union * dropdown component for feeds_type * update tests to mock the new component * Update frontend/src/components/feeds/MultiSelectDropdown.jsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * bug fix: set distinct=True to prevent duplicated feed types * add parse_feed_types() function and update validation in feed request serializer * limit max feed_types based on distinct feed_types * set default for value prop in MultiSelectDropdown --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>



Description
Ability to filter Feeds by chaining multiple feed types.
Disable sorting by feed type and details column.
Related issues
#421
Type of change
Checklist
Formalities
<feature name>. Closes #999develop.develop.Docs and tests
Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.GUI changes