Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload default diagrams when adding a new module #625

Open
angelostiffy opened this issue Dec 29, 2022 · 2 comments
Open

Reload default diagrams when adding a new module #625

angelostiffy opened this issue Dec 29, 2022 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@angelostiffy
Copy link

Hi Jero

I'm trying to implement to reload the default loaded diagrams that I setup whenever a user wants to add a new module.
Below is the picture showing the default diagrams loaded.
image

Here is when a user adds a new module.
image

And this what it looks after adding a new module.
image

I'm looking for implementations (if you have any) that can reload the default diagrams whenever a user adds a new module.

Thank you!

@jerosoler jerosoler self-assigned this Dec 29, 2022
@jerosoler jerosoler added the question Further information is requested label Dec 29, 2022
@jerosoler
Copy link
Owner

I could listen to the moduleCreated event and add the content to the module.

And add content to module:

editor.drawflow.drawflow[ModuleName] =  { "data": { YOUR NODES } }

@CelticRugger
Copy link

As jero has pointed out but have implemented exactly this

update the JSON with the additional module data so its ready for parsing but you have to do some house keeping first. So

  1. editor.clear()
  2. remove module links (UI) - remove UI tabs (important because of later reloading with fresh data)
    then i have something like this with the new modified json
    json = JSON.parse(json);
    for (var module in json.drawflow) {
    editor.addModule(module);
    addModuleLink(module); /* wrapper function to create the UI tab and its properties - study the main flow tab and how that is set up in jero's code example and mimic it but with new tab module names with the same property*/
    }

then editor.import which will then map all the draw data to the UI module tabs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants