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,7 +175,7 @@ function FoxxAdapter(nodes, edges, route, config) {
parseResult = function (result, callback) { parseResult = function (result, callback) {
var inserted = {}, var inserted = {},
first = result.nodes[0]; first = result.first;
first = absAdapter.insertNode(first); first = absAdapter.insertNode(first);
_.each(result.nodes, function(n) { _.each(result.nodes, function(n) {
n = absAdapter.insertNode(n); n = absAdapter.insertNode(n);

View File

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