10000 fixes some graph data parsing issues, if format was not like it was e… · botnick/arangodb@55b0ad7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 55b0ad7

Browse files
hkernbachmchacki
authored andcommitted
fixes some graph data parsing issues, if format was not like it was e… (arangodb#7057)
* fixes some graph data parsing issues, if format was not like it was expected * changelog
1 parent 10dc287 commit 55b0ad7

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
devel
22
-----
33

4+
5+
* fixes some graph data parsing issues in the ui, e.g. cleaning up duplicate
6+
edges inside the graph viewer.
7+
48
* in a cluster environment, the arangod process now exits if wrong credentials
59
are used during the startup process
610

js/apps/system/_admin/aardvark/APP/frontend/js/views/graphViewer.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
self.renderGraph(data);
150150
},
151151
error: function (e) {
152-
console.log(e);
153152
arangoHelper.arangoError('Graph', 'Could not load full graph.');
154153
}
155154
});
@@ -534,17 +533,22 @@
534533
*/
535534
});
536535
} else if (type === 'array') {
536+
var edgeObj = {};
537+
537538
_.each(data, function (edge) {
538-
vertices[edge._from] = null;
539-
vertices[edge._to] = null;
540-
541-
returnObj.edges.push({
542-
id: edge._id,
543-
source: edge._from,
544-
// label: edge._key,
545-
color: '#cccccc',
546-
target: edge._to
547-
});
539+
if (edge) {
540+
vertices[edge._from] = null;
541+
vertices[edge._to] = null;
542+
543+
if (edge._id) {
544+
edgeObj[edge._id] = {
545+
id: edge._id,
546+
source: edge._from,
547+
color: '#cccccc',
548+
target: edge._to
549+
};
550+
}
551+
}
548552
});
549553

550554
_.each(vertices, function (val, key) {
@@ -557,6 +561,9 @@
557561
y: Math.random()
558562
});
559563
});
564+
_.each(edgeObj, function (edge) {
565+
returnObj.edges.push(edge);
566+
});
560567
}
561568

562569
return returnObj;

js/apps/system/_admin/aardvark/APP/frontend/js/views/queryView.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,8 +2495,17 @@
24952495

24962496
// check if result could be displayed as graph
24972497
// case a) result has keys named vertices and edges
2498-
if (result[0]) {
2499-
if (result[0].vertices && result[0].edges) {
2498+
2499+
var index = 0;
2500+
for (var i = 0; i < result.length; i++) {
2501+
if (result[i]) {
2502+
index = i;
2503+
break;
2504+
}
2505+
}
2506+
2507+
if (result[index]) {
2508+
if (result[index].vertices && result[index].edges) {
25002509
var hitsa = 0;
25012510
var totala = 0;
25022511

@@ -2739,7 +2748,7 @@
27392748
var headers = {}; // quick lookup cache
27402749
var pos = 0;
27412750
_.each(data.original, function (obj) {
2742-
if (first === true) {
2751+
if (first === true && obj) {
27432752
tableDescription.titles = Object.keys(obj);
27442753
tableDescription.titles.forEach(function (t) {
27452754
headers[String(t)] = pos++;

0 commit comments

Comments
 (0)
0