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

[WEB-2941]chore: added transfer issues button to cycles #6294

Closed
wants to merge 2 commits into from

Conversation

vamsikrishnamathala
Copy link
Collaborator

@vamsikrishnamathala vamsikrishnamathala commented Dec 31, 2024

Description

A button was added to transfer issues to the completed cycles list.
Restructured files for cycles quick actions.
Updated transfer Icon view box.

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

Screen.Recording.2024-12-31.at.4.13.37.PM.mov

References

WEB-2941

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added functionality to transfer issues between cycles.
    • Introduced new cycle action states (start/stop).
    • Enhanced module exports for quick actions in multiple components.
  • Bug Fixes

    • Updated import paths for cycle-related components.
  • Refactor

    • Modified transfer issues modal to handle cycle details more robustly.
    • Updated cycle store with new state management method.
  • Style

    • Adjusted SVG icon viewBox for better rendering.

*feat: added transfer issues button to list
Copy link
Contributor

coderabbitai bot commented Dec 31, 2024

Walkthrough

This pull request introduces modifications across several components related to cycle management in a web application. The changes primarily focus on enhancing the transfer issues functionality, updating import paths, and adding new constants for cycle actions. The modifications span multiple files in the web core and UI components, introducing a new transfer issues modal, updating cycle-related stores, and adjusting component imports and exports.

Changes

File Change Summary
packages/ui/src/icons/transfer-icon.tsx Modified SVG viewBox from 0 0 24 24 to 0 0 24 20
web/ce/components/cycles/index.ts Added export for quick-actions module
web/core/components/cycles/index.ts Removed export for quick-actions module
web/core/components/cycles/list/cycle-list-item-action.tsx Added transferIssuesModal state and TransferIssuesModal rendering
web/core/components/cycles/list/cycles-list-item.tsx Updated import path for CycleQuickActions
web/core/components/cycles/transfer-issues-modal.tsx Added cycleId prop, enhanced transfer issue functionality
web/core/components/issues/issue-layouts/roots/cycle-layout-root.tsx Modified TransferIssuesModal prop handling
web/core/constants/cycle.ts Added ECycleAction enum
web/core/store/cycle.store.ts Added updateCycleState method to CycleStore
web/ee/components/cycles/index.ts Added export for ce/components/cycles/quick-actions

Possibly related PRs

Suggested reviewers

  • SatishGandham
  • sriramveeraghanta
  • rahulramesha

Poem

🐰 Cycles spinning, issues in flight,
Transfer modal shining ever so bright.
Code paths shifting, exports realigned,
A rabbit's dance of logic refined!
Hop, hop, hooray for change so neat! 🚀

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.

@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft December 31, 2024 10:50
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: 1

🧹 Nitpick comments (3)
web/core/components/cycles/transfer-issues-modal.tsx (1)

52-52: Error toast for issue transfer.
The message is concise. Confirm whether more specific user guidance is needed for different error conditions.

web/core/components/cycles/list/cycle-list-item-action.tsx (1)

248-259: Conditional button for transferring issues.
This is a clear UI indicator. The label “Transfer {transferableIssuesCount} issues” is direct. Ensure a good UX if the user quickly toggles the cycle status or tries to open the modal multiple times.

web/core/store/cycle.store.ts (1)

724-726: Implement updateCycleState functionality.
Currently empty. Provide the logic or remove if not needed yet. If it’s a placeholder, consider using a TODO comment.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c7ebaf6 and d2bf3c8.

📒 Files selected for processing (10)
  • packages/ui/src/icons/transfer-icon.tsx (1 hunks)
  • web/ce/components/cycles/index.ts (1 hunks)
  • web/core/components/cycles/index.ts (0 hunks)
  • web/core/components/cycles/list/cycle-list-item-action.tsx (7 hunks)
  • web/core/components/cycles/list/cycles-list-item.tsx (1 hunks)
  • web/core/components/cycles/transfer-issues-modal.tsx (3 hunks)
  • web/core/components/issues/issue-layouts/roots/cycle-layout-root.tsx (1 hunks)
  • web/core/constants/cycle.ts (1 hunks)
  • web/core/store/cycle.store.ts (3 hunks)
  • web/ee/components/cycles/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • web/core/components/cycles/index.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/ui/src/icons/transfer-icon.tsx
  • web/core/components/cycles/list/cycles-list-item.tsx
🔇 Additional comments (19)
web/ce/components/cycles/index.ts (1)

3-3: Re-exporting quick-actions is aligned with the new file structure.

This line re-exposes the functionalities from ./quick-actions to consumers of this module. This looks good and consistent with the module's export strategy.

web/ee/components/cycles/index.ts (1)

3-3: Confirm correctness of cross-edition reference.

Here the quick-actions from the community edition (ce/components/cycles) are being re-exported in the enterprise edition. Make sure it’s valid for the enterprise codebase to rely on community edition components. If so, it makes sense to keep this code DRY.

Consider running a check to ensure the path is correct and accessible:

✅ Verification successful

Let me verify the imports and cross-edition references further.


Let me try the searches again with correct file type specifications.


Let me try one last search with simpler patterns.


Cross-edition reference is valid and follows established pattern

The verification shows that:

  1. The re-export of CE components in EE is a common and established pattern in this codebase, with numerous examples across different components and modules.
  2. The specific path ce/components/cycles/quick-actions exists and is correctly referenced.
  3. The cycles component structure is mirrored between CE and EE directories, indicating proper organization.
  4. The quick-actions component in CE is a legitimate React component with proper implementation.

This re-export helps maintain DRY principles by reusing CE components in EE when the functionality is identical, which is a valid architectural decision.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Using fd to find the quick-actions index, verifying the path "ce/components/cycles/quick-actions"
fd quick-actions

Length of output: 278


Script:

#!/bin/bash
# Check the content of the quick-actions file in CE
cat web/ce/components/cycles/quick-actions.tsx

# Check if there are any other imports of quick-actions from CE to EE
rg "from ['\"]ce/components/cycles/quick-actions" --type ts --type tsx

# Check if there's a pattern of CE to EE imports
rg "from ['\"]ce/" web/ee/ --type ts --type tsx

Length of output: 6681


Script:

#!/bin/bash
# Check for imports of quick-actions from CE to EE
rg -t typescript -t tsx "from ['\"]ce/components/cycles/quick-actions"

# Check for the pattern of CE to EE imports
rg -t typescript -t tsx "from ['\"]ce/" web/ee/

# Check if there's a pattern of CE components being re-exported in EE
rg -t typescript -t tsx "export.*from ['\"]ce/" web/ee/

Length of output: 291


Script:

#!/bin/bash
# Check for any imports or exports from CE in EE
rg "from.*ce/" web/ee/
rg "export.*from.*ce/" web/ee/

# Check the directory structure to understand the relationship between CE and EE
ls -la web/ce/components/cycles/
ls -la web/ee/components/cycles/

Length of output: 17990

web/core/constants/cycle.ts (1)

131-134: Enum addition looks consistent with typical usage.

Adding ECycleAction clarifies cycle actions, improving readability. The naming convention is clear and expandable for future actions.

web/core/components/cycles/transfer-issues-modal.tsx (7)

20-20: Confirm cycleId necessity and usage.
If there's a scenario where cycleId might be undefined or irrelevant, consider making it optional. Otherwise, this approach is acceptable.


24-24: Destructure cycleId appropriately.
This clearly captures the new prop. No issues noted, though double-check if cycleId must always be required.


29-29: Efficient usage of store hooks.
Using currentProjectIncompleteCycleIds, getCycleById, and fetchCycleDetails from useCycle() is straightforward and maintains clarity.


36-46: Resolve promise handling for transferIssue.
The success callback is clearly setting UI feedback via toast and calling getCycleDetails. This is good. If multiple async calls begin to stack, consider using a try/catch block for improved maintainability.


57-70: getCycleDetails usage of Promise.all.
Fetching both current and target cycle details in parallel is efficient. The catch block properly handles toast notifications. This is well structured.


115-116: Icon usage clarity.
Displaying the TransferIcon alongside a heading is intuitive. The styling with .fill-custom-text-100 ensures consistent appearance. No issues here.


126-126: Styling consistency in input field.
The simplified class names improve readability. Looks good.

web/core/components/cycles/list/cycle-list-item-action.tsx (7)

3-3: Refactor note on imports.
Imports remain organized and readable. If the file grows, consider grouping or conditionally loading heavy modules.


18-18: Transfer icon import.
All relevant UI icons are imported together. This maintains consistency across the codebase.


23-23: Conditional rendering for TransferIssuesModal.
Bringing the modal into this file is logical, keeping related functionality together. Be mindful of import paths if the structure changes again.


36-37: Using CycleQuickActions.
Organizing quick actions under plane-web aligns with the recent file restructuring. No issues noted.


61-62: transferIssuesModal state.
This state gating the visibility of the modal is straightforward. Good use of booleans for toggling modals.


84-85: transferableIssuesCount and showTransferIssues.
This logic is concise. However, confirm if the cycle can have a completed status with zero completed issues. Possibly handle negative values or other edge cases.


228-232: Passing cycleId to TransferIssuesModal.
Forwarding cycleId.toString() ensures correct types. This further integrates the new property in the modal.

web/core/store/cycle.store.ts (2)

16-17: Tracked cycle actions with ECycleAction.
Introducing a specialized enum clarifies allowed actions. This is a good approach to strongly typed states.


96-96: updateCycleState signature in ICycleStore.
Defines a clear contract for externally updating the cycle state. Ensure other store methods can integrate with this action consistently.

@pushya22 pushya22 changed the title [WEB-1964]chore: added transfer issues button to cycles [WEB-2941]chore: added transfer issues button to cycles Dec 31, 2024
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review December 31, 2024 11:08
@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft December 31, 2024 11:08
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 (1)
web/core/store/cycle.store.ts (1)

16-17: Consider implementing a state machine for cycle transitions.

The introduction of ECycleAction enum suggests a state-based approach to cycle management. Consider implementing a proper state machine to handle cycle transitions and validations.

Recommendations:

  1. Define valid state transitions using the ECycleAction enum
  2. Implement validation logic for state transitions
  3. Add transition hooks for side effects (e.g., notifications)
  4. Consider using a state machine library like XState for complex state management
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d2bf3c8 and a17eed7.

📒 Files selected for processing (2)
  • web/core/components/issues/issue-layouts/roots/cycle-layout-root.tsx (1 hunks)
  • web/core/store/cycle.store.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/components/issues/issue-layouts/roots/cycle-layout-root.tsx

web/core/store/cycle.store.ts Show resolved Hide resolved
web/core/store/cycle.store.ts Show resolved Hide resolved
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review December 31, 2024 11:12
@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft December 31, 2024 12:13
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review December 31, 2024 12:15
@vamsikrishnamathala vamsikrishnamathala deleted the chore-issue_transfer branch December 31, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants