Skip to content
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

feat: added labels to evidences #1771

Merged
merged 3 commits into from
Apr 6, 2025
Merged

Conversation

melinoix
Copy link
Contributor

@melinoix melinoix commented Mar 27, 2025

added labels to evidences with a filter on labels and auto creation in the form.

Summary by CodeRabbit

  • New Features
    • Enhanced evidence records by adding support for filtering labels.
    • Updated the API to include filtering labels for refined data handling.
    • Improved the user interface by integrating label selection in forms, list views, and filters for better evidence management.

Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Walkthrough

The changes enhance filtering functionality for evidence records. The Evidence model now extends a filtering mixin and includes a new many-to-many field "filtering_labels" via a migration. The serializer and view have been updated to incorporate this field, allowing evidence to be filtered based on associated labels. On the frontend, an AutocompleteSelect component is integrated into the EvidenceForm, and the CRUD mappings, schema definitions, and table view configurations are adjusted to support filtering_labels. These modifications synchronize filtering labels support across both backend and frontend.

Changes

File(s) Change Summary
backend/core/models.py, backend/core/migrations/0066_evidence_filtering_labels.py Extended the Evidence model with FilteringLabelMixin and added a many-to-many filtering_labels field via a new migration.
backend/core/serializers.py, backend/core/views.py Added the filtering_labels field to EvidenceReadSerializer and updated EvidenceViewSet’s filterset_fields.
frontend/src/lib/components/Forms/ModelForm/EvidenceForm.svelte Integrated a new <AutocompleteSelect> component configured for multiple selection of filtering labels.
frontend/src/lib/utils/crud.ts, frontend/src/lib/utils/schemas.ts, frontend/src/lib/utils/table.ts Updated foreign key mappings, schema definitions, and list view configurations (head, body, filters) to support filtering_labels.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Frontend
    participant Backend
    participant Serializer
    participant Model

    User->>UI: Select filtering labels via Autocomplete
    UI->>Frontend: Submit evidence form data
    Frontend->>Backend: Request evidence data with filtering_labels
    Backend->>Serializer: Serialize Evidence (including filtering_labels)
    Serializer->>Model: Retrieve filtering_labels associations
    Model-->>Serializer: Return filtering labels data
    Serializer-->>Backend: Deliver serialized data
    Backend-->>Frontend: Respond with enriched evidence details
    Frontend-->>UI: Display evidence with filtering labels
Loading

Poem

I'm a bunny with a code-filled cheer,
Hopping through mixins and labels so dear.
I nibble through fields, both back and front,
With new filtering labels in every hunt.
In a code carrot garden, my joy is clear!
🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e549ed and ad314e5.

📒 Files selected for processing (1)
  • backend/core/migrations/0066_evidence_filtering_labels.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/core/migrations/0066_evidence_filtering_labels.py
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: functional-tests (3.12, chromium)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: build (3.12)
  • GitHub Check: test (3.12)
  • GitHub Check: Analyze (python)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@eric-intuitem eric-intuitem left a comment

Choose a reason for hiding this comment

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

LGTM

@eric-intuitem eric-intuitem self-requested a review April 6, 2025 20:28
Update 0066_evidence_filtering_labels.py
ruff
@eric-intuitem eric-intuitem force-pushed the CA-926-add-labels-on-on-evidences branch from 9e549ed to ad314e5 Compare April 6, 2025 20:44
@ab-smith ab-smith merged commit 890b87b into main Apr 6, 2025
20 checks passed
@ab-smith ab-smith deleted the CA-926-add-labels-on-on-evidences branch April 6, 2025 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants