Remove port with it's link and target port
See original GitHub issueHello! First of all, thanks for this awesome project!
I ran into issue when trying to remove port with its link and related (target) port. I’m successed only with removing source port and link, but not target port.
Basically I’m doing some kind of UML editor, but for custom solution (will show it later when it’s ready). Here is how it looks now. Pay attention to the node named Address
, port contacts
and target node Contacts
with target port Address[contacts]
.
When I select needed port, I click delete and run next logic:
const port = node.getPort(portId)
const links = port.getLinks()
const link = links[Object.keys(links)[0]] // didn't find another way to get port's link, its always only single one, so I just take first item from the links object, it works. Any ideas much appreciated
const targetPort = link.getTargetPort() // get target port - `Address[contacts]`
const targetNode = model.getNode(targetNodeId) // node with title 'Contacts'
targetNode.removePort(targetPort) // remove target port in target node
targetPort.remove() // another try to remove
link.remove()
node.removePort(port)
engine.repaintCanvas()
But the only items that removed - source port (contacts
) and link. Target port Address[contacts]
remains. I need this to remove also.
Any help please?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
network port broadcast-domain remove-ports
Remove ports from a layer 2 broadcast domain. Availability: This command is available to cluster administrators at the admin privilege level ...
Read more >Removing a port from a host - IBM
Use the host_remove_port command to remove a port from a host. ... There is currently no connection to the target system. TARGET_PORT_BAD_ADDRESS.
Read more >How to divert the traffic to targer servers without port number in ...
You need to define a listener for LB to listen on a port and forward traffic to target on the desired group. specify...
Read more >Remove port number from instance value - Google Groups
This sets "?target=x.x.x.x" in the scrape URL; it is normally used when scraping blackbox_exporter or snmp_exporter, where the exporter is on one host...
Read more >Using Kubernetes Port, TargetPort, and NodePort
Port configurations for Kubernetes Services · Port exposes the Kubernetes service on the specified port within the cluster. · TargetPort is the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sweet, nice to hear 😄
(I don’t have the permission to close the issue, though)
I managed to solve both problems. For anyone who may have similar problem, my mistake was to wrap my custom NodeWidget in redux’s
connect
decorator (in order to provide actions for removing/editing/creating ports). After I changed this so that the action was provided via serialize in node model, and using the trick above (with setTimout) everything started to work like a charm.Thanks a lot for your help, @renato-bohler!
The issue can be closed if needed.
UPD setTimout trick may not be required, but for someone it may be helpful