mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Now editing of Nodes/Edges also works (yet missing: Checks for key values, add additional key/value pairs
This commit is contained in:
parent
42e7e37aaa
commit
24d452c7d0
|
@ -380,7 +380,7 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
edgeToPatch = $.extend(edgeToPatch, patchData);
|
edgeToPatch._data = $.extend(edgeToPatch._data, patchData);
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
|
|
@ -58,14 +58,32 @@
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
nodes = [{
|
nodes = [{
|
||||||
_id: 1,
|
_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 = [{
|
edges = [{
|
||||||
source: nodes[0],
|
source: nodes[0],
|
||||||
target: nodes[1],
|
target: nodes[1],
|
||||||
label: "oldLabel"
|
_data: {
|
||||||
|
_id: 12,
|
||||||
|
_rev: 12,
|
||||||
|
_key: 12,
|
||||||
|
_from: 1,
|
||||||
|
_to: 2,
|
||||||
|
label: "oldLabel"
|
||||||
|
}
|
||||||
|
|
||||||
}];
|
}];
|
||||||
adapter = mocks.adapter;
|
adapter = mocks.adapter;
|
||||||
layouter = mocks.layouter;
|
layouter = mocks.layouter;
|
||||||
|
@ -192,9 +210,7 @@
|
||||||
|
|
||||||
helper.simulateMouseEvent("click", "control_node_edit_submit");
|
helper.simulateMouseEvent("click", "control_node_edit_submit");
|
||||||
expect(adapter.patchNode).toHaveBeenCalledWith(
|
expect(adapter.patchNode).toHaveBeenCalledWith(
|
||||||
{ _id: 1,
|
nodes[0],
|
||||||
name: "Alice"
|
|
||||||
},
|
|
||||||
{ _id: "1",
|
{ _id: "1",
|
||||||
name: "Bob"
|
name: "Bob"
|
||||||
},
|
},
|
||||||
|
@ -216,8 +232,11 @@
|
||||||
expect(adapter.patchEdge).toHaveBeenCalledWith(
|
expect(adapter.patchEdge).toHaveBeenCalledWith(
|
||||||
edges[0],
|
edges[0],
|
||||||
{
|
{
|
||||||
source: nodes[0],
|
_id: "12",
|
||||||
target: nodes[1],
|
_rev: "12",
|
||||||
|
_key: "12",
|
||||||
|
_from: "1",
|
||||||
|
_to: "2",
|
||||||
label: "newLabel"
|
label: "newLabel"
|
||||||
},
|
},
|
||||||
jasmine.any(Function));
|
jasmine.any(Function));
|
||||||
|
|
|
@ -85,7 +85,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
modalDialogHelper.createModalEditDialog(
|
modalDialogHelper.createModalEditDialog(
|
||||||
"Edit Node " + n._id,
|
"Edit Node " + n._id,
|
||||||
"control_node_edit_",
|
"control_node_edit_",
|
||||||
n,
|
n._data,
|
||||||
function(newData) {
|
function(newData) {
|
||||||
dispatcher.events.PATCHNODE(n, newData, function() {
|
dispatcher.events.PATCHNODE(n, newData, function() {
|
||||||
$("#control_node_edit_modal").modal('hide');
|
$("#control_node_edit_modal").modal('hide');
|
||||||
|
@ -95,9 +95,9 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig)
|
||||||
},
|
},
|
||||||
edgeCallback = function(e) {
|
edgeCallback = function(e) {
|
||||||
modalDialogHelper.createModalEditDialog(
|
modalDialogHelper.createModalEditDialog(
|
||||||
"Edit Edge " + e.source._id + "->" + e.target._id,
|
"Edit Edge " + e._data._from + "->" + e._data._to,
|
||||||
"control_edge_edit_",
|
"control_edge_edit_",
|
||||||
e,
|
e._data,
|
||||||
function(newData) {
|
function(newData) {
|
||||||
dispatcher.events.PATCHEDGE(e, newData, function() {
|
dispatcher.events.PATCHEDGE(e, newData, function() {
|
||||||
$("#control_edge_edit_modal").modal('hide');
|
$("#control_edge_edit_modal").modal('hide');
|
||||||
|
|
Loading…
Reference in New Issue