1
0
Fork 0

fixes some graph data parsing issues, if format was not like it was e… (#7057)

* 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:07:27 +02:00 committed by Michael Hackstein
parent 10dc287eb3
commit 55b0ad7c96
3 changed files with 34 additions and 14 deletions

View File

@ -1,6 +1,10 @@
devel
-----
* 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
are used during the startup process

View File

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

View File

@ -2495,8 +2495,17 @@
// check if result could be displayed as graph
// 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 totala = 0;
@ -2739,7 +2748,7 @@
var headers = {}; // quick lookup cache
var pos = 0;
_.each(data.original, function (obj) {
if (first === true) {
if (first === true && obj) {
tableDescription.titles = Object.keys(obj);
tableDescription.titles.forEach(function (t) {
headers[String(t)] = pos++;