Repository navigation
为渠道参数覆盖可视化规则提供拖拽排序支持 - #3166
为渠道参数覆盖可视化规则提供拖拽排序支持#3166
Conversation
…amOverrideEditorModal
WalkthroughAdded Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx (2)
2061-2067: Consider addingonDragLeaveto clean up visual state.If the user drags outside the list area before dropping, the drop indicator visual state (
dragOverOperationId) persists untildragEnd. AddingonDragLeaveon the container could cleardragOverOperationIdfor a cleaner UX, thoughonDragEnddoes reset state eventually.♻️ Optional: Add onDragLeave handler
You could add a container-level handler:
const handleOperationDragLeave = useCallback((event) => { // Only reset if leaving the container entirely if (!event.currentTarget.contains(event.relatedTarget)) { setDragOverOperationId(''); } }, []);And apply it to the operations list container div.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx` around lines 2061 - 2067, Add an onDragLeave handler on the operations list container to clear the persistent drop indicator when the user drags out of the list; implement a handleOperationDragLeave (useCallback) that checks whether the pointer left the container (e.g., using event.currentTarget.contains(event.relatedTarget)) and calls setDragOverOperationId('') only when leaving entirely, then attach onDragLeave={handleOperationDragLeave} to the same container that already has onDragOver/onDrop/onDragEnd and keep resetOperationDragState for dragend.
2050-2076: Consider adding keyboard-based reordering for accessibility.The HTML5 drag-and-drop API has limited screen reader support. While the items are keyboard-navigable, users who cannot use a mouse cannot reorder operations via keyboard. Consider adding keyboard shortcuts (e.g., Ctrl+Up/Down) or move up/down buttons as an alternative reordering mechanism in a future iteration.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx` around lines 2050 - 2076, Add keyboard-based reordering for accessibility by augmenting the operation item UI: detect keyboard commands (e.g., Ctrl+ArrowUp / Ctrl+ArrowDown) in the onKeyDown handler for the operation element and call new helper functions (e.g., moveOperationUp(operation.id) and moveOperationDown(operation.id)) that update the operations array order and preserve selection; alternatively expose visible Move Up / Move Down buttons next to each item that call those same helpers. Ensure these helpers integrate with existing drag handlers (handleOperationDragStart, handleOperationDragOver, handleOperationDrop, resetOperationDragState) and update any parent state so the UI reflects the new order and focused/selected item (setSelectedOperationId) for screen-reader and keyboard users.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx`:
- Around line 2061-2067: Add an onDragLeave handler on the operations list
container to clear the persistent drop indicator when the user drags out of the
list; implement a handleOperationDragLeave (useCallback) that checks whether the
pointer left the container (e.g., using
event.currentTarget.contains(event.relatedTarget)) and calls
setDragOverOperationId('') only when leaving entirely, then attach
onDragLeave={handleOperationDragLeave} to the same container that already has
onDragOver/onDrop/onDragEnd and keep resetOperationDragState for dragend.
- Around line 2050-2076: Add keyboard-based reordering for accessibility by
augmenting the operation item UI: detect keyboard commands (e.g., Ctrl+ArrowUp /
Ctrl+ArrowDown) in the onKeyDown handler for the operation element and call new
helper functions (e.g., moveOperationUp(operation.id) and
moveOperationDown(operation.id)) that update the operations array order and
preserve selection; alternatively expose visible Move Up / Move Down buttons
next to each item that call those same helpers. Ensure these helpers integrate
with existing drag handlers (handleOperationDragStart, handleOperationDragOver,
handleOperationDrop, resetOperationDragState) and update any parent state so the
UI reflects the new order and focused/selected item (setSelectedOperationId) for
screen-reader and keyboard users.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f286f0cb-3483-4040-983a-de24f1d1ebd9
📒 Files selected for processing (2)
.gitignoreweb/src/components/table/channels/modals/ParamOverrideEditorModal.jsx
There was a problem hiding this comment.
Pull request overview
该 PR 为“渠道参数覆盖可视化规则”编辑器增加拖拽排序能力,方便用户在可视化模式下调整规则执行顺序,从而更直观地控制参数覆盖链路。
Changes:
- 在
ParamOverrideEditorModal的规则导航列表中加入 HTML5 Drag & Drop 交互与视觉反馈(拖拽中/可放置位置高亮)。 - 新增
reorderOperations以在前端状态中重排规则数组。 .gitignore增加忽略本地历史目录.history。
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/src/components/table/channels/modals/ParamOverrideEditorModal.jsx | 增加规则列表拖拽排序逻辑、状态管理与 UI 提示 |
| .gitignore | 忽略 .history 本地文件/目录 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| event.preventDefault(); | ||
| if (!draggedOperationId || draggedOperationId === operationId) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
handleOperationDragOver calls event.preventDefault() before confirming an internal operation drag is in progress. This makes every item a valid drop target even for external drags (e.g., dragging selected text/files), potentially blocking default browser/app behavior. Consider only calling preventDefault (and setting dropEffect) when draggedOperationId is set and differs from operationId, or when dataTransfer contains the expected internal type.
| event.preventDefault(); | |
| if (!draggedOperationId || draggedOperationId === operationId) { | |
| return; | |
| } | |
| if (!draggedOperationId || draggedOperationId === operationId) { | |
| return; | |
| } | |
| event.preventDefault(); |
为渠道参数覆盖可视化规则提供拖拽排序支持
为渠道参数覆盖可视化规则提供拖拽排序支持
为渠道参数覆盖可视化规则提供拖拽排序支持
Summary by CodeRabbit
New Features
Chores