1
0
Fork 0

Bug fix 3.4/ui graph parsing (#7063)

* fixes some graph data parsing issues, if format was not like it was expected

* changelog
This commit is contained in:
Heiko 2018-10-25 16:08:24 +02:00 committed by Michael Hackstein
parent e1480cfd11
commit bc578b47da
3 changed files with 33 additions and 14 deletions

View File

@ -1,6 +1,9 @@
v3.4.0-rc.4 (XXXX-XX-XX) v3.4.0-rc.4 (XXXX-XX-XX)
------------------------ ------------------------
* fixes some graph data parsing issues in the ui, e.g. cleaning up duplicate
edges inside the graph viewer.
* in a cluster environment, the arangod process now exits if wrong credentials * in a cluster environment, the arangod process now exits if wrong credentials
are used during the startup process. are used during the startup process.

View File

@ -149,7 +149,6 @@
self.renderGraph(data); self.renderGraph(data);
}, },
error: function (e) { error: function (e) {
console.log(e);
arangoHelper.arangoError('Graph', 'Could not load full graph.'); arangoHelper.arangoError('Graph', 'Could not load full graph.');
} }
}); });
@ -534,17 +533,22 @@
*/ */
}); });
} else if (type === 'array') { } else if (type === 'array') {
var edgeObj = {};
_.each(data, function (edge) { _.each(data, function (edge) {
if (edge) {
vertices[edge._from] = null; vertices[edge._from] = null;
vertices[edge._to] = null; vertices[edge._to] = null;
returnObj.edges.push({ if (edge._id) {
edgeObj[edge._id] = {
id: edge._id, id: edge._id,
source: edge._from, source: edge._from,
// label: edge._key,
color: '#cccccc', color: '#cccccc',
target: edge._to target: edge._to
}); };
}
}
}); });
_.each(vertices, function (val, key) { _.each(vertices, function (val, key) {
@ -557,6 +561,9 @@
y: Math.random() y: Math.random()
}); });
}); });
_.each(edgeObj, function (edge) {
returnObj.edges.push(edge);
});
} }
return returnObj; return returnObj;

View File

@ -2495,8 +2495,17 @@
// check if result could be displayed as graph // check if result could be displayed as graph
// case a) result has keys named vertices and edges // case a) result has keys named vertices and edges
if (result[0]) {
if (result[0].vertices && result[0].edges) { var index = 0;
for (var i = 0; i < result.length; i++) {
if (result[i]) {
index = i;
break;
}
}
if (result[index]) {
if (result[index].vertices && result[index].edges) {
var hitsa = 0; var hitsa = 0;
var totala = 0; var totala = 0;
@ -2739,7 +2748,7 @@
var headers = {}; // quick lookup cache var headers = {}; // quick lookup cache
var pos = 0; var pos = 0;
_.each(data.original, function (obj) { _.each(data.original, function (obj) {
if (first === true) { if (first === true && obj) {
tableDescription.titles = Object.keys(obj); tableDescription.titles = Object.keys(obj);
tableDescription.titles.forEach(function (t) { tableDescription.titles.forEach(function (t) {
headers[String(t)] = pos++; headers[String(t)] = pos++;