1
0
Fork 0

GraphViewer: Now editing of Nodes/Edges also works (yet missing: Checks for key values, add additional key/value pairs

This commit is contained in:
Michael Hackstein 2013-04-09 11:22:21 +02:00
parent 42e7e37aaa
commit 24d452c7d0
3 changed files with 31 additions and 12 deletions

View File

@ -380,7 +380,7 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w
contentType: "application/json",
processData: false,
success: function(data) {
edgeToPatch = $.extend(edgeToPatch, patchData);
edgeToPatch._data = $.extend(edgeToPatch._data, patchData);
callback();
},
error: function(data) {

View File

@ -58,14 +58,32 @@
beforeEach(function () {
nodes = [{
_id: 1,
name: "Alice"
_rev: 1,
_key: 1,
_data: {
_id: 1,
name: "Alice"
}
},{
_id: 2
_id: 2,
_rev: 2,
_key: 2,
_data: {
_id: 2
}
}];
edges = [{
source: nodes[0],
target: nodes[1],
label: "oldLabel"
_data: {
_id: 12,
_rev: 12,
_key: 12,
_from: 1,
_to: 2,
label: "oldLabel"
}
}];
adapter = mocks.adapter;
layouter = mocks.layouter;
@ -192,9 +210,7 @@
helper.simulateMouseEvent("click", "control_node_edit_submit");
expect(adapter.patchNode).toHaveBeenCalledWith(
{ _id: 1,
name: "Alice"
},
nodes[0],
{ _id: "1",
name: "Bob"
},
@ -216,8 +232,11 @@
expect(adapter.patchEdge).toHaveBeenCalledWith(
edges[0],
{
source: nodes[0],
target: nodes[1],
_id: "12",
_rev: "12",
_key: "12",
_from: "1",
_to: "2",
label: "newLabel"
},
jasmine.any(Function));

View File

@ -85,7 +85,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
modalDialogHelper.createModalEditDialog(
"Edit Node " + n._id,
"control_node_edit_",
n,
n._data,
function(newData) {
dispatcher.events.PATCHNODE(n, newData, function() {
$("#control_node_edit_modal").modal('hide');
@ -95,9 +95,9 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
},
edgeCallback = function(e) {
modalDialogHelper.createModalEditDialog(
"Edit Edge " + e.source._id + "->" + e.target._id,
"Edit Edge " + e._data._from + "->" + e._data._to,
"control_edge_edit_",
e,
e._data,
function(newData) {
dispatcher.events.PATCHEDGE(e, newData, function() {
$("#control_edge_edit_modal").modal('hide');