Skip to content

Filter feed type. Closes #421#907

Merged
regulartim merged 21 commits intoGreedyBear-Project:developfrom
armoredvortex:filter-feed-type
Mar 3, 2026
Merged

Filter feed type. Closes #421#907
regulartim merged 21 commits intoGreedyBear-Project:developfrom
armoredvortex:filter-feed-type

Conversation

@armoredvortex
Copy link
Copy Markdown
Contributor

@armoredvortex armoredvortex commented Feb 28, 2026

Description

Ability to filter Feeds by chaining multiple feed types.
Disable sorting by feed type and details column.

Related issues

#421

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).

Checklist

Formalities

  • I have read and understood the rules about how to Contribute to this project.
  • I chose an appropriate title for the pull request in the form: <feature name>. Closes #999
  • My branch is based on develop.
  • The pull request is for the branch develop.
  • I have reviewed and verified any LLM-generated code included in this PR.

Docs and tests

  • I documented my code changes with docstrings and/or comments.
  • I have checked if my changes affect user-facing behavior that is described in the docs. If so, I also created a pull request in the docs repository.
  • Linter (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved.
  • All the tests gave 0 errors.

GUI changes

2026-02-28T17:07:27,469904809+05:30
  • I have provided a screenshot of the result in the PR.
  • I have created new frontend tests for the new component or updated existing ones.

@armoredvortex
Copy link
Copy Markdown
Contributor Author

@regulartim The frontend-tests pass locally but fail on the CI. Any idea why?
also, i apologize for the last 2 closed PRs i was having trouble with git configuration.

@armoredvortex
Copy link
Copy Markdown
Contributor Author

armoredvortex commented Feb 28, 2026

I think I have it figured out.
I just needed to run update my node modules locally.

@regulartim
Copy link
Copy Markdown
Member

i apologize for the last 2 closed PRs i was having trouble with git configuration.

Happens, no worries!

I think I have it figured out.
I just needed to run update my node modules locally.

Ok, nice. If you get stuck, just ping me and I'll take a look.

@armoredvortex armoredvortex marked this pull request as ready for review February 28, 2026 15:43
@regulartim
Copy link
Copy Markdown
Member

Hey @armoredvortex! There's a merge conflict unfortunately. Please resolve it.

Copy link
Copy Markdown
Member

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @armoredvortex ! Thanks for your work! Before going into detail, I want to discuss two fundamental issues I have with this:

  1. 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?
  2. 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.

@armoredvortex
Copy link
Copy Markdown
Contributor Author

@regulartim

  1. You are right. The component directly comes from certego, so i'm not sure if ill be able to style it much.
    I'll try to change the styles on it to make UX better (or try making a simple new component for it?)

  2. I'm still getting familiar with the project so I'm still not completely sure about what the "target user" would find useful, i thought intersection would help narrow down if looking for specific feed. I'll convert it to union if you say so.

Copilot AI review requested due to automatic review settings March 2, 2026 14:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_VALUES defines feeds_type, but the initial feedsState is built from DEFAULT_VALUES.feeds_type (missing the "s"), which will be undefined and produce an invalid raw-data URL and table params on first render. Use DEFAULT_VALUES.feeds_type consistently when constructing url and tableParams.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.

Comment thread api/serializers.py Outdated
Comment thread api/views/utils.py Outdated
Comment thread frontend/tests/components/feeds/Feeds.test.jsx
Comment thread api/serializers.py
Copilot AI review requested due to automatic review settings March 2, 2026 14:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@armoredvortex armoredvortex marked this pull request as draft March 2, 2026 14:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread frontend/src/components/feeds/Feeds.jsx Outdated
Comment thread frontend/src/components/feeds/Feeds.jsx Outdated
Comment thread api/views/utils.py Outdated
Comment thread api/views/utils.py
Comment thread frontend/tests/components/feeds/Feeds.test.jsx Outdated
Comment thread frontend/tests/components/feeds/Feeds.test.jsx Outdated
Comment thread tests/test_serializers.py Outdated
@regulartim
Copy link
Copy Markdown
Member

You are right. The component directly comes from certego, so i'm not sure if ill be able to style it much.
I'll try to change the styles on it to make UX better (or try making a simple new component for it?)

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'm still getting familiar with the project so I'm still not completely sure about what the "target user" would find useful, i thought intersection would help narrow down if looking for specific feed. I'll convert it to union if you say so.

I think I prefer the union.

@armoredvortex
Copy link
Copy Markdown
Contributor Author

armoredvortex commented Mar 2, 2026

image

I believe the button looks a lot better this way now.
@regulartim

@armoredvortex armoredvortex marked this pull request as ready for review March 2, 2026 21:41
Copilot AI review requested due to automatic review settings March 2, 2026 21:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread frontend/src/components/feeds/MultiSelectDropdown.jsx
Comment thread frontend/src/components/feeds/MultiSelectDropdown.jsx
Comment thread api/serializers.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread api/views/utils.py Outdated
@regulartim
Copy link
Copy Markdown
Member

I believe the button looks a lot better this way now.

Indeed! :D

Copy link
Copy Markdown
Member

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks way better! However I found a bug, see screenshots.

Image Image

Comment thread api/views/utils.py Outdated
Comment thread frontend/src/components/feeds/MultiSelectDropdown.jsx
Comment thread api/serializers.py Outdated
Comment thread api/serializers.py
@armoredvortex armoredvortex requested a review from regulartim March 3, 2026 07:48
Copy link
Copy Markdown
Member

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, thanks! 👍

@regulartim regulartim merged commit be55457 into GreedyBear-Project:develop Mar 3, 2026
5 checks passed
cclts pushed a commit to cclts/GreedyBear that referenced this pull request Mar 11, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants