Skip to content

Conversation

@sjd78
Copy link
Member

@sjd78 sjd78 commented Jun 24, 2025

Upgrade @dnd-kit and @dnd-kit/sortable to latest.

Refactor the migration-targets page and target card components. Simplified the components for more streamlined use on the custom migration targets page and on the analysis wizard target selection step. The migration-targets page layout updated to use Gallery instead of the custom grid.

Summary by CodeRabbit

  • New Features

    • Introduced a new sortable target item component with improved drag handle integration.
    • Added visual cursor feedback for draggable target items.
  • Refactor

    • Enhanced drag-and-drop logic to use full target objects for better state management.
    • Replaced custom grid layout with PatternFly’s responsive gallery layout.
    • Simplified target card drag handle rendering and label/dropdown conditions.
    • Removed legacy drag-and-drop components and related styles.
  • Style

    • Cleaned up target card styles by removing obsolete drag cursor and selection backgrounds.
  • Chores

    • Upgraded the "@dnd-kit/sortable" dependency to the latest version.

@sjd78 sjd78 force-pushed the migration_targets_dnd branch from ec32bc4 to 8fe38e4 Compare June 24, 2025 13:21
@sjd78 sjd78 added this to the v0.8.0 milestone Jun 24, 2025
@sjd78 sjd78 force-pushed the migration_targets_dnd branch from 8fe38e4 to c9cbe64 Compare June 24, 2025 18:35
@sjd78 sjd78 force-pushed the migration_targets_dnd branch from c9cbe64 to 0b4ac83 Compare June 27, 2025 00:49
@sjd78 sjd78 requested a review from rszwajko June 27, 2025 00:50
@coderabbitai
Copy link

coderabbitai bot commented Jun 27, 2025

Walkthrough

The drag-and-drop system for migration targets was refactored. Several DnD-related components and CSS files were removed and replaced with new, type-safe components and updated styling. The drag overlay now uses full target data, and the UI layout uses PatternFly's Gallery. Dependency versions and internal prop interfaces were updated accordingly.

Changes

File(s) Change Summary
client/package.json Updated @dnd-kit/sortable dependency from ^7.0.2 to ^10.0.0.
client/src/app/components/target-card/target-card.css Removed drag handle and selection styles; kept only background override for selectable cards.
client/src/app/components/target-card/target-card.tsx Replaced handleProps prop with dndSortHandle prop; simplified custom label/dropdown rendering.
client/src/app/pages/migration-targets/components/dnd/grid.css
client/src/app/pages/migration-targets/components/dnd/grid.tsx
Deleted grid layout CSS and presentational grid wrapper component.
client/src/app/pages/migration-targets/components/dnd/item.tsx Deleted DnD item wrapper component that rendered a TargetCard by ID.
client/src/app/pages/migration-targets/components/dnd/sortable-item.tsx Deleted sortable item DnD component that managed drag logic by target ID.
client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx Added new sortable DnD component that manages drag logic with full Target objects.
client/src/app/pages/migration-targets/components/dnd/target-item.css Added new CSS for draggable handle cursor styles (grab/grabbing).
client/src/app/pages/migration-targets/components/dnd/target-item.tsx Added new presentational component for rendering a draggable target item with handle and actions.
client/src/app/pages/migration-targets/migration-targets.css Deleted CSS file for droppable border color overrides.
client/src/app/pages/migration-targets/migration-targets.tsx Refactored DnD logic: tracks active target object, uses new sortable/item components, updates layout.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MigrationTargets
    participant SortableTargetItem
    participant TargetItem
    participant TargetCard

    User->>MigrationTargets: Drag target item
    MigrationTargets->>SortableTargetItem: Render with target data
    SortableTargetItem->>TargetItem: Render with drag handle and props
    TargetItem->>TargetCard: Render target info, actions, and drag handle
    User-->>MigrationTargets: Drop target item
    MigrationTargets->>SortableTargetItem: Update position/order
Loading

Poem

A bunny hopped through code so neat,
Drag handles moved beneath its feet.
Out with the old, in with the new,
Type-safe targets in tidy view.
A gallery shines, the overlay’s bright—
DnD magic, just right!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-27T15_51_15_721Z-debug-0.log


📜 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 7c09c8e and f5b7b80.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • client/package.json (1 hunks)
  • client/src/app/components/target-card/target-card.css (0 hunks)
  • client/src/app/components/target-card/target-card.tsx (4 hunks)
  • client/src/app/pages/migration-targets/components/dnd/grid.css (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/grid.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/item.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/sortable-item.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx (1 hunks)
  • client/src/app/pages/migration-targets/components/dnd/target-item.css (1 hunks)
  • client/src/app/pages/migration-targets/components/dnd/target-item.tsx (1 hunks)
  • client/src/app/pages/migration-targets/migration-targets.css (0 hunks)
  • client/src/app/pages/migration-targets/migration-targets.tsx (9 hunks)
💤 Files with no reviewable changes (6)
  • client/src/app/components/target-card/target-card.css
  • client/src/app/pages/migration-targets/migration-targets.css
  • client/src/app/pages/migration-targets/components/dnd/grid.css
  • client/src/app/pages/migration-targets/components/dnd/grid.tsx
  • client/src/app/pages/migration-targets/components/dnd/item.tsx
  • client/src/app/pages/migration-targets/components/dnd/sortable-item.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • client/package.json
  • client/src/app/pages/migration-targets/components/dnd/target-item.css
  • client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx
  • client/src/app/pages/migration-targets/components/dnd/target-item.tsx
  • client/src/app/pages/migration-targets/migration-targets.tsx
  • client/src/app/components/target-card/target-card.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

Copy link

@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: 0

🧹 Nitpick comments (3)
client/src/app/pages/migration-targets/components/dnd/target-item.tsx (1)

46-46: Consider updating displayName for clarity.

The displayName is set to "Item" which might be confusing since the component is named TargetItem. Consider updating it to match the component name for better debugging experience.

-TargetItem.displayName = "Item";
+TargetItem.displayName = "TargetItem";
client/src/app/pages/migration-targets/migration-targets.tsx (2)

272-272: Consider moving inline style to CSS for better maintainability.

The inline paddingBlockStart: 0 style could be moved to a CSS class for better maintainability and consistency with the rest of the codebase.

-      <PageSection style={{ paddingBlockStart: 0 }}>
+      <PageSection className="migration-targets-dnd-section">

Add to your CSS file:

.migration-targets-dnd-section {
  padding-block-start: 0;
}

286-290: Consider making the fixed height more flexible.

The explicit height: "410px" might cause layout issues if target card content varies significantly in size. Consider using a more flexible approach like minHeight or CSS classes.

-                  style={{ height: "410px" }}
+                  style={{ minHeight: "410px" }}

Or better yet, move to a CSS class:

-                  style={{ height: "410px" }}
+                  className="sortable-target-item"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c97dc56 and 0b4ac83.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • client/package.json (1 hunks)
  • client/src/app/components/target-card/target-card.css (0 hunks)
  • client/src/app/components/target-card/target-card.tsx (4 hunks)
  • client/src/app/pages/migration-targets/components/dnd/grid.css (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/grid.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/item.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/sortable-item.tsx (0 hunks)
  • client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx (1 hunks)
  • client/src/app/pages/migration-targets/components/dnd/target-item.css (1 hunks)
  • client/src/app/pages/migration-targets/components/dnd/target-item.tsx (1 hunks)
  • client/src/app/pages/migration-targets/migration-targets.css (0 hunks)
  • client/src/app/pages/migration-targets/migration-targets.tsx (9 hunks)
💤 Files with no reviewable changes (6)
  • client/src/app/pages/migration-targets/migration-targets.css
  • client/src/app/components/target-card/target-card.css
  • client/src/app/pages/migration-targets/components/dnd/grid.tsx
  • client/src/app/pages/migration-targets/components/dnd/grid.css
  • client/src/app/pages/migration-targets/components/dnd/item.tsx
  • client/src/app/pages/migration-targets/components/dnd/sortable-item.tsx
🧰 Additional context used
🧬 Code Graph Analysis (3)
client/src/app/pages/migration-targets/components/dnd/target-item.tsx (2)
client/src/app/api/models.ts (1)
  • Target (485-495)
client/src/app/components/target-card/target-card.tsx (1)
  • TargetCard (54-216)
client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx (2)
client/src/app/api/models.ts (1)
  • Target (485-495)
client/src/app/pages/migration-targets/components/dnd/target-item.tsx (1)
  • TargetItem (17-44)
client/src/app/components/target-card/target-card.tsx (1)
client/src/app/components/KebabDropdown.tsx (1)
  • KebabDropdown (16-44)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: unit-test
  • GitHub Check: test-image-build (arm64)
  • GitHub Check: test-image-build (amd64)
  • GitHub Check: build-and-upload-for-global-ci
🔇 Additional comments (11)
client/src/app/pages/migration-targets/components/dnd/target-item.css (1)

1-8: Well-implemented drag cursor styles.

The CSS follows standard UX patterns for drag-and-drop interactions with clear cursor feedback. The .grabbable class naming is semantic and the hover/active states provide appropriate visual cues.

client/package.json (1)

24-24: Verify major version upgrade compatibility.

The upgrade from @dnd-kit/sortable v7 to v10 is a significant jump that likely introduces breaking changes. Ensure that all drag-and-drop functionality has been thoroughly tested with the new version and that the implementation correctly handles any API changes.

#!/bin/bash
# Description: Check for any potential issues with the @dnd-kit/sortable v10 upgrade
# Expected: Find all usages of @dnd-kit/sortable hooks and verify they align with v10 API

echo "=== Searching for @dnd-kit/sortable imports and usage ==="
rg -A 3 "@dnd-kit/sortable"

echo "=== Searching for useSortable hook usage ==="
rg -A 10 "useSortable"
client/src/app/pages/migration-targets/components/dnd/target-item.tsx (1)

1-44: Well-structured drag-and-drop component with good separation of concerns.

The implementation correctly uses forwardRef, properly handles drag-and-drop props, and provides good accessibility support with appropriate ARIA labels. The separation between drag functionality and target rendering is clean.

client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx (1)

1-47: Excellent implementation of sortable drag-and-drop wrapper.

The component correctly uses the useSortable hook from the upgraded @dnd-kit/sortable v10, properly handles transform and transition styling, and cleanly forwards all necessary props to the TargetItem component. The implementation follows the official documentation patterns.

client/src/app/components/target-card/target-card.tsx (2)

43-43: Excellent refactoring to externalize drag handle.

The change from internal drag handle management to accepting an external dndSortHandle prop improves separation of concerns and makes the component more reusable. This allows parent components to control the drag handle appearance and behavior while keeping the target card focused on its core presentation logic.

Also applies to: 61-61, 150-150


152-164: Clean reordering of conditional rendering logic.

The reordering of the custom target label and dropdown rendering logic maintains the same functionality while improving code readability. The logic flow is now more intuitive.

client/src/app/pages/migration-targets/migration-targets.tsx (5)

73-73: Excellent improvement to drag state management.

Storing the full Target object instead of just the ID improves type safety and eliminates the need for subsequent lookups. This change enhances the drag-and-drop implementation.


178-186: Clean and correct drag event handler implementation.

The updated handlers properly implement the new approach of storing full Target objects. The null handling in handleDragStart is appropriate, and the simplified handleDragEnd aligns well with the new state management strategy.


284-284: Good use of PatternFly's Gallery component.

The replacement of the custom grid with PatternFly's Gallery component with responsive minWidths and hasGutter props aligns well with design system best practices.


302-302: Excellent improvement to drag overlay.

Using the full Target object in the drag overlay instead of just an ID provides much richer visual feedback during drag operations. This enhances the user experience significantly.


22-23: ```shell
#!/bin/bash

Check exports and definitions in component files

echo "===== SortableTargetItem Exports and Usage ====="
grep -n "export" client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx || true
grep -n "SortableTargetItem" client/src/app/pages/migration-targets/components/dnd/sortable-target-item.tsx || true

echo ""
echo "===== TargetItem Exports and Usage ====="
grep -n "export" client/src/app/pages/migration-targets/components/dnd/target-item.tsx || true
grep -n "TargetItem" client/src/app/pages/migration-targets/components/dnd/target-item.tsx || true


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@sjd78 sjd78 force-pushed the migration_targets_dnd branch from 160a509 to 7c09c8e Compare June 27, 2025 13:52
sjd78 added 5 commits June 27, 2025 11:49
Upgrade `@dnd-kit` and `@dnd-kit/sortable` to latest.

Refactor the migration-targets page and target card components.
Simplified the components for more streamlined use on the custom
migration targets page and on the analysis wizard target selection
step.  The migration-targets page layout updated to use `Gallery`
instead of the custom grid.

Signed-off-by: Scott J Dickerson <[email protected]>
Signed-off-by: Scott J Dickerson <[email protected]>
Signed-off-by: Scott J Dickerson <[email protected]>
@sjd78 sjd78 force-pushed the migration_targets_dnd branch from 7c09c8e to f5b7b80 Compare June 27, 2025 15:50
@sjd78 sjd78 merged commit 46ae818 into konveyor:main Jun 27, 2025
12 checks passed
@sjd78 sjd78 deleted the migration_targets_dnd branch June 27, 2025 19:51
sshveta pushed a commit to sshveta/tackle2-ui that referenced this pull request Oct 31, 2025
Upgrade `@dnd-kit` and `@dnd-kit/sortable` to latest.

Refactor the migration-targets page and target card components.
Simplified the components for more streamlined use on the custom
migration targets page and on the analysis wizard target selection step.
The migration-targets page layout updated to use `Gallery` instead of
the custom grid.

Signed-off-by: Scott J Dickerson <[email protected]>
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