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: quick links CRUD #6286

Draft
wants to merge 2 commits into
base: preview
Choose a base branch
from
Draft

feat: quick links CRUD #6286

wants to merge 2 commits into from

Conversation

sangeethailango
Copy link
Collaborator

@sangeethailango sangeethailango commented Dec 27, 2024

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Introduced a new serializer for managing workspace user links.
    • Added endpoints for creating, listing, and managing quick links within workspaces.
  • Bug Fixes

    • Enhanced validation and error handling for quick link creation and updates.
  • Documentation

    • Updated import statements to reflect new functionality related to quick links in the workspace.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


sangeetha seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

This pull request introduces a new feature for managing quick links within workspaces. The implementation spans multiple files, adding a new serializer for WorkspaceUserLink, creating a dedicated ViewSet to handle quick link operations, and configuring URL routes for creating, listing, updating, and deleting quick links. The changes provide endpoints for workspace users to manage quick links with appropriate permission controls.

Changes

File Change Summary
apiserver/plane/app/serializers/__init__.py Added import for WorkspaceUserLinkSerializer
apiserver/plane/app/serializers/workspace.py Introduced WorkspaceUserLinkSerializer for WorkspaceUserLink model
apiserver/plane/app/urls/workspace.py Added URL patterns for quick link management
apiserver/plane/app/views/__init__.py Imported QuickLinkViewSet
apiserver/plane/app/views/workspace/quick_link.py Created QuickLinkViewSet with create and partial update methods

Sequence Diagram

sequenceDiagram
    participant Client
    participant QuickLinkViewSet
    participant WorkspaceUserLinkSerializer
    participant Database

    Client->>QuickLinkViewSet: POST /workspaces/{slug}/quick-link/
    QuickLinkViewSet->>WorkspaceUserLinkSerializer: Validate data
    WorkspaceUserLinkSerializer-->>QuickLinkViewSet: Validation result
    QuickLinkViewSet->>Database: Save new quick link
    Database-->>QuickLinkViewSet: Saved link
    QuickLinkViewSet-->>Client: 201 Created
Loading

Possibly related PRs

Suggested labels

🌐frontend, ⚙️backend

Suggested reviewers

  • sriramveeraghanta
  • pablohashescobar
  • SatishGandham

Poem

🐰 Hop, hop, quick links arise!
In workspaces, new features surprise
Serializers dance, routes unfurl
A rabbit's code begins to swirl
Swift and nimble, connections grow
Technology's magic starts to flow! 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@sangeethailango sangeethailango marked this pull request as draft December 27, 2024 14:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
apiserver/plane/app/views/workspace/quick_link.py (1)

29-29: Shorten line length.

A static analysis tool indicates line length exceeds 88 characters. Consider breaking it into multiple lines or using local variables to make it more readable and comply with style guides.

- serializer = WorkspaceUserLinkSerializer(quick_link, data=request.data, partial=True)
+ serializer = WorkspaceUserLinkSerializer(
+     quick_link, data=request.data, partial=True
+ )
🧰 Tools
🪛 Ruff (0.8.2)

29-29: Line too long (93 > 88)

(E501)

apiserver/plane/app/urls/workspace.py (2)

217-218: Use a more descriptive comment.

While "quick link" is clear, it can be more descriptive for future maintainers, e.g., "# Endpoints for managing quick links within a workspace".


219-223: Remove trailing space from name="workspace-quick-links " string.

There is a trailing space in the name argument's string literal, which can accidentally cause inconsistencies when referencing this path name in other parts of the code.

-        name="workspace-quick-links "
+        name="workspace-quick-links"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 211d5e1 and 64c2d0a.

📒 Files selected for processing (5)
  • apiserver/plane/app/serializers/__init__.py (1 hunks)
  • apiserver/plane/app/serializers/workspace.py (2 hunks)
  • apiserver/plane/app/urls/workspace.py (2 hunks)
  • apiserver/plane/app/views/__init__.py (1 hunks)
  • apiserver/plane/app/views/workspace/quick_link.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
apiserver/plane/app/views/workspace/quick_link.py

29-29: Line too long (93 > 88)

(E501)

🔇 Additional comments (4)
apiserver/plane/app/serializers/workspace.py (1)

110-114: Serializer fields look consistent.

The WorkspaceUserLinkSerializer includes fields = "__all__", but marks workspace and owner as read-only. This is consistent with many usage patterns to avoid accidental overrides. No issues found here.

apiserver/plane/app/serializers/__init__.py (1)

22-22: LGTM.

Importing WorkspaceUserLinkSerializer here neatly centralizes your exports. No changes needed.

apiserver/plane/app/views/__init__.py (1)

75-75: Approved import addition.

Adding QuickLinkViewSet is consistent with the new feature. This arrangement keeps workspace-related views logically grouped.

apiserver/plane/app/urls/workspace.py (1)

224-228: Verify whether a GET endpoint is needed to retrieve a single quick link.

Currently, only patch and delete are exposed for single quick links. If retrieving an individual quick link by ID is desired, consider adding a retrieve action. Otherwise, confirm that you do not need to retrieve a single quick link in your use case.

✅ Verification successful

Let me gather more information about the quick link functionality to better understand the use case.


Let me try a different approach to understand the quick link functionality better.


A GET endpoint for single quick link retrieval is not necessary

Based on the codebase analysis:

  • The workspace quick links are simple entities with basic fields (title, url, metadata)
  • All quick links for a workspace can be retrieved using the list endpoint (GET /workspaces/<slug>/quick-links/)
  • The current CRUD operations (list all, create, update, delete) are sufficient for the use case
  • There's no evidence of a need for individual quick link retrieval in the frontend code

Since quick links are lightweight resources and can be efficiently retrieved through the list endpoint, adding a separate retrieve endpoint would be unnecessary complexity.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of QuickLinkViewSet across the codebase to confirm if GET retrieval by pk is needed.
rg -A 5 --heading $'QuickLinkViewSet'

Length of output: 853


Script:

#!/bin/bash
# Check the model and serializer implementation
ast-grep --pattern 'class WorkspaceUserLink'

# Check frontend API calls
rg -g '*.{ts,tsx}' 'quick-link.*pk'

Length of output: 84


Script:

#!/bin/bash
# Check the model definition
rg -A 10 "class WorkspaceUserLink"

# Check frontend API calls related to quick links
rg -g '*.{ts,tsx}' -A 5 "quick-link"

# Check serializer implementation
rg -A 10 "class WorkspaceUserLinkSerializer"

Length of output: 1718

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.

2 participants