1
0
Fork 0

GraphViewer: Changed accepted format of FoxxAdapter from Array to Object where it is much easier to identify equal nodes on server side

This commit is contained in:
Michael Hackstein 2013-06-25 15:05:44 +02:00
parent 60b540b231
commit 7ea3a30f68
2 changed files with 18 additions and 6 deletions

View File

@ -175,8 +175,8 @@ function FoxxAdapter(nodes, edges, route, config) {
parseResult = function (result, callback) {
var inserted = {},
first = result.nodes[0];
first = absAdapter.insertNode(first);
first = result.first;
first = absAdapter.insertNode(first);
_.each(result.nodes, function(n) {
n = absAdapter.insertNode(n);
inserted[n._id] = n;

View File

@ -61,8 +61,14 @@
break;
case "GET":
req.success({
nodes: [{_id: 1}, {_id: 2}],
edges: [{_id: "1-2", _from: 1, _to: 2}]
first: {_id: 1},
nodes: {
"1": {_id: 1},
"2": {_id: 2}
},
edges: {
"1-2": {_id: "1-2", _from: 1, _to: 2}
}
});
break;
default:
@ -261,8 +267,14 @@
id = 1;
spyOn($, "ajax").andCallFake(function(req) {
req.success({
nodes: [{_id: 1}, {_id: 2}],
edges: [{_id: "1-2", _from: 1, _to: 2}]
first: {_id: 1},
nodes: {
"1": {_id: 1},
"2": {_id: 2}
},
edges: {
"1-2": {_id: "1-2", _from: 1, _to: 2}
}
});
});
var callback = function() {