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.

Is there a way to rewrite "Connection" rules?

See original GitHub issue

Hi,

I would like to make specific Connection rules. For example, node A can only connect to Node B, and if it wants to connect to Node C, the state of Connection should be isInDanger.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
LukasLoefflercommented, May 20, 2022

Congrats that you solved it by yourself! Just beeing nitpicky here: You could use the array.some() method instead the array.forEach() loop. The array.some() method checks if the provided statement matches at least once on one of the elements in the array.

let flag = !nodesOnEditor.some((val)=>nodename == "myNodeName" && val.name == "myNodeName"))

This makes the code more readable and consice (at least in my opinion)

1reaction
Halinencommented, May 20, 2022

I have solved it 😀

checkNodeCount(nodename) {
      let nodesOnEiditor = toRaw(this.$refs.editor.nodes)
      let flag = true
      nodesOnEiditor.forEach((val)=>{
        if(nodename == "myNodeName" && val.name == "myNodeName"){
          flag = false
          return
        }
      })
      return flag
}
 
this.viewPlugin.editor.events.beforeAddNode.addListener(this, (node) => {

      if(this.checkNodeCount(node.name)){
        if(node.name == "myNodeName" ){
          //contextMenu disabled 
          this.$refs.editor.contextMenu.items[0].submenu[2].disabled = true
        }
        return true
      }
      else{
        return false;
      }
    });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Rewrite Rules for the URL Rewrite Module
This walkthrough will guide you through how to create and test a set of rewrite rules for the URL Rewrite Module.
Read more >
How to Create NGINX Rewrite Rules
In this blog post, we discuss how to create NGINX rewrite rules (the same methods work for both NGINX Plus and the open...
Read more >
Web.config redirects with rewrite rules - https, www, and more
Rewrite rules can be either global (in the applicationHost.config file) or local (in the web.config file). There are several ways to add both ......
Read more >
How to Configure Re-Write Rules Outside the Web.config
Create the Pointer to the ReWrite Rules File. Connect to your site's web.config file. See How to Access Your Web.Config.
Read more >
mod_rewrite - Apache HTTP Server Version 2.4
The RewriteMap directive defines a Rewriting Map which can be used inside rule substitution strings by the mapping-functions to insert/substitute fields through ...
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