kevoree / kevoree-web-editor

Kevoree model editor
http://editor.kevoree.org
6 stars 2 forks source link

Editor refreshes after docker java/kevoree nodes creation/deletion #67

Open tdalianis opened 7 years ago

tdalianis commented 7 years ago

Hi,

I have developed a project that creates and deletes docker java/kevoree containers. The nodes are registered and unregistered from the "master" node normally but i have some issues with the editor.

a. The editor is refreshed upon every registration of a new node but every time the editor is refreshed then everything (nodes, channels etc ) are gathered together again in the same position, so I have to move them again in order to have a better view. b. There seems to be a delay depicting all the nodes, ex. Initially I start the master node. If I have three more nodes to add (processor_1, processor_2, processor_3), when processor_1 is added, the first refresh depicts only the master node, when processor_2 is added, the editor refreshes and depicts the master node, and processor_1 but not processor_2 and the same thing continues. c. The editor is not refreshed when a docker container is deleted and its kevoree node is unregistered, so the editor keeps presenting that node like it is still active.

Any ideas why this is happening?

maxleiko commented 7 years ago

a. Instances coordinates are saved in the model. When you change something in the editor (ie. the location of an instance), it just changes the local editor model. You need to push that model on your running system.

b. When you say "refresh", do you mean redrawn? Are you using the "Connect" button?

c. Did you specify on the master node that you wanted your disconnected nodes to be removed from the model using the onDisconnect kevscript parameter?

tdalianis commented 7 years ago

a. Actually I am not changing something in the local editor, the registration of new nodes happens programmatically on my running system and the editor is the one notified and redraws the model.

b. Yes the redraw happens while i am connected to the master node. I don't reload the model manually, this happens automatically every time a new node is created programmatically.

c. hmm no, i though that this is done automatically by the system, when the node is unregistered... can you point me to an example on how to use onDisconnect?

maxleiko commented 7 years ago

Example of onDisconnect usage:

// you have to add this to your current KevScript to tell that
// you want your group to remove the leaving nodes when they disconnect
set yourGrp.onDisconnect = 'remove {nodeName}'

Each time yourGrp will see a node disconnect from its server, it will create a KevScript based on the template given in onDisconnect.

My example will result in this KevScript:

remove theLeavingNode

And this KevScript will be directly executed by the WSGroup yourGrp, leading to an update of the model with the removal of the node.

NB: most standard libraries now have a description.
The onConnect & onDisconnect behavior are stated in the description :+1: (see)
remember that this is the WIP branch of the editor, if it's the first time you use it, you will have to go to the Settings and set https://kevoree.braindead.fr for the registry