mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
bafe7fd8b3
|
@ -413,3 +413,8 @@
|
||||||
|
|
||||||
* GITHUB: https://github.com/jacomyal/sigma.js
|
* GITHUB: https://github.com/jacomyal/sigma.js
|
||||||
* License: [MIT License](https://github.com/jacomyal/sigma.js/blob/master/LICENSE.txt)
|
* License: [MIT License](https://github.com/jacomyal/sigma.js/blob/master/LICENSE.txt)
|
||||||
|
|
||||||
|
#### wheelnav.js
|
||||||
|
|
||||||
|
* GITHUB: https://github.com/softwaretailoring/wheelnav
|
||||||
|
* License: [MIT License](https://github.com/softwaretailoring/wheelnav/blob/master/LICENSE)
|
||||||
|
|
|
@ -79,24 +79,37 @@ V8Expression* Executor::generateExpression(AstNode const* node) {
|
||||||
constantValues->ForceSet(TRI_V8_STD_STRING(name), toV8(isolate, it.first));
|
constantValues->ForceSet(TRI_V8_STD_STRING(name), toV8(isolate, it.first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compile the expression
|
TRI_ASSERT(_buffer != nullptr);
|
||||||
v8::Handle<v8::Value> func(compileExpression());
|
|
||||||
|
|
||||||
// exit early if an error occurred
|
v8::Handle<v8::Script> compiled = v8::Script::Compile(
|
||||||
HandleV8Error(tryCatch, func);
|
TRI_V8_STD_STRING((*_buffer)), TRI_V8_ASCII_STRING("--script--"));
|
||||||
|
|
||||||
// a "simple" expression here is any expression that will only return
|
if (! compiled.IsEmpty()) {
|
||||||
// non-cyclic
|
v8::Handle<v8::Value> func(compiled->Run());
|
||||||
// data and will not return any special JavaScript types such as Date, RegExp
|
|
||||||
// or
|
|
||||||
// Function
|
|
||||||
// as we know that all built-in AQL functions are simple but do not know
|
|
||||||
// anything
|
|
||||||
// about user-defined functions, so we expect them to be non-simple
|
|
||||||
bool const isSimple = (!node->callsUserDefinedFunction());
|
|
||||||
|
|
||||||
return new V8Expression(isolate, v8::Handle<v8::Function>::Cast(func),
|
// exit early if an error occurred
|
||||||
constantValues, isSimple);
|
HandleV8Error(tryCatch, func, _buffer, false);
|
||||||
|
|
||||||
|
// a "simple" expression here is any expression that will only return
|
||||||
|
// non-cyclic
|
||||||
|
// data and will not return any special JavaScript types such as Date, RegExp
|
||||||
|
// or
|
||||||
|
// Function
|
||||||
|
// as we know that all built-in AQL functions are simple but do not know
|
||||||
|
// anything
|
||||||
|
// about user-defined functions, so we expect them to be non-simple
|
||||||
|
bool const isSimple = (!node->callsUserDefinedFunction());
|
||||||
|
|
||||||
|
return new V8Expression(isolate, v8::Handle<v8::Function>::Cast(func),
|
||||||
|
constantValues, isSimple);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
v8::Handle<v8::Value> empty;
|
||||||
|
HandleV8Error(tryCatch, empty, _buffer, true);
|
||||||
|
|
||||||
|
// well we're almost sure we never reach this since the above call should throw:
|
||||||
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief executes an expression directly
|
/// @brief executes an expression directly
|
||||||
|
@ -114,43 +127,56 @@ int Executor::executeExpression(Query* query, AstNode const* node,
|
||||||
v8::HandleScope scope(isolate);
|
v8::HandleScope scope(isolate);
|
||||||
v8::TryCatch tryCatch;
|
v8::TryCatch tryCatch;
|
||||||
|
|
||||||
// compile the expression
|
|
||||||
v8::Handle<v8::Value> func(compileExpression());
|
|
||||||
|
|
||||||
// exit early if an error occurred
|
TRI_ASSERT(_buffer != nullptr);
|
||||||
HandleV8Error(tryCatch, func);
|
|
||||||
|
|
||||||
TRI_ASSERT(query != nullptr);
|
v8::Handle<v8::Script> compiled = v8::Script::Compile(
|
||||||
|
TRI_V8_STD_STRING((*_buffer)), TRI_V8_ASCII_STRING("--script--"));
|
||||||
|
|
||||||
TRI_GET_GLOBALS();
|
if (! compiled.IsEmpty()) {
|
||||||
v8::Handle<v8::Value> result;
|
|
||||||
auto old = v8g->_query;
|
|
||||||
|
|
||||||
try {
|
v8::Handle<v8::Value> func(compiled->Run());
|
||||||
v8g->_query = static_cast<void*>(query);
|
|
||||||
TRI_ASSERT(v8g->_query != nullptr);
|
|
||||||
|
|
||||||
// execute the function
|
// exit early if an error occurred
|
||||||
v8::Handle<v8::Value> args[] = { v8::Object::New(isolate), v8::Object::New(isolate) };
|
HandleV8Error(tryCatch, func, _buffer, false);
|
||||||
result = v8::Handle<v8::Function>::Cast(func)
|
|
||||||
->Call(v8::Object::New(isolate), 2, args);
|
|
||||||
|
|
||||||
v8g->_query = old;
|
TRI_ASSERT(query != nullptr);
|
||||||
|
|
||||||
// exit if execution raised an error
|
TRI_GET_GLOBALS();
|
||||||
HandleV8Error(tryCatch, result);
|
v8::Handle<v8::Value> result;
|
||||||
} catch (...) {
|
auto old = v8g->_query;
|
||||||
v8g->_query = old;
|
|
||||||
throw;
|
try {
|
||||||
|
v8g->_query = static_cast<void*>(query);
|
||||||
|
TRI_ASSERT(v8g->_query != nullptr);
|
||||||
|
|
||||||
|
// execute the function
|
||||||
|
v8::Handle<v8::Value> args[] = { v8::Object::New(isolate), v8::Object::New(isolate) };
|
||||||
|
result = v8::Handle<v8::Function>::Cast(func)
|
||||||
|
->Call(v8::Object::New(isolate), 2, args);
|
||||||
|
|
||||||
|
v8g->_query = old;
|
||||||
|
|
||||||
|
// exit if execution raised an error
|
||||||
|
HandleV8Error(tryCatch, result, _buffer, false);
|
||||||
|
} catch (...) {
|
||||||
|
v8g->_query = old;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
if (result->IsUndefined()) {
|
||||||
|
// undefined => null
|
||||||
|
builder.add(VPackValue(VPackValueType::Null));
|
||||||
|
return TRI_ERROR_NO_ERROR;
|
||||||
|
}
|
||||||
|
return TRI_V8ToVPack(isolate, builder, result, false);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
v8::Handle<v8::Value> empty;
|
||||||
|
HandleV8Error(tryCatch, empty, _buffer, true);
|
||||||
|
|
||||||
if (result->IsUndefined()) {
|
// well we're almost sure we never reach this since the above call should throw:
|
||||||
// undefined => null
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
builder.add(VPackValue(VPackValueType::Null));
|
}
|
||||||
return TRI_ERROR_NO_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRI_V8ToVPack(isolate, builder, result, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief returns a reference to a built-in function
|
/// @brief returns a reference to a built-in function
|
||||||
|
@ -277,7 +303,9 @@ v8::Handle<v8::Value> Executor::toV8(v8::Isolate* isolate,
|
||||||
/// @brief checks if a V8 exception has occurred and throws an appropriate C++
|
/// @brief checks if a V8 exception has occurred and throws an appropriate C++
|
||||||
/// exception from it if so
|
/// exception from it if so
|
||||||
void Executor::HandleV8Error(v8::TryCatch& tryCatch,
|
void Executor::HandleV8Error(v8::TryCatch& tryCatch,
|
||||||
v8::Handle<v8::Value>& result) {
|
v8::Handle<v8::Value>& result,
|
||||||
|
arangodb::basics::StringBuffer* const buffer,
|
||||||
|
bool duringCompile) {
|
||||||
ISOLATE;
|
ISOLATE;
|
||||||
|
|
||||||
if (tryCatch.HasCaught()) {
|
if (tryCatch.HasCaught()) {
|
||||||
|
@ -326,6 +354,11 @@ void Executor::HandleV8Error(v8::TryCatch& tryCatch,
|
||||||
// exception is no ArangoError
|
// exception is no ArangoError
|
||||||
std::string details(TRI_ObjectToString(tryCatch.Exception()));
|
std::string details(TRI_ObjectToString(tryCatch.Exception()));
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
std::string script(buffer->c_str(), buffer->length());
|
||||||
|
LOG(ERR) << details << " " << script;
|
||||||
|
details += "\nSee log for more details";
|
||||||
|
}
|
||||||
if (*stacktrace && stacktrace.length() > 0) {
|
if (*stacktrace && stacktrace.length() > 0) {
|
||||||
details += "\nstacktrace of offending AQL function: ";
|
details += "\nstacktrace of offending AQL function: ";
|
||||||
details += *stacktrace;
|
details += *stacktrace;
|
||||||
|
@ -334,35 +367,36 @@ void Executor::HandleV8Error(v8::TryCatch& tryCatch,
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, details);
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string msg("unknown error in scripting");
|
||||||
|
if (duringCompile) {
|
||||||
|
msg += " (during compilation)";
|
||||||
|
}
|
||||||
|
if (buffer) {
|
||||||
|
std::string script(buffer->c_str(), buffer->length());
|
||||||
|
LOG(ERR) << msg << " " << script;
|
||||||
|
msg += " See log for details";
|
||||||
|
}
|
||||||
// we can't figure out what kind of error occurred and throw a generic error
|
// we can't figure out what kind of error occurred and throw a generic error
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
|
||||||
"unknown error in scripting");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.IsEmpty()) {
|
if (result.IsEmpty()) {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
std::string msg("unknown error in scripting");
|
||||||
"unknown error in scripting");
|
if (duringCompile) {
|
||||||
|
msg += " (during compilation)";
|
||||||
|
}
|
||||||
|
if (buffer) {
|
||||||
|
std::string script(buffer->c_str(), buffer->length());
|
||||||
|
LOG(ERR) << msg << " " << script;
|
||||||
|
msg += " See log for details";
|
||||||
|
}
|
||||||
|
|
||||||
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we get here, no exception has been raised
|
// if we get here, no exception has been raised
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief compile a V8 function from the code contained in the buffer
|
|
||||||
v8::Handle<v8::Value> Executor::compileExpression() {
|
|
||||||
TRI_ASSERT(_buffer != nullptr);
|
|
||||||
ISOLATE;
|
|
||||||
|
|
||||||
v8::Handle<v8::Script> compiled = v8::Script::Compile(
|
|
||||||
TRI_V8_STD_STRING((*_buffer)), TRI_V8_ASCII_STRING("--script--"));
|
|
||||||
|
|
||||||
if (compiled.IsEmpty()) {
|
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
|
||||||
"unable to compile v8 expression");
|
|
||||||
}
|
|
||||||
|
|
||||||
return compiled->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief generate JavaScript code for an arbitrary expression
|
/// @brief generate JavaScript code for an arbitrary expression
|
||||||
void Executor::generateCodeExpression(AstNode const* node) {
|
void Executor::generateCodeExpression(AstNode const* node) {
|
||||||
// initialize and/or clear the buffer
|
// initialize and/or clear the buffer
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Executor {
|
||||||
|
|
||||||
/// @brief checks if a V8 exception has occurred and throws an appropriate C++
|
/// @brief checks if a V8 exception has occurred and throws an appropriate C++
|
||||||
/// exception from it if so
|
/// exception from it if so
|
||||||
static void HandleV8Error(v8::TryCatch&, v8::Handle<v8::Value>&);
|
static void HandleV8Error(v8::TryCatch&, v8::Handle<v8::Value>&, arangodb::basics::StringBuffer* const, bool duringCompile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief traverse the expression and note all user-defined functions
|
/// @brief traverse the expression and note all user-defined functions
|
||||||
|
@ -153,9 +153,6 @@ class Executor {
|
||||||
/// @brief create the string buffer
|
/// @brief create the string buffer
|
||||||
arangodb::basics::StringBuffer* initializeBuffer();
|
arangodb::basics::StringBuffer* initializeBuffer();
|
||||||
|
|
||||||
/// @brief compile a V8 function from the code contained in the buffer
|
|
||||||
v8::Handle<v8::Value> compileExpression();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief a string buffer used for operations
|
/// @brief a string buffer used for operations
|
||||||
arangodb::basics::StringBuffer* _buffer;
|
arangodb::basics::StringBuffer* _buffer;
|
||||||
|
|
|
@ -135,7 +135,7 @@ AqlValue V8Expression::execute(v8::Isolate* isolate, Query* query,
|
||||||
|
|
||||||
v8g->_query = old;
|
v8g->_query = old;
|
||||||
|
|
||||||
Executor::HandleV8Error(tryCatch, result);
|
Executor::HandleV8Error(tryCatch, result, nullptr, false);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
v8g->_query = old;
|
v8g->_query = old;
|
||||||
// bubble up exception
|
// bubble up exception
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -2739,4 +2739,4 @@ var cutByResolution = function (str) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="workMonitorContent" class="innerContent">
|
<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 class="arangodbLogo" src="img/arangodb_logo_big.png"></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=1471438286364"></script><script src="app.js?version=1471438286364"></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 class="arangodbLogo" src="img/arangodb_logo_big.png"></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=1472022235976"></script><script src="app.js?version=1472022235976"></script></body></html>
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -824,15 +824,16 @@
|
||||||
this.waitForInit(this.graphManagement.bind(this));
|
this.waitForInit(this.graphManagement.bind(this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.graphManagementView) {
|
if (this.graphManagementView) {
|
||||||
this.graphManagementView =
|
this.graphManagementView.undelegateEvents();
|
||||||
new window.GraphManagementView(
|
|
||||||
{
|
|
||||||
collection: new window.GraphCollection(),
|
|
||||||
collectionCollection: this.arangoCollectionsStore
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
this.graphManagementView =
|
||||||
|
new window.GraphManagementView(
|
||||||
|
{
|
||||||
|
collection: new window.GraphCollection(),
|
||||||
|
collectionCollection: this.arangoCollectionsStore
|
||||||
|
}
|
||||||
|
);
|
||||||
this.graphManagementView.render();
|
this.graphManagementView.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var name = $(e.currentTarget).parent().parent().attr('id');
|
var name = $(e.currentTarget).parent().parent().attr('id');
|
||||||
name = name.substr(0, name.length - 5);
|
name = name.substr(0, name.length - 5);
|
||||||
console.log(name);
|
|
||||||
window.App.navigate('graph2/' + encodeURIComponent(name), {trigger: true});
|
window.App.navigate('graph2/' + encodeURIComponent(name), {trigger: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -241,11 +241,21 @@
|
||||||
'change input[type="color"]': 'checkColor',
|
'change input[type="color"]': 'checkColor',
|
||||||
'change select': 'saveGraphSettings',
|
'change select': 'saveGraphSettings',
|
||||||
'focus #graphSettingsView input': 'lastFocus',
|
'focus #graphSettingsView input': 'lastFocus',
|
||||||
'focus #graphSettingsView select': 'lastFocus'
|
'focus #graphSettingsView select': 'lastFocus',
|
||||||
|
'focusout #graphSettingsView input[type="text"]': 'checkinput'
|
||||||
},
|
},
|
||||||
|
|
||||||
lastFocus: function (e) {
|
lastFocus: function (e) {
|
||||||
this.lastFocussed = e.currentTarget.id;
|
this.lastFocussed = e.currentTarget.id;
|
||||||
|
this.lastFocussedValue = $(e.currentTarget).val();
|
||||||
|
},
|
||||||
|
|
||||||
|
checkinput: function (e) {
|
||||||
|
if (e.currentTarget.id === this.lastFocussed) {
|
||||||
|
if (this.lastFocussedValue !== $(e.currentTarget).val()) {
|
||||||
|
this.saveGraphSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
checkEnterKey: function (e) {
|
checkEnterKey: function (e) {
|
||||||
|
|
|
@ -102,6 +102,10 @@
|
||||||
sigma.classes.graph.addMethod('getNodeEdgesCount', function (id) {
|
sigma.classes.graph.addMethod('getNodeEdgesCount', function (id) {
|
||||||
return this.allNeighborsCount[id];
|
return this.allNeighborsCount[id];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sigma.classes.graph.addMethod('getNodesCount', function () {
|
||||||
|
return this.nodesArray.length;
|
||||||
|
});
|
||||||
} catch (ignore) {}
|
} catch (ignore) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -503,7 +507,6 @@
|
||||||
|
|
||||||
addNode: function () {
|
addNode: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var x = self.addNodeX / 100;
|
var x = self.addNodeX / 100;
|
||||||
var y = self.addNodeY / 100;
|
var y = self.addNodeY / 100;
|
||||||
|
|
||||||
|
@ -518,7 +521,7 @@
|
||||||
self.currentGraph.graph.addNode({
|
self.currentGraph.graph.addNode({
|
||||||
id: id,
|
id: id,
|
||||||
label: id.split('/')[1] || '',
|
label: id.split('/')[1] || '',
|
||||||
size: self.graphConfig.nodeSize || Math.random(),
|
size: self.graphConfig.nodeSize || 15,
|
||||||
color: self.graphConfig.nodeColor || '#2ecc71',
|
color: self.graphConfig.nodeColor || '#2ecc71',
|
||||||
x: x,
|
x: x,
|
||||||
y: y
|
y: y
|
||||||
|
@ -985,7 +988,7 @@
|
||||||
wheel.colors = hotaru;
|
wheel.colors = hotaru;
|
||||||
wheel.multiSelect = false;
|
wheel.multiSelect = false;
|
||||||
wheel.clickModeRotate = false;
|
wheel.clickModeRotate = false;
|
||||||
wheel.sliceHoverAttr = {stroke: '#fff', 'stroke-width': 2};
|
wheel.sliceHoverAttr = {stroke: '#fff', 'stroke-width': 4};
|
||||||
wheel.slicePathFunction = slicePath().DonutSlice;
|
wheel.slicePathFunction = slicePath().DonutSlice;
|
||||||
wheel.createWheel([icon.edit, icon.trash, icon.flag, icon.connect, icon.expand]);
|
wheel.createWheel([icon.edit, icon.trash, icon.flag, icon.connect, icon.expand]);
|
||||||
|
|
||||||
|
@ -1133,8 +1136,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#nodesCount').text(parseInt($('#nodesCount').text()) + newNodeCounter);
|
$('#nodesCount').text(parseInt($('#nodesCount').text(), 10) + newNodeCounter);
|
||||||
$('#edgesCount').text(parseInt($('#edgesCount').text()) + newEdgeCounter);
|
$('#edgesCount').text(parseInt($('#edgesCount').text(), 10) + newEdgeCounter);
|
||||||
|
|
||||||
// rerender graph
|
// rerender graph
|
||||||
if (newNodeCounter > 0 || newEdgeCounter > 0) {
|
if (newNodeCounter > 0 || newEdgeCounter > 0) {
|
||||||
|
@ -1507,18 +1510,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
s.bind('rightClickStage', function (e) {
|
|
||||||
self.addNodeX = e.data.captor.x;
|
|
||||||
self.addNodeY = e.data.captor.y;
|
|
||||||
self.createContextMenu(e);
|
|
||||||
self.clearMouseCanvas();
|
|
||||||
});
|
|
||||||
|
|
||||||
s.bind('rightClickNode', function (e) {
|
|
||||||
var nodeId = e.data.node.id;
|
|
||||||
self.createNodeContextMenu(nodeId, e);
|
|
||||||
});
|
|
||||||
|
|
||||||
s.bind('clickNode', function (e) {
|
s.bind('clickNode', function (e) {
|
||||||
if (self.contextState.createEdge === true) {
|
if (self.contextState.createEdge === true) {
|
||||||
// create the edge
|
// create the edge
|
||||||
|
@ -1531,6 +1522,12 @@
|
||||||
self.addEdgeModal(foundEdgeDefinitions, self.contextState._from, self.contextState._to);
|
self.addEdgeModal(foundEdgeDefinitions, self.contextState._from, self.contextState._to);
|
||||||
} else {
|
} else {
|
||||||
if (!self.dragging) {
|
if (!self.dragging) {
|
||||||
|
if (self.contextState.createEdge === true) {
|
||||||
|
self.newEdgeColor = '#ff0000';
|
||||||
|
} else {
|
||||||
|
self.newEdgeColor = '#000000';
|
||||||
|
}
|
||||||
|
|
||||||
// halo on active nodes:
|
// halo on active nodes:
|
||||||
if (renderer === 'canvas') {
|
if (renderer === 'canvas') {
|
||||||
self.currentGraph.renderers[0].halo({
|
self.currentGraph.renderers[0].halo({
|
||||||
|
@ -1548,34 +1545,42 @@
|
||||||
nodes: [e.data.node]
|
nodes: [e.data.node]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.aqlMode) {
|
||||||
|
self.createNodeContextMenu(e.data.node.id, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
s.bind('clickStage', function () {
|
s.bind('clickStage', function (e) {
|
||||||
self.clearOldContextMenu(true);
|
if (e.data.captor.isDragging) {
|
||||||
self.clearMouseCanvas();
|
self.clearOldContextMenu(true);
|
||||||
s.renderers[0].halo({
|
self.clearMouseCanvas();
|
||||||
nodes: self.activeNodes
|
} else {
|
||||||
});
|
// stage menu
|
||||||
|
if (!$('#nodeContextMenu').is(':visible')) {
|
||||||
|
var offset = $('#graph-container').offset();
|
||||||
|
self.addNodeX = sigma.utils.getX(e) - offset.left / 2;
|
||||||
|
self.addNodeY = sigma.utils.getY(e) - offset.top / 2;
|
||||||
|
// self.addNodeX = e.data.captor.x;
|
||||||
|
// self.addNodeY = e.data.captor.y;
|
||||||
|
self.createContextMenu(e);
|
||||||
|
self.clearMouseCanvas();
|
||||||
|
} else {
|
||||||
|
// cleanup
|
||||||
|
self.clearOldContextMenu(true);
|
||||||
|
self.clearMouseCanvas();
|
||||||
|
}
|
||||||
|
|
||||||
|
// remember halo
|
||||||
|
s.renderers[0].halo({
|
||||||
|
nodes: self.activeNodes
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
s.bind('doubleClickStage', function () {
|
|
||||||
self.activeNodes = [];
|
|
||||||
|
|
||||||
s.graph.nodes().forEach(function (n) {
|
|
||||||
n.color = n.originalColor;
|
|
||||||
});
|
|
||||||
|
|
||||||
s.graph.edges().forEach(function (e) {
|
|
||||||
e.color = e.originalColor;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.nodeInfoDiv').remove();
|
|
||||||
s.refresh();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (renderer === 'canvas') {
|
if (renderer === 'canvas') {
|
||||||
// render parallel edges
|
// render parallel edges
|
||||||
if (this.graphConfig) {
|
if (this.graphConfig) {
|
||||||
|
@ -1584,57 +1589,70 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.bind('overNode', function (e) {
|
|
||||||
if (self.contextState.createEdge === true) {
|
|
||||||
self.newEdgeColor = '#ff0000';
|
|
||||||
} else {
|
|
||||||
self.newEdgeColor = '#000000';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
s.bind('clickEdge', function (e) {
|
s.bind('clickEdge', function (e) {
|
||||||
showAttributes(e, false);
|
showAttributes(e, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
s.bind('doubleClickNode', function (e) {
|
|
||||||
var nodeId = e.data.node.id;
|
|
||||||
var toKeep = s.graph.neighbors(nodeId);
|
|
||||||
toKeep[nodeId] = e.data.node;
|
|
||||||
|
|
||||||
s.graph.nodes().forEach(function (n) {
|
|
||||||
if (toKeep[n.id]) {
|
|
||||||
n.color = n.originalColor;
|
|
||||||
} else {
|
|
||||||
n.color = '#eee';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
s.graph.edges().forEach(function (e) {
|
|
||||||
if (toKeep[e.source] && toKeep[e.target]) {
|
|
||||||
e.color = 'rgb(64, 74, 83)';
|
|
||||||
} else {
|
|
||||||
e.color = '#eee';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
s.refresh();
|
|
||||||
});
|
|
||||||
s.renderers[0].bind('render', function (e) {
|
s.renderers[0].bind('render', function (e) {
|
||||||
s.renderers[0].halo({
|
s.renderers[0].halo({
|
||||||
nodes: self.activeNodes
|
nodes: self.activeNodes
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.aqlMode) {
|
var unhighlightNodes = function () {
|
||||||
s.bind('rightClickNode', function (e) {
|
self.nodeHighlighted = false;
|
||||||
|
if (s.graph.getNodesCount() < 250) {
|
||||||
|
self.activeNodes = [];
|
||||||
|
|
||||||
|
s.graph.nodes().forEach(function (n) {
|
||||||
|
n.color = n.originalColor;
|
||||||
|
});
|
||||||
|
|
||||||
|
s.graph.edges().forEach(function (e) {
|
||||||
|
e.color = e.originalColor;
|
||||||
|
});
|
||||||
|
|
||||||
|
s.refresh({ skipIndexation: true });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
s.bind('rightClickStage', function (e) {
|
||||||
|
unhighlightNodes();
|
||||||
|
self.nodeHighlighted = 'undefinedid';
|
||||||
|
});
|
||||||
|
|
||||||
|
s.bind('rightClickNode', function (e) {
|
||||||
|
if (self.nodeHighlighted !== e.data.node.id) {
|
||||||
var nodeId = e.data.node.id;
|
var nodeId = e.data.node.id;
|
||||||
self.createNodeContextMenu(nodeId, e);
|
var toKeep = s.graph.neighbors(nodeId);
|
||||||
});
|
toKeep[nodeId] = e.data.node;
|
||||||
}
|
|
||||||
|
s.graph.nodes().forEach(function (n) {
|
||||||
|
if (toKeep[n.id]) {
|
||||||
|
n.color = n.originalColor;
|
||||||
|
} else {
|
||||||
|
n.color = '#eee';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
s.graph.edges().forEach(function (e) {
|
||||||
|
if (toKeep[e.source] && toKeep[e.target]) {
|
||||||
|
e.color = 'rgb(64, 74, 83)';
|
||||||
|
} else {
|
||||||
|
e.color = '#eee';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
self.nodeHighlighted = true;
|
||||||
|
s.refresh({ skipIndexation: true });
|
||||||
|
} else {
|
||||||
|
unhighlightNodes();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (this.graphConfig) {
|
if (this.graphConfig) {
|
||||||
if (this.graphConfig.edgeEditable) {
|
if (this.graphConfig.edgeEditable) {
|
||||||
s.bind('rightClickEdge', function (e) {
|
s.bind('clickEdge', function (e) {
|
||||||
var edgeId = e.data.edge.id;
|
var edgeId = e.data.edge.id;
|
||||||
self.createEdgeContextMenu(edgeId, e);
|
self.createEdgeContextMenu(edgeId, e);
|
||||||
});
|
});
|
||||||
|
@ -1792,7 +1810,7 @@
|
||||||
// clear selected nodes state
|
// clear selected nodes state
|
||||||
this.selectedNodes = {};
|
this.selectedNodes = {};
|
||||||
this.activeNodes = [];
|
this.activeNodes = [];
|
||||||
this.currentGraph.refresh();
|
this.currentGraph.refresh({ skipIndexation: true });
|
||||||
} else {
|
} else {
|
||||||
$('#selectNodes').addClass('activated');
|
$('#selectNodes').addClass('activated');
|
||||||
this.graphLasso.activate();
|
this.graphLasso.activate();
|
||||||
|
|
|
@ -549,7 +549,6 @@
|
||||||
// get cached query if available
|
// get cached query if available
|
||||||
var queryObject = this.getCachedQuery();
|
var queryObject = this.getCachedQuery();
|
||||||
var self = this;
|
var self = this;
|
||||||
console.log(queryObject);
|
|
||||||
|
|
||||||
if (queryObject !== null && queryObject !== undefined && queryObject !== '') {
|
if (queryObject !== null && queryObject !== undefined && queryObject !== '') {
|
||||||
this.aqlEditor.setValue(queryObject.query, 1);
|
this.aqlEditor.setValue(queryObject.query, 1);
|
||||||
|
@ -1584,7 +1583,7 @@
|
||||||
window.progressView.hide();
|
window.progressView.hide();
|
||||||
|
|
||||||
var result = self.analyseQuery(data.result);
|
var result = self.analyseQuery(data.result);
|
||||||
console.log('Using ' + result.defaultType + ' as data format.');
|
// console.log('Using ' + result.defaultType + ' as data format.');
|
||||||
if (result.defaultType === 'table') {
|
if (result.defaultType === 'table') {
|
||||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after(
|
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after(
|
||||||
'<div id="outputTable' + counter + '" class="outputTable"></div>'
|
'<div id="outputTable' + counter + '" class="outputTable"></div>'
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
#wheelnav-nodeContextMenu-slice-3,
|
#wheelnav-nodeContextMenu-slice-3,
|
||||||
#wheelnav-nodeContextMenu-slice-4,
|
#wheelnav-nodeContextMenu-slice-4,
|
||||||
#wheelnav-nodeContextMenu-slice-5 {
|
#wheelnav-nodeContextMenu-slice-5 {
|
||||||
opacity: .8;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wheelnav-nodeContextMenu-title-0,
|
#wheelnav-nodeContextMenu-title-0,
|
||||||
|
|
Loading…
Reference in New Issue