8000 Pass through AQL query errors to UI graph viewer without turning the… · arangodb/arangodb@2b36eb7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b36eb7

Browse files
jsteemannKVS85
andauthored
Pass through AQL query errors to UI graph viewer without turning them into "Internal Server Error"s. (#11848)
* Pass through AQL query errors to UI graph viewer without turning them into "Internal Server Error"s. * Rebuild UI Co-authored-by: KVS85 <vadim@arangodb.com>
1 parent 8b11274 commit 2b36eb7

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
v3.4.11 (XXXX-XX-XX)
22
--------------------
33

4+
* Pass through AQL query errors to UI graph viewer without turning them into
5+
"Internal Server Error"s.
6+
47
* Fixed the creation of edges in the web UI, which did not work due to a
58
JavaScript error.
69

js/apps/system/_admin/aardvark/APP/aardvark.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ authRouter.get('/graph/:name', function (req, res) {
612612
};
613613

614614
var multipleIds;
615-
var startVertex; // will be "randomly" choosen if no start vertex is specified
615+
var startVertex; // will be "randomly" chosen if no start vertex is specified
616616

617617
if (config.nodeStart) {
618618
if (config.nodeStart.indexOf(' ') > -1) {
@@ -634,7 +634,7 @@ authRouter.get('/graph/:name', function (req, res) {
634634
var limit = 0;
635635
if (config.limit !== undefined) {
636636
if (config.limit.length > 0 && config.limit !== '0') {
637-
limit = config.limit;
637+
limit = parseInt(config.limit);
638638
}
639639
}
640640

@@ -657,18 +657,20 @@ authRouter.get('/graph/:name', function (req, res) {
657657
var aqlQuery;
658658
var aqlQueries = [];
659659

660+
let depth = parseInt(config.depth);
661+
660662
if (config.query) {
661663
aqlQuery = config.query;
662664
} else {
663665
if (multipleIds) {
664666
/* TODO: uncomment after #75 fix
665667
aqlQuery =
666668
'FOR x IN ' + JSON.stringify(multipleIds) + ' ' +
667-
'FOR v, e, p IN 1..' + (config.depth || '2') + ' ANY x GRAPH "' + name + '"';
669+
'FOR v, e, p IN 1..' + (depth || '2') + ' ANY x GRAPH "' + name + '"';
668670
*/
669671
_.each(multipleIds, function (nodeid) {
670672
aqlQuery =
671-
'FOR v, e, p IN 1..' + (config.depth || '2') + ' ANY "' + nodeid + '" GRAPH "' + name + '"';
673+
'FOR v, e, p IN 1..' + (depth || '2') + ' ANY ' + JSON.stringify(nodeid) + ' GRAPH ' + JSON.stringify(name);
672674
if (limit !== 0) {
673675
aqlQuery += ' LIMIT ' + limit;
674676
}
@@ -677,7 +679,7 @@ authRouter.get('/graph/:name', function (req, res) {
677679
});
678680
} else {
679681
aqlQuery =
680-
'FOR 8000 v, e, p IN 1..' + (config.depth || '2') + ' ANY "' + startVertex._id + '" GRAPH "' + name + '"';
682+
'FOR v, e, p IN 1..' + (depth || '2') + ' ANY ' + JSON.stringify(startVertex._id) + ' GRAPH ' + JSON.stringify(name);
681683
if (limit !== 0) {
682684
aqlQuery += ' LIMIT ' + limit;
683685
}
@@ -736,18 +738,23 @@ authRouter.get('/graph/:name', function (req, res) {
736738
}
737739
});
738740
} else {
739-
// get all nodes and edges which are connected to the given start node
740-
if (aqlQueries.length === 0) {
741-
cursor = AQL_EXECUTE(aqlQuery);
742-
} else {
743-
var x;
744-
cursor = AQL_EXECUTE(aqlQueries[0]);
745-
for (var k = 1; k < aqlQueries.length; k++) {
746-
x = AQL_EXECUTE(aqlQueries[k]);
747-
_.each(x.json, function (val) {
748-
cursor.json.push(val);
749-
});
741+
// get all nodes and edges which are connected to the given start node
742+
try {
743+
if (aqlQueries.length === 0) {
744+
cursor = AQL_EXECUTE(aqlQuery);
745+
} else {
746+
var x;
747+
cursor = AQL_EXECUTE(aqlQueries[0]);
748+
for (var k = 1; k < aqlQueries.length; k++) {
749+
x = AQL_EXECUTE(aqlQueries[k]);
750+
_.each(x.json, function (val) {
751+
cursor.json.push(val);
752+
});
753+
}
750754
}
755+
} catch (e) {
756+
const error = new ArangoError({errorNum: e.errorNum, errorMessage: e.errorMessage});
757+
res.throw(actions.arangoErrorToHttpCode(e.errorNum), error);
751758
}
752759
}
753760

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/html"><head><meta charset="utf-8"><title>ArangoDB Web Interface</title><meta name="description" content="ArangoDB Admin Web Interface"><meta name="author" content="Heiko Kernbach, Michael Hackstein"><meta name="viewport" content="width=device-width,initial-scale=1"><link href="css/style.css" rel="stylesheet"><link href="css/sass.css" rel="stylesheet"><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"><script src="config.js"></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img id="ArangoDBLogo" class="arangodbLogo" src="img/arangodb-edition-optimized.svg"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="graphSettingsContent" style="display: none"></div><div id="filterSelectDiv" style="display:none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1591291775320"></script><script src="app.js?version=1591291775320"></script><script src="templates.js?version=1591291775320"></script></body></html>
1+
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/html"><head><meta charset="utf-8"><title>ArangoDB Web Interface</title><meta name="description" content="ArangoDB Admin Web Interface"><meta name="author" content="Heiko Kernbach, Michael Hackstein"><meta name="viewport" content="width=device-width,initial-scale=1"><link href="css/style.css" rel="stylesheet"><link href="css/sass.css" rel="stylesheet"><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"><script src="config.js"></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img id="ArangoDBLogo" class="arangodbLogo" src="img/arangodb-edition-optimized.svg"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="graphSettingsContent" style="display: none"></div><div id="filterSelectDiv" style="dis 57BA play:none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1592246766823"></script><script src="app.js?version=1592246766823"></script><script src="templates.js?version=1592246766823"></script></body></html>
Binary file not shown.

0 commit comments

Comments
 (0)
0