Skip to content

Conversation

benloh
Copy link
Collaborator

@benloh benloh commented Jan 29, 2019

When someone begins editing an edge, the edge is now locked on the server and new users are prevented from editing the edge. If they select a edge and click "Edit Edge" they will get a message about the edge being locked.

To Test:

  1. Log in on one browser.

  2. Click on a node with edges to select it.

  3. Click on an edge.

  4. Click on the "Edit Edge" button

  5. Log in on a second browser.

  6. Click on the same node on the other browser and select the same edge.

  7. Click on the "Edit Edge" button.

  8. You should get a message: "This edge is currently being edited by someone else, please try again later."

  9. Finish editing on the first browser.

  10. Try editing from the second browser and it should work.

NOTES

  • The lock message can be changed via the template system.
  • There's an issue with EDGE_UPDATES that probably needs to be addressed later. EDGE_UPDATES messages can take one of two forms depending on whether it's a update of an existing edge or it's the addition of a new edge due to D3's data manipulation. It's relatively easy to handle the different forms, but for future proofing, we might want to make sure either method ends up with the same data format. From NodeSelector comments:
           EDGE_UPDATES are triggered under two circumnstances:
           a. When an existing edge is updated
           b. When a new edge is created
           The call sequence is:
           1. EdgeEditor.Submit calls datastore.DB_UPDATE
           2. datastore.DB_UPDATE calls server.SRV_DBUPDATE
           3. server.SRV_DBUPDATE broadcasts EDGE_UPDATE
              At this point, edge.source and edge.target are broadcast as Numbers.
           4. EDGE_UPDATE is handled by:
              a. nc-logic.handleMessage("EDGE_UPDATE"), and
              b. NodeSelector.handlemMessage("EDGE_UPDATE") (this method)
           5. nc-logic.handleMessage("EDGE_UPDATE") processes the data and
              actually adds a new edge or updates the existing edge in D3DATA.
              *** The key is that there is a difference in how it's handled.
              For updates, the edge is simply updated.
              But for new edges, the edge object is updated and then pushed to D3DATA.
           6. When the edge object is pushed to D3DATA, D3 processes it and converts
              edge.source and edge.target into node objects.
              *** By the time NodeSelector receives the edge data, edge.source and
              edge.target are node objects, not numbers.
           So this method needs to account for the fact that edge.source and edge.target might be
           received as either numbers or objects.

* commit '2554384120687f63033afdb1c73493cb08a8a644':
  dev-bl/select-node-onblur: When AutoComplete field loses focus, if the current value matches a node, select it.
@benloh benloh requested review from jdanish and kalanicraig January 29, 2019 18:28
@benloh benloh merged commit 3bb7641 into dev Jan 31, 2019
@benloh benloh deleted the dev-bl/edit-edge-lock branch January 31, 2019 18:32
@benloh
Copy link
Collaborator Author

benloh commented Jan 31, 2019

Kalani confirmed fixed.

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

Successfully merging this pull request may close these issues.

1 participant