mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
93cb87e7e7
|
@ -135,6 +135,12 @@ devel
|
|||
|
||||
* Agency bug fix for handling of empty json objects as values.
|
||||
|
||||
v3.0.11 (2016-XX-XX)
|
||||
--------------------
|
||||
|
||||
* fixed issue #2038
|
||||
|
||||
|
||||
v3.0.10 (XXXX-XX-XX)
|
||||
--------------------
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ TraversalBlock::TraversalBlock(ExecutionEngine* engine, TraversalNode const* ep)
|
|||
_opts = ep->options();
|
||||
|
||||
if (arangodb::ServerState::instance()->isCoordinator()) {
|
||||
auto node = static_cast<TraversalNode const*>(getPlanNode());
|
||||
#ifdef USE_ENTERPRISE
|
||||
auto node = static_cast<TraversalNode const*>(getPlanNode());
|
||||
if (node->isSmart()) {
|
||||
_traverser.reset(new arangodb::traverser::SmartGraphTraverser(
|
||||
_opts,
|
||||
|
|
|
@ -282,6 +282,23 @@ TraversalNode::TraversalNode(ExecutionPlan* plan, size_t id,
|
|||
}
|
||||
|
||||
auto addEdgeColl = [&](std::string const& n) -> void {
|
||||
if (_isSmart) {
|
||||
if (n.compare(0, 6, "_from_") == 0) {
|
||||
if (baseDirection == TRI_EDGE_ANY || baseDirection == TRI_EDGE_OUT) {
|
||||
_directions.emplace_back(TRI_EDGE_OUT);
|
||||
_edgeColls.emplace_back(std::make_unique<aql::Collection>(
|
||||
n, _vocbase, TRI_TRANSACTION_READ));
|
||||
}
|
||||
return;
|
||||
} else if (n.compare(0, 4, "_to_") == 0) {
|
||||
if (baseDirection == TRI_EDGE_ANY || baseDirection == TRI_EDGE_IN) {
|
||||
_directions.emplace_back(TRI_EDGE_IN);
|
||||
_edgeColls.emplace_back(std::make_unique<aql::Collection>(
|
||||
n, _vocbase, TRI_TRANSACTION_READ));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (baseDirection == TRI_EDGE_ANY) {
|
||||
_directions.emplace_back(TRI_EDGE_OUT);
|
||||
_edgeColls.emplace_back(std::make_unique<aql::Collection>(
|
||||
|
|
|
@ -1212,7 +1212,7 @@ int ClusterInfo::dropCollectionCoordinator(std::string const& databaseName,
|
|||
numberOfShards = shards.length();
|
||||
} else {
|
||||
LOG_TOPIC(ERR, Logger::CLUSTER) << "Missing shards information on dropping"
|
||||
<< databaseName << "/" << collectionID;
|
||||
<< databaseName << "/" << collectionID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -2084,23 +2084,7 @@ if (list.length > 0) {
|
|||
<p><a href="https://slack.arangodb.com" target="_blank"><i class="fa fa-slack"></i></a></p>
|
||||
<p><a href="https://stackoverflow.com/questions/tagged/arangodb" target="_blank"><i class="fa fa-stack-overflow"></i></a></p>
|
||||
<p><a href="https://groups.google.com/group/arangodb" target="_blank"><i class="fa fa-google"></i></a></p>
|
||||
</div></script><script id="nodesView.ejs" type="text/template"><div id="nodesContent" class="innerContent"> <% if (coords.length > 0) { %> <% var disabled = ''; %> <% var genClass = "pure-u-1-" + Object.keys(coords[0]).length; %> <% if (type !== 'coordinator') { %> <% disabled = " disabled"; %> <% } else { %> <% disabled = " "; %> <% } %> <div class="pure-g cluster-nodes-title pure-table pure-table-header pure-title">
|
||||
<div class="pure-table-row">
|
||||
<div class="<%= genClass %> mid">Name</div>
|
||||
<div class="<%= genClass %> mid">Address</div>
|
||||
<div class="<%= genClass %> mid">Protocol</div>
|
||||
<div class="<%=genClass%> mid">Role</div>
|
||||
<div class="<%=genClass%> mid">Status</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pure-g cluster-nodes coords-dbs pure-table pure-table-body"> <% _.each(coords, function(node) { %> <div class="pure-table-row <%= disabled %>" node="<%=node.name%>">
|
||||
|
||||
<div class="<%= genClass %> mid"><%= node.name %></div>
|
||||
<div class="<%= genClass %> mid"><%= node.address %></div>
|
||||
<div class="<%= genClass %> mid"><%= node.protocol %></div>
|
||||
<div class="<%=genClass%> mid"><%= node.role %></div> <% if(node.status === 'ok') { %> <div class="<%= genClass %> mid state"><i class="fa fa-check-circle"></i></div> <% } else { %> <div class="<%= genClass %> mid state"><i class="fa fa-exclamation-circle"></i></div> <% } %> </div> <% }); %> </div> <% } %> </div></script><script id="nodesView2.ejs" type="text/template"><div id="nodesContent" class="innerContent"> <% if (Object.keys(coords).length > 0) { %> <% var disabled = ''; %> <div class="pure-g">
|
||||
</div></script><script id="nodesView.ejs" type="text/template"><div id="nodesContent" class="innerContent"> <% if (Object.keys(coords).length > 0) { %> <% var disabled = ''; %> <div class="pure-g">
|
||||
|
||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-2">
|
||||
|
||||
|
@ -2311,7 +2295,7 @@ if (list.length > 0) {
|
|||
<span id="spinner"><i class="fa fa-spinner fa-spin"></i><i>Query is operating ...</i></span>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<span class="action"><i class="fa fa-close" element="outputEditor<%= counter %>" style="display: none"></i></span>
|
||||
<span class="action"><i class="fa fa-close closeResult" element="outputEditor<%= counter %>" style="display: none"></i></span>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="switchAce" counter="<%=counter%>">
|
||||
|
@ -2746,4 +2730,4 @@ var cutByResolution = function (str) {
|
|||
</div>
|
||||
|
||||
<div id="workMonitorContent" class="innerContent">
|
||||
</div></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_logo_big.svg"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><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="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=1475071254442"></script><script src="app.js?version=1475071254442"></script></body></html>
|
||||
</div></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_logo_big.svg"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><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="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=1475149009296"></script><script src="app.js?version=1475149009296"></script></body></html>
|
Binary file not shown.
|
@ -104,7 +104,7 @@
|
|||
<span id="spinner"><i class="fa fa-spinner fa-spin"></i><i>Query is operating ...</i></span>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<span class="action"><i class="fa fa-close" element="outputEditor<%= counter %>" style="display: none"></i></span>
|
||||
<span class="action"><i class="fa fa-close closeResult" element="outputEditor<%= counter %>" style="display: none"></i></span>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="switchAce" counter="<%=counter%>">
|
||||
|
@ -135,4 +135,4 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -296,8 +296,8 @@
|
|||
|
||||
var continueFetchGraph = function () {
|
||||
var ajaxData = {};
|
||||
if (this.graphConfig) {
|
||||
ajaxData = _.clone(this.graphConfig);
|
||||
if (self.graphConfig) {
|
||||
ajaxData = _.clone(self.graphConfig);
|
||||
|
||||
// remove not needed params - client only
|
||||
delete ajaxData.layout;
|
||||
|
@ -315,12 +315,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
this.setupSigma();
|
||||
self.setupSigma();
|
||||
|
||||
self.fetchStarted = new Date();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: arangoHelper.databaseUrl('/_admin/aardvark/graph/' + encodeURIComponent(this.name)),
|
||||
url: arangoHelper.databaseUrl('/_admin/aardvark/graph/' + encodeURIComponent(self.name)),
|
||||
contentType: 'application/json',
|
||||
data: ajaxData,
|
||||
success: function (data) {
|
||||
|
@ -369,34 +369,40 @@
|
|||
} catch (ignore) {}
|
||||
}
|
||||
});
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (this.graphConfig === undefined || this.graphConfig === null) {
|
||||
var setDefaultsCB = function () {
|
||||
self.userConfig.fetch({
|
||||
success: function (data) {
|
||||
var combinedName = frontendConfig.db + '_' + self.name;
|
||||
try {
|
||||
self.graphConfig = data.toJSON().graphs[combinedName];
|
||||
self.getGraphSettings(continueFetchGraph);
|
||||
} catch (ignore) {
|
||||
// continue without config
|
||||
self.getGraphSettings(continueFetchGraph);
|
||||
if (self.graphConfig === undefined || self.graphConfig === null) {
|
||||
self.userConfig.fetch({
|
||||
success: function (data) {
|
||||
var combinedName = frontendConfig.db + '_' + self.name;
|
||||
try {
|
||||
self.graphConfig = data.toJSON().graphs[combinedName];
|
||||
self.getGraphSettings(continueFetchGraph);
|
||||
|
||||
if (self.graphConfig === undefined || self.graphConfig === null) {
|
||||
self.graphSettingsView = new window.GraphSettingsView({
|
||||
name: self.name,
|
||||
userConfig: self.userConfig,
|
||||
saveCallback: self.render
|
||||
});
|
||||
self.graphSettingsView.setDefaults(true, true);
|
||||
} else {
|
||||
// init settings view
|
||||
if (self.graphSettingsView) {
|
||||
self.graphSettingsView.remove();
|
||||
}
|
||||
self.graphSettingsView = new window.GraphSettingsView({
|
||||
name: self.name,
|
||||
userConfig: self.userConfig,
|
||||
saveCallback: self.render
|
||||
});
|
||||
}
|
||||
} catch (ignore) {
|
||||
// continue without config
|
||||
self.getGraphSettings(continueFetchGraph);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// init settings view
|
||||
if (self.graphSettingsView) {
|
||||
self.graphSettingsView.remove();
|
||||
}
|
||||
self.graphSettingsView = new window.GraphSettingsView({
|
||||
name: self.name,
|
||||
userConfig: self.userConfig,
|
||||
saveCallback: self.render
|
||||
}
|
||||
});
|
||||
self.graphSettingsView.setDefaults(true, true, setDefaultsCB);
|
||||
} else {
|
||||
this.getGraphSettings(continueFetchGraph);
|
||||
}
|
||||
|
@ -1284,7 +1290,7 @@
|
|||
self.currentGraph.refresh();
|
||||
// self.cameraToNode(origin);
|
||||
} else if (self.algorithm === 'noverlap') {
|
||||
self.startLayout(true, origin); // tmp bugfix, rerender with noverlap currently not possible
|
||||
self.startLayout(true, origin); // TODO: tmp bugfix, rerender with noverlap currently not possible
|
||||
// self.currentGraph.startNoverlap();
|
||||
}
|
||||
}
|
||||
|
@ -1476,16 +1482,14 @@
|
|||
}
|
||||
|
||||
var style = 'position: absolute; left: 25px; bottom: 50px;';
|
||||
if (this.aqlMode) {
|
||||
style = 'position: absolute; left: 30px; margin-top: -37px;';
|
||||
}
|
||||
|
||||
$('#graph-container').append(
|
||||
'<div id="objectCount" style="' + style + ' animated fadeIn">' +
|
||||
'<span style="margin-right: 10px" class="arangoState"><span id="nodesCount">' + graph.nodes.length + '</span> nodes</span>' +
|
||||
if (!this.aqlMode) {
|
||||
$('#graph-container').append(
|
||||
'<div id="objectCount" style="' + style + ' animated fadeIn">' +
|
||||
'<span style="margin-right: 10px" class="arangoState"><span id="nodesCount">' + graph.nodes.length + '</span> nodes</span>' +
|
||||
'<span class="arangoState"><span id="edgesCount">' + graph.edges.length + '</span> edges</span>' +
|
||||
'</div>'
|
||||
);
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.Sigma = sigma;
|
||||
|
@ -1878,12 +1882,15 @@
|
|||
// Start the Fruchterman-Reingold algorithm:
|
||||
sigma.layouts.fruchtermanReingold.start(s);
|
||||
}
|
||||
var dragListener = sigma.plugins.dragNodes(s, s.renderers[0]);
|
||||
|
||||
dragListener.bind('drag', function (event) {
|
||||
// drag nodes listener
|
||||
this.dragListener = sigma.plugins.dragNodes(s, s.renderers[0]);
|
||||
|
||||
this.dragListener.bind('drag', function (event) {
|
||||
self.dragging = true;
|
||||
});
|
||||
dragListener.bind('drop', function (event) {
|
||||
|
||||
this.dragListener.bind('drop', function (event) {
|
||||
window.setTimeout(function () {
|
||||
self.dragging = false;
|
||||
}, 400);
|
||||
|
@ -2017,6 +2024,7 @@ $('#deleteNodes').remove();
|
|||
var self = this;
|
||||
this.currentGraph.settings('drawLabels', false);
|
||||
this.currentGraph.settings('drawEdgeLabels', false);
|
||||
sigma.plugins.killDragNodes(this.currentGraph);
|
||||
|
||||
if (kill === true) {
|
||||
this.currentGraph.killForceAtlas2();
|
||||
|
@ -2025,7 +2033,7 @@ $('#deleteNodes').remove();
|
|||
self.stopLayout();
|
||||
|
||||
if (origin) {
|
||||
self.currentGraph.refresh();
|
||||
this.currentGraph.refresh({ skipIndexation: true });
|
||||
// self.cameraToNode(origin);
|
||||
}
|
||||
}, 500);
|
||||
|
@ -2052,10 +2060,10 @@ $('#deleteNodes').remove();
|
|||
$('#toggleForce span').html('Resume layout');
|
||||
this.layouting = false;
|
||||
this.currentGraph.stopForceAtlas2();
|
||||
sigma.plugins.dragNodes(this.currentGraph, this.currentGraph.renderers[0]);
|
||||
this.currentGraph.settings('drawLabels', true);
|
||||
this.currentGraph.settings('drawEdgeLabels', true);
|
||||
this.currentGraph.refresh({ skipIndexation: true });
|
||||
this.dragListener = sigma.plugins.dragNodes(this.currentGraph, this.currentGraph.renderers[0]);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
renderComplete: false,
|
||||
|
||||
customQueries: [],
|
||||
cachedQueries: {},
|
||||
queries: [],
|
||||
|
||||
state: {
|
||||
|
@ -70,7 +71,7 @@
|
|||
'click #clearQuery': 'clearQuery',
|
||||
'click .outputEditorWrapper #downloadQueryResult': 'downloadQueryResult',
|
||||
'click .outputEditorWrapper .switchAce span': 'switchAce',
|
||||
'click .outputEditorWrapper .fa-close': 'closeResult',
|
||||
'click .outputEditorWrapper .closeResult': 'closeResult',
|
||||
'click #toggleQueries1': 'toggleQueries',
|
||||
'click #toggleQueries2': 'toggleQueries',
|
||||
'click #createNewQuery': 'createAQL',
|
||||
|
@ -98,8 +99,14 @@
|
|||
this.aqlEditor.setValue('', 1);
|
||||
},
|
||||
|
||||
closeProfile: function () {
|
||||
$('.queryProfile').fadeOut('fast');
|
||||
closeProfile: function (e) {
|
||||
var count = $(e.currentTarget).parent().attr('counter');
|
||||
|
||||
_.each($('.queryProfile'), function (elem) {
|
||||
if ($(elem).attr('counter') === count) {
|
||||
$(elem).fadeOut('fast');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
toggleBindParams: function () {
|
||||
|
@ -166,6 +173,7 @@
|
|||
},
|
||||
|
||||
removeResults: function () {
|
||||
this.cachedQueries = {};
|
||||
$('.outputEditorWrapper').hide('fast', function () {
|
||||
$('.outputEditorWrapper').remove();
|
||||
});
|
||||
|
@ -518,6 +526,9 @@
|
|||
self.removeOutputEditor(counter);
|
||||
arangoHelper.arangoError('Explain', data.msg);
|
||||
} else {
|
||||
// cache explain results
|
||||
self.cachedQueries[counter] = data;
|
||||
|
||||
outputEditor.setValue(data.msg, 1);
|
||||
self.deselect(outputEditor);
|
||||
$.noty.clearQueue();
|
||||
|
@ -620,10 +631,17 @@
|
|||
},
|
||||
|
||||
closeResult: function (e) {
|
||||
var self = this;
|
||||
var target = $('#' + $(e.currentTarget).attr('element')).parent();
|
||||
var id = $(target).attr('id');
|
||||
var counter = id.substring(id.length - 1, id.length - 0);
|
||||
|
||||
delete this.cachedQueries[counter];
|
||||
|
||||
$(target).hide('fast', function () {
|
||||
$(target).remove();
|
||||
if ($('.outputEditorWrapper').length === 0) {
|
||||
self.cachedQueries = {};
|
||||
$('#removeResults').hide();
|
||||
}
|
||||
});
|
||||
|
@ -672,6 +690,29 @@
|
|||
self.resize();
|
||||
}, 10);
|
||||
self.deselect(self.aqlEditor);
|
||||
|
||||
this.restoreCachedQueries();
|
||||
},
|
||||
|
||||
restoreCachedQueries: function () {
|
||||
var self = this;
|
||||
|
||||
if (Object.keys(this.cachedQueries).length > 0) {
|
||||
_.each(this.cachedQueries, function (query, counter) {
|
||||
self.renderQueryResultBox(counter, null, true);
|
||||
self.renderQueryResult(query, counter, true);
|
||||
self.fillSentQueryValue(counter);
|
||||
|
||||
if (query.sentQuery) {
|
||||
self.bindQueryResultButtons(null, counter);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
fillSentQueryValue: function (counter) {
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
sentQueryEditor.setValue(this.cachedQueries[counter].sentQuery, 1);
|
||||
},
|
||||
|
||||
showSpotlight: function (type) {
|
||||
|
@ -1368,15 +1409,18 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.$(this.outputDiv).prepend(this.outputTemplate.render({
|
||||
counter: this.outputCounter,
|
||||
type: 'Query'
|
||||
}));
|
||||
|
||||
$('#outputEditorWrapper' + this.outputCounter).hide();
|
||||
$('#outputEditorWrapper' + this.outputCounter).show('fast');
|
||||
|
||||
var counter = this.outputCounter;
|
||||
this.renderQueryResultBox(this.outputCounter, selected);
|
||||
},
|
||||
|
||||
renderQueryResultBox: function (counter, selected, cached) {
|
||||
this.$(this.outputDiv).prepend(this.outputTemplate.render({
|
||||
counter: counter,
|
||||
type: 'Query'
|
||||
}));
|
||||
|
||||
var outputEditor = ace.edit('outputEditor' + counter);
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
var sentBindParamEditor = ace.edit('sentBindParamEditor' + counter);
|
||||
|
@ -1400,8 +1444,10 @@
|
|||
sentBindParamEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentBindParamEditor);
|
||||
|
||||
this.fillResult(outputEditor, sentQueryEditor, counter, selected);
|
||||
this.outputCounter++;
|
||||
if (!cached) {
|
||||
this.fillResult(counter, selected);
|
||||
this.outputCounter++;
|
||||
}
|
||||
},
|
||||
|
||||
readQueryData: function (selected, forExecute) {
|
||||
|
@ -1445,7 +1491,7 @@
|
|||
return JSON.stringify(data);
|
||||
},
|
||||
|
||||
fillResult: function (outputEditor, sentQueryEditor, counter, selected) {
|
||||
fillResult: function (counter, selected) {
|
||||
var self = this;
|
||||
|
||||
var queryData = this.readQueryData(selected, true);
|
||||
|
@ -1455,6 +1501,7 @@
|
|||
}
|
||||
|
||||
if (queryData) {
|
||||
var sentQueryEditor = ace.edit('sentQueryEditor' + counter);
|
||||
sentQueryEditor.setValue(self.aqlEditor.getValue(), 1);
|
||||
|
||||
$.ajax({
|
||||
|
@ -1468,7 +1515,7 @@
|
|||
processData: false,
|
||||
success: function (data, textStatus, xhr) {
|
||||
if (xhr.getResponseHeader('x-arango-async-id')) {
|
||||
self.queryCallbackFunction(xhr.getResponseHeader('x-arango-async-id'), outputEditor, counter);
|
||||
self.queryCallbackFunction(xhr.getResponseHeader('x-arango-async-id'), counter);
|
||||
}
|
||||
$.noty.clearQueue();
|
||||
$.noty.closeAll();
|
||||
|
@ -1530,70 +1577,28 @@
|
|||
editor.focus();
|
||||
},
|
||||
|
||||
queryCallbackFunction: function (queryID, outputEditor, counter) {
|
||||
var self = this;
|
||||
|
||||
var cancelRunningQuery = function (id, counter) {
|
||||
$.ajax({
|
||||
url: arangoHelper.databaseUrl('/_api/job/' + encodeURIComponent(id) + '/cancel'),
|
||||
type: 'PUT',
|
||||
success: function () {
|
||||
window.clearTimeout(self.checkQueryTimer);
|
||||
$('#outputEditorWrapper' + counter).remove();
|
||||
arangoHelper.arangoNotification('Query', 'Query canceled.');
|
||||
}
|
||||
warningsFunc: function (data, outputEditor) {
|
||||
var warnings = '';
|
||||
if (data.extra && data.extra.warnings && data.extra.warnings.length > 0) {
|
||||
warnings += 'Warnings:' + '\r\n\r\n';
|
||||
data.extra.warnings.forEach(function (w) {
|
||||
warnings += '[' + w.code + "], '" + w.message + "'\r\n";
|
||||
});
|
||||
};
|
||||
}
|
||||
if (warnings !== '') {
|
||||
warnings += '\r\n' + 'Result:' + '\r\n\r\n';
|
||||
}
|
||||
outputEditor.setValue(warnings + JSON.stringify(data.result, undefined, 2), 1);
|
||||
outputEditor.getSession().setScrollTop(0);
|
||||
},
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' #cancelCurrentQuery').bind('click', function () {
|
||||
cancelRunningQuery(queryID, counter);
|
||||
});
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' #copy2aqlEditor').bind('click', function () {
|
||||
if (!$('#toggleQueries1').is(':visible')) {
|
||||
self.toggleQueries();
|
||||
}
|
||||
|
||||
var aql = ace.edit('sentQueryEditor' + counter).getValue();
|
||||
var bindParam = JSON.parse(ace.edit('sentBindParamEditor' + counter).getValue());
|
||||
self.aqlEditor.setValue(aql, 1);
|
||||
self.deselect(self.aqlEditor);
|
||||
if (Object.keys(bindParam).length > 0) {
|
||||
self.bindParamTableObj = bindParam;
|
||||
self.setCachedQuery(self.aqlEditor.getValue(), JSON.stringify(self.bindParamTableObj));
|
||||
|
||||
if ($('#bindParamEditor').is(':visible')) {
|
||||
self.renderBindParamTable();
|
||||
} else {
|
||||
self.bindParamAceEditor.setValue(JSON.stringify(bindParam), 1);
|
||||
self.deselect(self.bindParamAceEditor);
|
||||
}
|
||||
}
|
||||
$('.centralRow').animate({ scrollTop: 0 }, 'fast');
|
||||
self.resize();
|
||||
});
|
||||
|
||||
this.execPending = false;
|
||||
|
||||
var warningsFunc = function (data) {
|
||||
var warnings = '';
|
||||
if (data.extra && data.extra.warnings && data.extra.warnings.length > 0) {
|
||||
warnings += 'Warnings:' + '\r\n\r\n';
|
||||
data.extra.warnings.forEach(function (w) {
|
||||
warnings += '[' + w.code + "], '" + w.message + "'\r\n";
|
||||
});
|
||||
}
|
||||
if (warnings !== '') {
|
||||
warnings += '\r\n' + 'Result:' + '\r\n\r\n';
|
||||
}
|
||||
outputEditor.setValue(warnings + JSON.stringify(data.result, undefined, 2), 1);
|
||||
outputEditor.getSession().setScrollTop(0);
|
||||
};
|
||||
|
||||
var fetchQueryResult = function (data) {
|
||||
warningsFunc(data);
|
||||
window.progressView.hide();
|
||||
renderQueryResult: function (data, counter, cached) {
|
||||
var self = this;
|
||||
var outputEditor = ace.edit('outputEditor' + counter);
|
||||
|
||||
// handle explain query case
|
||||
if (!data.msg) {
|
||||
// handle usual query
|
||||
var result = self.analyseQuery(data.result);
|
||||
// console.log('Using ' + result.defaultType + ' as data format.');
|
||||
if (result.defaultType === 'table') {
|
||||
|
@ -1628,8 +1633,6 @@
|
|||
);
|
||||
};
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' .pull-left #spinner').remove();
|
||||
|
||||
var time = '-';
|
||||
if (data && data.extra && data.extra.stats) {
|
||||
time = data.extra.stats.executionTime.toFixed(3) + ' s';
|
||||
|
@ -1662,25 +1665,99 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' .switchAce').show();
|
||||
$('#outputEditorWrapper' + counter + ' .fa-close').show();
|
||||
$('#outputEditor' + counter).css('opacity', '1');
|
||||
$('#outputEditorWrapper' + counter + ' .pull-left #spinner').remove();
|
||||
$('#outputEditorWrapper' + counter + ' #cancelCurrentQuery').remove();
|
||||
|
||||
self.warningsFunc(data, outputEditor);
|
||||
window.progressView.hide();
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' .switchAce').show();
|
||||
$('#outputEditorWrapper' + counter + ' .fa-close').show();
|
||||
$('#outputEditor' + counter).css('opacity', '1');
|
||||
|
||||
if (!data.msg) {
|
||||
$('#outputEditorWrapper' + counter + ' #downloadQueryResult').show();
|
||||
$('#outputEditorWrapper' + counter + ' #copy2aqlEditor').show();
|
||||
$('#outputEditorWrapper' + counter + ' #cancelCurrentQuery').remove();
|
||||
}
|
||||
|
||||
self.setEditorAutoHeight(outputEditor);
|
||||
self.deselect(outputEditor);
|
||||
self.setEditorAutoHeight(outputEditor);
|
||||
self.deselect(outputEditor);
|
||||
|
||||
// when finished send a delete req to api (free db space)
|
||||
if (data.id) {
|
||||
// when finished send a delete req to api (free db space)
|
||||
if (data.id) {
|
||||
$.ajax({
|
||||
url: arangoHelper.databaseUrl('/_api/cursor/' + encodeURIComponent(data.id)),
|
||||
type: 'DELETE'
|
||||
});
|
||||
}
|
||||
|
||||
if (!cached) {
|
||||
// cache the query
|
||||
self.cachedQueries[counter] = data;
|
||||
|
||||
// cache the original sent aql string
|
||||
this.cachedQueries[counter].sentQuery = self.aqlEditor.getValue();
|
||||
}
|
||||
|
||||
if (data.msg) {
|
||||
$('#outputEditorWrapper' + counter + ' .toolbarType').html('Explain');
|
||||
outputEditor.setValue(data.msg, 1);
|
||||
}
|
||||
},
|
||||
|
||||
bindQueryResultButtons: function (queryID, counter) {
|
||||
var self = this;
|
||||
|
||||
if (queryID) {
|
||||
var cancelRunningQuery = function (id, counter) {
|
||||
$.ajax({
|
||||
url: arangoHelper.databaseUrl('/_api/cursor/' + encodeURIComponent(data.id)),
|
||||
type: 'DELETE'
|
||||
url: arangoHelper.databaseUrl('/_api/job/' + encodeURIComponent(id) + '/cancel'),
|
||||
type: 'PUT',
|
||||
success: function () {
|
||||
window.clearTimeout(self.checkQueryTimer);
|
||||
$('#outputEditorWrapper' + counter).remove();
|
||||
arangoHelper.arangoNotification('Query', 'Query canceled.');
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' #cancelCurrentQuery').bind('click', function () {
|
||||
cancelRunningQuery(queryID, counter);
|
||||
});
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' #copy2aqlEditor').bind('click', function () {
|
||||
if (!$('#toggleQueries1').is(':visible')) {
|
||||
self.toggleQueries();
|
||||
}
|
||||
};
|
||||
|
||||
var aql = ace.edit('sentQueryEditor' + counter).getValue();
|
||||
var bindParam = JSON.parse(ace.edit('sentBindParamEditor' + counter).getValue());
|
||||
self.aqlEditor.setValue(aql, 1);
|
||||
self.deselect(self.aqlEditor);
|
||||
if (Object.keys(bindParam).length > 0) {
|
||||
self.bindParamTableObj = bindParam;
|
||||
self.setCachedQuery(self.aqlEditor.getValue(), JSON.stringify(self.bindParamTableObj));
|
||||
|
||||
if ($('#bindParamEditor').is(':visible')) {
|
||||
self.renderBindParamTable();
|
||||
} else {
|
||||
self.bindParamAceEditor.setValue(JSON.stringify(bindParam), 1);
|
||||
self.deselect(self.bindParamAceEditor);
|
||||
}
|
||||
}
|
||||
$('.centralRow').animate({ scrollTop: 0 }, 'fast');
|
||||
self.resize();
|
||||
});
|
||||
},
|
||||
|
||||
queryCallbackFunction: function (queryID, counter) {
|
||||
var self = this;
|
||||
|
||||
this.bindQueryResultButtons(queryID, counter);
|
||||
this.execPending = false;
|
||||
|
||||
// check if async query is finished
|
||||
var checkQueryStatus = function () {
|
||||
|
@ -1692,7 +1769,7 @@
|
|||
success: function (data, textStatus, xhr) {
|
||||
// query finished, now fetch results
|
||||
if (xhr.status === 201) {
|
||||
fetchQueryResult(data);
|
||||
self.renderQueryResult(data, counter);
|
||||
} else if (xhr.status === 204) {
|
||||
// query not ready yet, retry
|
||||
self.checkQueryTimer = window.setTimeout(function () {
|
||||
|
@ -1746,101 +1823,105 @@
|
|||
var element = '#outputEditorWrapper' + counter;
|
||||
|
||||
$(element + ' .fa-caret-down').first().on('click', function () {
|
||||
$(element).find('.queryProfile').remove();
|
||||
$(element).append('<div class="queryProfile"></div>');
|
||||
var queryProfile = $(element + ' .queryProfile').first();
|
||||
queryProfile.hide();
|
||||
var alreadyRendered = $(element).find('.queryProfile');
|
||||
if (!$(alreadyRendered).is(':visible')) {
|
||||
$(element).append('<div class="queryProfile" counter="' + counter + '"></div>');
|
||||
var queryProfile = $(element + ' .queryProfile').first();
|
||||
queryProfile.hide();
|
||||
|
||||
// var outputPosition = $(element + ' .fa-caret-down').first().offset();
|
||||
queryProfile
|
||||
.css('position', 'absolute')
|
||||
.css('left', 215)
|
||||
.css('top', 55);
|
||||
// var outputPosition = $(element + ' .fa-caret-down').first().offset();
|
||||
queryProfile
|
||||
.css('position', 'absolute')
|
||||
.css('left', 215)
|
||||
.css('top', 55);
|
||||
|
||||
// $("#el").offset().top - $(document).scrollTop()
|
||||
var profileWidth = 590;
|
||||
// $("#el").offset().top - $(document).scrollTop()
|
||||
var profileWidth = 590;
|
||||
|
||||
var legend = [
|
||||
'A', 'B', 'C', 'D', 'E', 'F'
|
||||
];
|
||||
var legend = [
|
||||
'A', 'B', 'C', 'D', 'E', 'F'
|
||||
];
|
||||
|
||||
var colors = [
|
||||
'rgb(48, 125, 153)',
|
||||
'rgb(241, 124, 176)',
|
||||
'rgb(178, 145, 47)',
|
||||
'rgb(93, 165, 218)',
|
||||
'rgb(250, 164, 58)',
|
||||
'rgb(96, 189, 104)'
|
||||
];
|
||||
var colors = [
|
||||
'rgb(48, 125, 153)',
|
||||
'rgb(241, 124, 176)',
|
||||
'rgb(137, 110, 37)',
|
||||
'rgb(93, 165, 218)',
|
||||
'rgb(250, 164, 58)',
|
||||
'rgb(96, 189, 104)'
|
||||
];
|
||||
|
||||
var descs = [
|
||||
'startup time for query engine',
|
||||
'query parsing',
|
||||
'abstract syntax tree optimizations',
|
||||
'instanciation of initial execution plan',
|
||||
'execution plan optimization and permutation',
|
||||
'query execution'
|
||||
];
|
||||
var descs = [
|
||||
'startup time for query engine',
|
||||
'query parsing',
|
||||
'abstract syntax tree optimizations',
|
||||
'instanciation of initial execution plan',
|
||||
'execution plan optimization and permutation',
|
||||
'query execution'
|
||||
];
|
||||
|
||||
queryProfile.append(
|
||||
'<i class="fa fa-close closeProfile"></i>' +
|
||||
'<span class="profileHeader">Profiling information</span>' +
|
||||
'<div class="pure-g pure-table pure-table-body"></div>' +
|
||||
'<div class="prof-progress"></div>' +
|
||||
'<div class="prof-progress-label"></div>' +
|
||||
'<div class="clear"></div>'
|
||||
);
|
||||
|
||||
var total = 0;
|
||||
_.each(data, function (value) {
|
||||
total += value * 1000;
|
||||
});
|
||||
|
||||
var pos = 0;
|
||||
var width;
|
||||
var adjustWidth = 0;
|
||||
|
||||
_.each(data, function (value, key) {
|
||||
var ms = numeral(value * 1000).format('0.000');
|
||||
ms += ' ms';
|
||||
|
||||
queryProfile.find('.pure-g').append(
|
||||
'<div class="pure-table-row noHover">' +
|
||||
'<div class="pure-u-1-24 left"><p class="bold" style="background:' + colors[pos] + '">' + legend[pos] + '</p></div>' +
|
||||
'<div class="pure-u-4-24 left">' + ms + '</div>' +
|
||||
'<div class="pure-u-6-24 left">' + key + '</div>' +
|
||||
'<div class="pure-u-13-24 left">' + descs[pos] + '</div>' +
|
||||
'</div>'
|
||||
queryProfile.append(
|
||||
'<i class="fa fa-close closeProfile"></i>' +
|
||||
'<span class="profileHeader">Profiling information</span>' +
|
||||
'<div class="pure-g pure-table pure-table-body"></div>' +
|
||||
'<div class="prof-progress"></div>' +
|
||||
'<div class="prof-progress-label"></div>' +
|
||||
'<div class="clear"></div>'
|
||||
);
|
||||
|
||||
width = (value * 1000) / total * 100;
|
||||
if (width < 5) {
|
||||
width = 5;
|
||||
adjustWidth += 5;
|
||||
}
|
||||
var total = 0;
|
||||
_.each(data, function (value) {
|
||||
total += value * 1000;
|
||||
});
|
||||
|
||||
if (pos === 5 && adjustWidth !== 0) {
|
||||
width = width - adjustWidth;
|
||||
queryProfile.find('.prof-progress').append(
|
||||
'<div style="width: ' + width + '%; background-color: ' + colors[pos] + '"></div>'
|
||||
);
|
||||
queryProfile.find('.prof-progress-label').append(
|
||||
'<div style="width: ' + width + '%;">' + legend[pos] + '</div>'
|
||||
);
|
||||
} else {
|
||||
queryProfile.find('.prof-progress').append(
|
||||
'<div style="width: ' + width + '%; background-color: ' + colors[pos] + '"></div>'
|
||||
);
|
||||
queryProfile.find('.prof-progress-label').append(
|
||||
'<div style="width: ' + width + '%;">' + legend[pos] + '</div>'
|
||||
);
|
||||
}
|
||||
pos++;
|
||||
});
|
||||
var pos = 0;
|
||||
var width;
|
||||
var adjustWidth = 0;
|
||||
|
||||
queryProfile.width(profileWidth);
|
||||
queryProfile.height('auto');
|
||||
queryProfile.fadeIn('fast');
|
||||
_.each(data, function (value, key) {
|
||||
var ms = numeral(value * 1000).format('0.000');
|
||||
ms += ' ms';
|
||||
|
||||
queryProfile.find('.pure-g').append(
|
||||
'<div class="pure-table-row noHover">' +
|
||||
'<div class="pure-u-1-24 left"><p class="bold" style="background:' + colors[pos] + '">' + legend[pos] + '</p></div>' +
|
||||
'<div class="pure-u-4-24 left">' + ms + '</div>' +
|
||||
'<div class="pure-u-6-24 left">' + key + '</div>' +
|
||||
'<div class="pure-u-13-24 left">' + descs[pos] + '</div>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
width = (value * 1000) / total * 100;
|
||||
if (width < 5) {
|
||||
width = 5;
|
||||
adjustWidth += 5;
|
||||
}
|
||||
|
||||
if (pos === 5 && adjustWidth !== 0) {
|
||||
width = width - adjustWidth;
|
||||
queryProfile.find('.prof-progress').append(
|
||||
'<div style="width: ' + width + '%; background-color: ' + colors[pos] + '"></div>'
|
||||
);
|
||||
queryProfile.find('.prof-progress-label').append(
|
||||
'<div style="width: ' + width + '%;">' + legend[pos] + '</div>'
|
||||
);
|
||||
} else {
|
||||
queryProfile.find('.prof-progress').append(
|
||||
'<div style="width: ' + width + '%; background-color: ' + colors[pos] + '"></div>'
|
||||
);
|
||||
queryProfile.find('.prof-progress-label').append(
|
||||
'<div style="width: ' + width + '%;">' + legend[pos] + '</div>'
|
||||
);
|
||||
}
|
||||
pos++;
|
||||
});
|
||||
|
||||
queryProfile.width(profileWidth);
|
||||
queryProfile.height('auto');
|
||||
queryProfile.fadeIn('fast');
|
||||
} else {
|
||||
$(element).find('.queryProfile').remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -161,7 +161,6 @@
|
|||
},
|
||||
|
||||
confirmMoveShards: function (dbName, collectionName, shardName, fromServer) {
|
||||
var self = this;
|
||||
var toServer = $('#toDBServer').val();
|
||||
|
||||
var data = {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const _ = require('lodash');
|
||||
const joi = require('joi');
|
||||
const assert = require('assert');
|
||||
const typeIs = require('type-is');
|
||||
const mediaTyper = require('media-typer');
|
||||
|
@ -110,12 +111,16 @@ exports.parseRequestBody = function parseRequestBody (def, req) {
|
|||
exports.validateRequestBody = function validateRequestBody (def, req) {
|
||||
let body = req.body;
|
||||
|
||||
const schema = def.model && (def.model.schema || def.model);
|
||||
let schema = def.model && (def.model.schema || def.model);
|
||||
if (!schema) {
|
||||
return body;
|
||||
}
|
||||
|
||||
if (schema.isJoi) {
|
||||
if (def.multiple) {
|
||||
schema = joi.array().items(schema).required();
|
||||
}
|
||||
|
||||
const result = schema.validate(body);
|
||||
|
||||
if (result.error) {
|
||||
|
@ -127,7 +132,11 @@ exports.validateRequestBody = function validateRequestBody (def, req) {
|
|||
}
|
||||
|
||||
if (def.model && def.model.fromClient) {
|
||||
body = def.model.fromClient(body);
|
||||
if (def.multiple) {
|
||||
body = body.map((body) => def.model.fromClient(body));
|
||||
} else {
|
||||
body = def.model.fromClient(body);
|
||||
}
|
||||
}
|
||||
|
||||
return body;
|
||||
|
|
|
@ -118,6 +118,7 @@ for aid in `seq 0 $(( $POOLSZ - 1 ))`; do
|
|||
--server.authentication false \
|
||||
--server.endpoint $TRANSPORT://localhost:$port \
|
||||
--server.statistics false \
|
||||
--server.threads 4 \
|
||||
$SSLKEYFILE \
|
||||
> agency/$port.stdout 2>&1 &
|
||||
PIDS+=$!
|
||||
|
|
Loading…
Reference in New Issue