question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove port with it's link and target port

See original GitHub issue

Hello! 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].

image

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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
renato-bohlercommented, Jun 10, 2020

Sweet, nice to hear 😄

(I don’t have the permission to close the issue, though)

1reaction
stanislav-grincommented, Jun 10, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found