Feat delete#96
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 42 minutes and 27 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated the Cytoscape network widget's JavaScript to add edge deletion functionality via right-click or Ctrl+Click. Introduced a Changes
Sequence DiagramsequenceDiagram
participant User
participant Cytoscape as Cytoscape<br/>(Frontend)
participant Shiny as Shiny<br/>(Backend)
alt Right-Click or Ctrl+Click
User->>Cytoscape: cxttap event on edge
Cytoscape->>Cytoscape: deleteEdge(edge)
Cytoscape->>Shiny: Send input event<br/>(edge_deleted)
Shiny->>Shiny: Process deletion event
Cytoscape->>Cytoscape: Remove edge from graph
else Plain Click
User->>Cytoscape: tap event on edge
Cytoscape->>Shiny: Send input event<br/>(edge_clicked)
Cytoscape->>User: Open evidence link
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@inst/htmlwidgets/cytoscapeNetwork.js`:
- Around line 459-462: The delete-edge interaction path currently calls
deleteEdge(edge) and returns without updating the legend; add a call to
buildLegend() immediately after deleteEdge(edge) (before the return) so the
legend is rebuilt from the updated cy.edges() when an edge is removed (same
branch handling evt.type === "cxttap" or evt.originalEvent.ctrlKey). Ensure you
reference the existing deleteEdge and buildLegend functions so the legend
refresh happens as part of the same interaction flow.
- Around line 454-461: The current combined event handler (cy.on("cxttap tap",
"edge", ...)) returns early for edges with edge.data("edge_type") ===
"ptm_attachment", preventing the delete branch from ever running; remove that
early return and instead only skip PTM edges in the evidence-link-specific code
path so ptm_attachment edges can still be deleted via the Ctrl+Click/right-click
branch (keep references to the existing cy.on handler and deleteEdge(edge) call
and move the ptm_attachment check into the evidence-link/evidence-link-handling
block).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1452d959-8410-475d-871e-1ea19cd48597
📒 Files selected for processing (1)
inst/htmlwidgets/cytoscapeNetwork.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #96 +/- ##
=======================================
Coverage 76.79% 76.79%
=======================================
Files 8 8
Lines 1030 1030
=======================================
Hits 791 791
Misses 239 239 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation and Context
The PR adds interactive edge deletion functionality to the Cytoscape network visualization widget. Users can now remove edges (connections between proteins) directly from the network by right-clicking or using Ctrl+Click, enabling dynamic network refinement and exploration. The feature maintains backward compatibility by keeping plain left-click behavior for opening evidence links.
Solution Summary
The implementation introduces a
deleteEdge()helper function in the JavaScript widget that removes edges from the graph and notifies the R/Shiny server of deletions. The event handler logic was refactored to support both deletion (right-click/Ctrl+Click) and navigation (plain click) actions on edges, with the "prevent default" behavior removed as indicated in the commit message.Detailed Changes
deleteEdge(edge)helper function that:${el.id}_edge_deletedcontaining the deleted edge'ssource,target, andinteractionproperties when Shiny is availabletaphandler to combined"cxttap tap"handler:deleteEdge()${el.id}_edge_clickedeventTesting
No new unit tests have been added or modified to verify the edge deletion functionality. The existing test file
tests/testthat/test-utils_cytoscapeNetwork.Rdoes not include tests for the JavaScript widget's interactive features or the new deletion capability.Coding Guidelines
The implementation adheres to the existing code standards: