mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
b83e83e39b
|
@ -66,7 +66,7 @@
|
|||
"frontend/js/lib/sigma.plugins.lasso.js",
|
||||
"frontend/js/lib/sigma.layout.noverlap.js",
|
||||
"frontend/js/lib/sigma.layout.fruchtermanReingold.js",
|
||||
"frontend/js/lib/sigma.exporters.svg.js",
|
||||
"frontend/js/lib/sigma.exporters.image.js",
|
||||
"frontend/js/lib/sigma.canvas.edges.labels.curve.js",
|
||||
"frontend/js/lib/sigma.canvas.edges.labels.curvedArrow.js",
|
||||
"frontend/js/lib/sigma.canvas.edges.labels.def.js",
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1020,7 +1020,6 @@ if (list.length > 0) {
|
|||
<span class="icon_arangodb_edge5 icon_arangodb_edge5-2 tile-icon"></span>
|
||||
<div class="tileBadge"></div>
|
||||
<h5 class="collectionName"><%=graphName %></h5>
|
||||
<span id="gv2" title="please remove me when final" style="background-color: red; color: white; width: 100px; position: absolute; right: 9px; border-radius: 2px; ">DEV GV2</span>
|
||||
</div>
|
||||
</div> <%});%> </div>
|
||||
</div></script><script id="graphSettingsView.ejs" type="text/template"> <% var genClass = 'pure-u-1-3'; %> <% var genClass2 = 'pure-u-2-3'; %> <% var formatName = function(name) { %> <% var formattedName = %> <% return name.charAt(0).toUpperCase() + string.slice(1);%> <% }; %> <div id="graphSettingsView" class="innerContent">
|
||||
|
@ -1028,20 +1027,20 @@ if (list.length > 0) {
|
|||
<div class="pure-g" style="margin-top: -15px">
|
||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||
|
||||
<div class="pure-g pure-table pure-table-body"> <% _.each(general, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="pure-u-1-1 left heading"><%=val.name%></div> <% } else { %> <div class="<%= genClass %> left">
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i> <%=val.name%> </div>
|
||||
<div class="pure-g pure-table pure-table-body"> <% _.each(general, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="pure-u-1-1 left heading"><%=val.name%></div> <% } else { %> <div class="<%= genClass %> left"> <%=val.name%> </div>
|
||||
<div class="<%= genClass2 %> left"> <% if (val.type === 'select') { %> <select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" id="<%=val %>" value="<%=val.value %>" placeholder=""></input> <% } %> <% if (val.type === 'range') { %> <label id="g_<%=key%>_label" class="rangeLabel">1</label>
|
||||
<input id="g_<%=key%>" type='range' min="0" max="30" val="1"/> <% } %> <% if (val.type === 'color') { %> <input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/> <% } %> </div> <% } %> <% }); %> </div>
|
||||
<input id="g_<%=key%>" type='range' min="0" max="30" val="1"/> <% } %> <% if (val.type === 'color') { %> <input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/> <% } %> <i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
</div> <% } %> <% }); %> </div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||
|
||||
<div class="pure-g pure-table pure-table-body"> <% _.each(specific, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="pure-u-1-1 left heading"><%=val.name%></div> <% } else { %> <div class="<%= genClass %> left">
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i> <%=val.name%> </div>
|
||||
<div class="pure-g pure-table pure-table-body"> <% _.each(specific, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="pure-u-1-1 left heading"><%=val.name%></div> <% } else { %> <div class="<%= genClass %> left"> <%=val.name%> </div>
|
||||
|
||||
<div class="<%= genClass2 %> left"> <% var VALUE; %> <% if (val.value) { %> <% VALUE = val.value %> <% } else { %> <% VALUE = val.default %> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" placeholder="number"></input> <% } %> <% if (val.type === 'color') { %> <input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/> <% } %> <% if (val.type === 'range') { %> <label id="g_<%=key%>_label" class="rangeLabel">1</label>
|
||||
<input id="g_<%=key%>" type='range' min="0" max="30" val="1"/> <% } %> <% if (val.type === 'select') { %> <select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select> <% } %> </div> <% } %> <% }); %> </div>
|
||||
<input id="g_<%=key%>" type='range' min="0" max="30" val="1"/> <% } %> <% if (val.type === 'select') { %> <select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select> <% } %> <i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
</div> <% } %> <% }); %> </div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -2225,7 +2224,7 @@ if (list.length > 0) {
|
|||
<button id="importQuery" class="button-success query-button" style="display:none">Import Queries</button>
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-info query-button">Explain</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove results</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove all results</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -2282,7 +2281,6 @@ if (list.length > 0) {
|
|||
<span id="json-switch" val="JSON" counter="<%=counter%>">JSON</span>
|
||||
<span id="table-switch" val="Table" counter="<%=counter%>" style="display: none">Table</span>
|
||||
<span id="graph-switch" val="Graph" counter="<%=counter%>" style="display: none">Graph</span>
|
||||
<span id="aql-switch" val="AQL" counter="<%=counter%>">AQL</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2712,4 +2710,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 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=1469223326157"></script><script src="app.js?version=1469223326157"></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=1469461944991"></script><script src="app.js?version=1469461944991"></script></body></html>
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -160,6 +160,9 @@
|
|||
content: [{
|
||||
label: 'Execute Query',
|
||||
letter: 'Ctrl/Cmd + Return'
|
||||
}, {
|
||||
label: 'Execute Selected Query',
|
||||
letter: 'Ctrl/Cmd + Alt + Return'
|
||||
}, {
|
||||
label: 'Explain Query',
|
||||
letter: 'Ctrl/Cmd + Shift + Return'
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
;(function(undefined) {
|
||||
'use strict';
|
||||
|
||||
if (typeof sigma === 'undefined')
|
||||
throw 'sigma is not declared';
|
||||
|
||||
// Initialize package:
|
||||
sigma.utils.pkg('sigma.plugins');
|
||||
|
||||
/**
|
||||
* Sigma Image Utility
|
||||
* =============================
|
||||
*
|
||||
* @author: Martin de la Taille (martindelataille)
|
||||
* @thanks: Guillaume Plique (Yomguithereal)
|
||||
* @version: 0.1
|
||||
*/
|
||||
|
||||
var _contexts,
|
||||
_types,
|
||||
_canvas,
|
||||
_canvasContext;
|
||||
|
||||
_contexts = ['scene', 'edges', 'nodes', 'labels'];
|
||||
_types = {
|
||||
png: 'image/png',
|
||||
jpg: 'image/jpeg',
|
||||
gif: 'image/gif',
|
||||
tiff: 'image/tiff'
|
||||
};
|
||||
|
||||
// UTILITIES FUNCTIONS:
|
||||
// ******************
|
||||
function dataURLToBlob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
|
||||
return new Blob([raw], {type: contentType});
|
||||
}
|
||||
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], {type: contentType});
|
||||
}
|
||||
|
||||
function download(dataUrl, extension, filename) {
|
||||
filename = filename || 'graph.' + extension;
|
||||
|
||||
if (navigator.msSaveOrOpenBlob) { // IE10+
|
||||
navigator.msSaveOrOpenBlob(dataURLToBlob(dataUrl), filename);
|
||||
}
|
||||
else if (navigator.msSaveBlob) { // IE11+
|
||||
navigator.msSaveBlob(dataURLToBlob(dataUrl), filename);
|
||||
}
|
||||
else {
|
||||
var anchor = document.createElement('a');
|
||||
anchor.setAttribute('href', dataUrl);
|
||||
anchor.setAttribute('download', filename);
|
||||
|
||||
// Firefox requires the link to be added to the DOM before it can be clicked.
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
document.body.removeChild(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
function calculateAspectRatioFit(srcWidth, srcHeight, maxSize) {
|
||||
var ratio = Math.min(maxSize / srcWidth, maxSize / srcHeight);
|
||||
return { width: srcWidth * ratio, height: srcHeight * ratio };
|
||||
}
|
||||
|
||||
function calculateZoomedBoundaries(s, r, params) {
|
||||
var bounds;
|
||||
|
||||
bounds = sigma.utils.getBoundaries(
|
||||
s.graph,
|
||||
r.camera.readPrefix
|
||||
);
|
||||
|
||||
bounds.minX /= params.zoomRatio;
|
||||
bounds.minY /= params.zoomRatio;
|
||||
bounds.maxX /= params.zoomRatio;
|
||||
bounds.maxY /= params.zoomRatio;
|
||||
|
||||
return bounds;
|
||||
}
|
||||
|
||||
function calculateRatio(s, r, params) {
|
||||
var boundaries,
|
||||
margin = params.margin || 0,
|
||||
ratio = {
|
||||
width: r.width,
|
||||
height: r.height,
|
||||
};
|
||||
|
||||
if (!params.clips && !params.size) {
|
||||
boundaries = calculateZoomedBoundaries(s, r, params);
|
||||
|
||||
ratio = {
|
||||
width: boundaries.maxX - boundaries.minX + boundaries.sizeMax * 2,
|
||||
height: boundaries.maxY - boundaries.minY + boundaries.sizeMax * 2
|
||||
};
|
||||
}
|
||||
else if (params.size && params.size >= 1) {
|
||||
ratio = calculateAspectRatioFit(r.width, r.height, params.size);
|
||||
}
|
||||
|
||||
ratio.width += margin;
|
||||
ratio.height += margin;
|
||||
|
||||
return ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generate a new canvas to download image
|
||||
*
|
||||
* Recognized parameters:
|
||||
* **********************
|
||||
* Here is the exhaustive list of every accepted parameters in the settings
|
||||
* object:
|
||||
* @param {s} sigma instance
|
||||
* @param {params} Options
|
||||
*/
|
||||
function Image(s, r, params) {
|
||||
params = params || {};
|
||||
|
||||
if (params.format && !(params.format in _types))
|
||||
throw Error('sigma.renderers.image: unsupported format "' + params.format + '".');
|
||||
|
||||
var ratio = calculateRatio(s, r, params);
|
||||
var batchEdgesDrawing = s.settings('batchEdgesDrawing');
|
||||
if (batchEdgesDrawing) {
|
||||
s.settings('batchEdgesDrawing', false); // it may crash if true
|
||||
}
|
||||
|
||||
if(!params.clip)
|
||||
this.clone(s, params, ratio);
|
||||
|
||||
var merged = this.draw(r, params, ratio);
|
||||
|
||||
s.settings('batchEdgesDrawing', batchEdgesDrawing); // restore setting
|
||||
|
||||
var dataUrl = merged.toDataURL(_types[params.format || 'png']);
|
||||
|
||||
if(params.download)
|
||||
download(
|
||||
dataUrl,
|
||||
params.format || 'png',
|
||||
params.filename
|
||||
);
|
||||
|
||||
return dataUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {s} sigma instance
|
||||
* @param {params} Options
|
||||
*/
|
||||
Image.prototype.clone = function(s, params, ratio) {
|
||||
params.tmpContainer = params.tmpContainer || 'image-container';
|
||||
|
||||
var pixelRatio = sigma.utils.getPixelRatio();
|
||||
var webglOversamplingRatio = s.settings('webglOversamplingRatio');
|
||||
var el = document.getElementById(params.tmpContainer);
|
||||
|
||||
if (!el) {
|
||||
el = document.createElement("div");
|
||||
el.id = params.tmpContainer;
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
el.setAttribute("style",
|
||||
'width:' + Math.round(ratio.width / pixelRatio) + 'px;' +
|
||||
'height:' + Math.round(ratio.height / pixelRatio) + 'px;');
|
||||
|
||||
var renderer = s.addRenderer({
|
||||
container: document.getElementById(params.tmpContainer),
|
||||
type: 'canvas',
|
||||
settings: {
|
||||
batchEdgesDrawing: true,
|
||||
drawLabels: !!params.labels
|
||||
}
|
||||
});
|
||||
|
||||
renderer.camera.ratio = (params.zoomRatio > 0) ? params.zoomRatio : 1;
|
||||
if (!params.size) {
|
||||
renderer.camera.ratio *= pixelRatio;
|
||||
}
|
||||
|
||||
var webgl = renderer instanceof sigma.renderers.webgl,
|
||||
sized = false,
|
||||
doneContexts = [];
|
||||
|
||||
_canvas = document.createElement('canvas');
|
||||
_canvasContext = _canvas.getContext('2d');
|
||||
|
||||
s.refresh();
|
||||
|
||||
_contexts.forEach(function(name) {
|
||||
if (!renderer.contexts[name])
|
||||
return;
|
||||
|
||||
if (params.labels === false && name === 'labels')
|
||||
return;
|
||||
|
||||
var canvas = renderer.domElements[name] || renderer.domElements.scene,
|
||||
context = renderer.contexts[name];
|
||||
|
||||
if(!sized) {
|
||||
_canvas.width = ratio.width;
|
||||
_canvas.height = ratio.height;
|
||||
|
||||
if (webgl && context instanceof WebGLRenderingContext) {
|
||||
_canvas.width /= webglOversamplingRatio;
|
||||
_canvas.height /= webglOversamplingRatio;
|
||||
}
|
||||
|
||||
sized = true;
|
||||
}
|
||||
|
||||
if (context instanceof WebGLRenderingContext)
|
||||
_canvasContext.drawImage(canvas, 0, 0,
|
||||
canvas.width / webglOversamplingRatio,
|
||||
canvas.height / webglOversamplingRatio
|
||||
);
|
||||
else
|
||||
_canvasContext.drawImage(canvas, 0, 0);
|
||||
|
||||
if (~doneContexts.indexOf(context))
|
||||
return;
|
||||
|
||||
doneContexts.push(context);
|
||||
});
|
||||
|
||||
// Cleaning
|
||||
doneContexts = [];
|
||||
s.killRenderer(renderer);
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {renderer} related renderer instance
|
||||
* @param {params} Options
|
||||
*/
|
||||
Image.prototype.draw = function(r, params, ratio) {
|
||||
var webgl = r instanceof sigma.renderers.webgl,
|
||||
sized = false,
|
||||
doneContexts = [];
|
||||
|
||||
var merged = document.createElement('canvas'),
|
||||
mergedContext= merged.getContext('2d');
|
||||
|
||||
_contexts.forEach(function(name) {
|
||||
if (!r.contexts[name])
|
||||
return;
|
||||
|
||||
if (params.labels === false && name === 'labels')
|
||||
return;
|
||||
|
||||
var canvas = r.domElements[name] || r.domElements.scene,
|
||||
context = r.contexts[name];
|
||||
|
||||
if (~doneContexts.indexOf(context))
|
||||
return;
|
||||
|
||||
if (!sized) {
|
||||
|
||||
var width, height;
|
||||
|
||||
if(!params.clip) {
|
||||
width = _canvas.width;
|
||||
height = _canvas.height;
|
||||
}
|
||||
else {
|
||||
var size = (!params.size || params.size < 1) ? window.innerWidth : params.size;
|
||||
width = canvas.width;
|
||||
height = canvas.height;
|
||||
ratio = calculateAspectRatioFit(width, height, size);
|
||||
}
|
||||
|
||||
merged.width = ratio.width;
|
||||
merged.height = ratio.height;
|
||||
|
||||
if (!webgl && !context instanceof WebGLRenderingContext) {
|
||||
var webglOversamplingRatio = s.settings('webglOversamplingRatio');
|
||||
merged.width *= webglOversamplingRatio;
|
||||
merged.height *= webglOversamplingRatio;
|
||||
}
|
||||
|
||||
sized = true;
|
||||
|
||||
// background color
|
||||
if (params.background) {
|
||||
mergedContext.rect(0, 0, merged.width, merged.height);
|
||||
mergedContext.fillStyle = params.background;
|
||||
mergedContext.fill();
|
||||
}
|
||||
}
|
||||
|
||||
mergedContext.drawImage(
|
||||
(params.clip) ? canvas : _canvas,
|
||||
0,
|
||||
0,
|
||||
merged.width,
|
||||
merged.height
|
||||
);
|
||||
|
||||
doneContexts.push(context);
|
||||
});
|
||||
|
||||
// Cleaning
|
||||
doneContexts = [];
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface
|
||||
* ------------------
|
||||
*/
|
||||
var _instance = null;
|
||||
|
||||
/**
|
||||
* @param {sigma} s The related sigma instance.
|
||||
* @param {renderer} r The related renderer instance.
|
||||
* @param {object} options An object with options.
|
||||
*/
|
||||
sigma.plugins.image = function(s, r, options) {
|
||||
sigma.plugins.killImage();
|
||||
// Create object if undefined
|
||||
if (!_instance) {
|
||||
_instance = new Image(s, r, options);
|
||||
}
|
||||
return _instance;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function kills the image instance.
|
||||
*/
|
||||
sigma.plugins.killImage = function() {
|
||||
if (_instance instanceof Image) {
|
||||
_instance = null;
|
||||
_canvas = null;
|
||||
_canvasContext = null;
|
||||
}
|
||||
};
|
||||
|
||||
}).call(this);
|
|
@ -1,248 +0,0 @@
|
|||
;(function(undefined) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Sigma SVG Exporter
|
||||
* ===================
|
||||
*
|
||||
* This plugin is designed to export a graph to a svg file that can be
|
||||
* downloaded or just used elsewhere.
|
||||
*
|
||||
* Author: Guillaume Plique (Yomguithereal)
|
||||
* Version: 0.0.1
|
||||
*/
|
||||
|
||||
// Terminating if sigma were not to be found
|
||||
if (typeof sigma === 'undefined')
|
||||
throw 'sigma.renderers.snapshot: sigma not in scope.';
|
||||
|
||||
|
||||
/**
|
||||
* Polyfills
|
||||
*/
|
||||
var URL = this.URL || this.webkitURL || this;
|
||||
|
||||
|
||||
/**
|
||||
* Utilities
|
||||
*/
|
||||
function createBlob(data) {
|
||||
return new Blob(
|
||||
[data],
|
||||
{type: 'image/svg+xml;charset=utf-8'}
|
||||
);
|
||||
}
|
||||
|
||||
function download(string, filename) {
|
||||
if (typeof safari !== 'undefined') {
|
||||
var msg = "File download does not work in Safari. Please use a modern web browser such as Firefox, Chrome, or Internet Explorer 11.";
|
||||
alert(msg);
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
// Blob
|
||||
var blob = createBlob(string),
|
||||
objectUrl = window.URL.createObjectURL(blob);
|
||||
|
||||
if (navigator.msSaveBlob) { // IE11+ : (has Blob, but not a[download])
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
} else if (navigator.msSaveOrOpenBlob) { // IE10+ : (has Blob, but not a[download])
|
||||
navigator.msSaveOrOpenBlob(blob, filename);
|
||||
} else {
|
||||
// A-download
|
||||
var anchor = document.createElement('a');
|
||||
anchor.setAttribute('href', objectUrl);
|
||||
anchor.setAttribute('download', filename);
|
||||
|
||||
// Firefox requires the link to be added to the DOM before it can be clicked.
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
document.body.removeChild(anchor);
|
||||
}
|
||||
|
||||
setTimeout(function() { // Firefox needs a timeout
|
||||
window.URL.revokeObjectURL(objectUrl);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defaults
|
||||
*/
|
||||
var DEFAULTS = {
|
||||
size: '1000',
|
||||
width: '1000',
|
||||
height: '1000',
|
||||
margin: 0.05,
|
||||
classes: true,
|
||||
labels: true,
|
||||
data: false,
|
||||
download: false,
|
||||
filename: 'graph.svg'
|
||||
};
|
||||
|
||||
var XMLNS = 'http://www.w3.org/2000/svg';
|
||||
|
||||
|
||||
/**
|
||||
* Subprocesses
|
||||
*/
|
||||
function optimize(svg, prefix, params) {
|
||||
var nodeColorIndex = {},
|
||||
edgeColorIndex = {},
|
||||
count = 0,
|
||||
color,
|
||||
style,
|
||||
styleText = '',
|
||||
f,
|
||||
i,
|
||||
l;
|
||||
|
||||
// Creating style tag if needed
|
||||
if (params.classes) {
|
||||
style = document.createElementNS(XMLNS, 'style');
|
||||
svg.insertBefore(style, svg.firstChild);
|
||||
}
|
||||
|
||||
// Iterating over nodes
|
||||
var nodes = svg.querySelectorAll('[id="' + prefix + '-group-nodes"] > [class="' + prefix + '-node"]');
|
||||
|
||||
for (i = 0, l = nodes.length, f = true; i < l; i++) {
|
||||
color = nodes[i].getAttribute('fill');
|
||||
|
||||
if (!params.data)
|
||||
nodes[i].removeAttribute('data-node-id');
|
||||
|
||||
if (params.classes) {
|
||||
|
||||
if (!(color in nodeColorIndex)) {
|
||||
nodeColorIndex[color] = (f ? prefix + '-node' : 'c-' + (count++));
|
||||
styleText += '.' + nodeColorIndex[color] + '{fill: ' + color + '}';
|
||||
}
|
||||
|
||||
if (nodeColorIndex[color] !== prefix + '-node')
|
||||
nodes[i].setAttribute('class', nodes[i].getAttribute('class') + ' ' + nodeColorIndex[color]);
|
||||
nodes[i].removeAttribute('fill');
|
||||
}
|
||||
|
||||
f = false;
|
||||
}
|
||||
|
||||
// Iterating over edges
|
||||
var edges = svg.querySelectorAll('[id="' + prefix + '-group-edges"] > [class="' + prefix + '-edge"]');
|
||||
|
||||
for (i = 0, l = edges.length, f = true; i < l; i++) {
|
||||
color = edges[i].getAttribute('stroke');
|
||||
|
||||
if (!params.data)
|
||||
edges[i].removeAttribute('data-edge-id');
|
||||
|
||||
if (params.classes) {
|
||||
|
||||
if (!(color in edgeColorIndex)) {
|
||||
edgeColorIndex[color] = (f ? prefix + '-edge' : 'c-' + (count++));
|
||||
styleText += '.' + edgeColorIndex[color] + '{stroke: ' + color + '}';
|
||||
}
|
||||
|
||||
if (edgeColorIndex[color] !== prefix + '-edge')
|
||||
edges[i].setAttribute('class', edges[i].getAttribute('class') + ' ' + edgeColorIndex[color]);
|
||||
edges[i].removeAttribute('stroke');
|
||||
}
|
||||
|
||||
f = false;
|
||||
}
|
||||
|
||||
if (params.classes)
|
||||
style.appendChild(document.createTextNode(styleText));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extending prototype
|
||||
*/
|
||||
sigma.prototype.toSVG = function(params) {
|
||||
params = params || {};
|
||||
|
||||
var prefix = this.settings('classPrefix'),
|
||||
w = params.size || params.width || DEFAULTS.size,
|
||||
h = params.size || params.height || DEFAULTS.size,
|
||||
margin = params.margin || DEFAULTS.margin;
|
||||
|
||||
// Creating a dummy container
|
||||
var container = document.createElement('div');
|
||||
container.setAttribute('width', w);
|
||||
container.setAttribute('height', h);
|
||||
container.setAttribute('style', 'position:absolute; top: 0px; left:0px; width: ' + w + 'px; height: ' + h + 'px;');
|
||||
|
||||
// Add margin to deal with curved edges
|
||||
var sideMargin = this.settings('sideMargin');
|
||||
this.settings('sideMargin', margin);
|
||||
|
||||
// Fit graph to viewport
|
||||
var autoRescale = this.settings('autoRescale');
|
||||
this.settings('autoRescale', true);
|
||||
|
||||
// Creating a camera
|
||||
var camera = this.addCamera();
|
||||
|
||||
// Creating a svg renderer
|
||||
var renderer = this.addRenderer({
|
||||
camera: camera,
|
||||
container: container,
|
||||
type: 'svg',
|
||||
forceLabels: !!params.labels
|
||||
});
|
||||
|
||||
// Refreshing
|
||||
renderer.resize(w, h);
|
||||
this.refresh();
|
||||
|
||||
// Dropping camera and renderers before something nasty happens
|
||||
this.killRenderer(renderer);
|
||||
this.killCamera(camera);
|
||||
|
||||
// reset setting
|
||||
this.settings('sideMargin', sideMargin);
|
||||
this.settings('autoRescale', autoRescale);
|
||||
|
||||
// Retrieving svg
|
||||
var svg = container.querySelector('svg');
|
||||
svg.removeAttribute('style');
|
||||
svg.setAttribute('width', w + 'px');
|
||||
svg.setAttribute('height', h + 'px');
|
||||
svg.setAttribute('x', '0px');
|
||||
svg.setAttribute('y', '0px');
|
||||
// svg.setAttribute('viewBox', '0 0 1000 1000');
|
||||
|
||||
// Dropping labels
|
||||
if (!params.labels) {
|
||||
var labelGroup = svg.querySelector('[id="' + prefix + '-group-labels"]');
|
||||
svg.removeChild(labelGroup);
|
||||
}
|
||||
|
||||
// Dropping hovers
|
||||
var hoverGroup = svg.querySelector('[id="' + prefix + '-group-hovers"]');
|
||||
svg.removeChild(hoverGroup);
|
||||
|
||||
// Optims?
|
||||
params.classes = (params.classes !== false);
|
||||
if (!params.data || params.classes)
|
||||
optimize(svg, prefix, params);
|
||||
|
||||
// Retrieving svg string
|
||||
var svgString = svg.outerHTML;
|
||||
|
||||
// Paranoid cleanup
|
||||
container = null;
|
||||
|
||||
// Output string
|
||||
var output = '<?xml version="1.0" encoding="utf-8"?>\n';
|
||||
output += '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n';
|
||||
output += svgString;
|
||||
|
||||
if (params.download)
|
||||
download(output, params.filename || DEFAULTS.filename);
|
||||
|
||||
return output;
|
||||
};
|
||||
}).call(this);
|
|
@ -61,7 +61,6 @@
|
|||
<span class="icon_arangodb_edge5 icon_arangodb_edge5-2 tile-icon"></span>
|
||||
<div class="tileBadge"></div>
|
||||
<h5 class="collectionName"><%=graphName %></h5>
|
||||
<span id="gv2" title="please remove me when final" style="background-color: red; color: white; width: 100px; position: absolute; right: 9px; border-radius: 2px; ">DEV GV2</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
<div class="pure-u-1-1 left heading"><%=val.name%></div>
|
||||
<% } else { %>
|
||||
<div class="<%= genClass %> left">
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
<%=val.name%>
|
||||
</div>
|
||||
<div class="<%= genClass2 %> left">
|
||||
|
@ -52,6 +51,7 @@
|
|||
<input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/>
|
||||
<% } %>
|
||||
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
|
@ -69,7 +69,6 @@
|
|||
<div class="pure-u-1-1 left heading"><%=val.name%></div>
|
||||
<% } else { %>
|
||||
<div class="<%= genClass %> left">
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
<%=val.name%>
|
||||
</div>
|
||||
|
||||
|
@ -108,7 +107,7 @@
|
|||
<% }); %>
|
||||
</select>
|
||||
<% } %>
|
||||
|
||||
<i title="<%=val.desc%>" class="fa fa-info-circle gv-tooltips" aria-hidden="true"></i>
|
||||
</div>
|
||||
<% } %>
|
||||
<% }); %>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<button id="importQuery" class="button-success query-button" style="display:none">Import Queries</button>
|
||||
<button id="executeQuery" class="button-success query-button">Execute</button>
|
||||
<button id="explainQuery" class="button-info query-button">Explain</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove results</button>
|
||||
<button id="removeResults" class="button-close query-button" style="display: none">Remove all results</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -109,7 +109,6 @@
|
|||
<span id="json-switch" val="JSON" counter="<%=counter%>">JSON</span>
|
||||
<span id="table-switch" val="Table" counter="<%=counter%>" style="display: none">Table</span>
|
||||
<span id="graph-switch" val="Graph" counter="<%=counter%>" style="display: none">Graph</span>
|
||||
<span id="aql-switch" val="AQL" counter="<%=counter%>">AQL</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* jshint browser: true */
|
||||
/* jshint unused: false */
|
||||
/* global Backbone, $, window, arangoHelper, templateEngine, JSONEditor */
|
||||
/* global Backbone, $, localStorage, window, arangoHelper, templateEngine, JSONEditor */
|
||||
/* global document, _ */
|
||||
|
||||
(function () {
|
||||
|
@ -41,6 +41,13 @@
|
|||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
var mode = localStorage.getItem('JSONEditorMode');
|
||||
if (mode) {
|
||||
this.defaultMode = mode;
|
||||
}
|
||||
},
|
||||
|
||||
addDocument: function () {
|
||||
window.App.documentsView.addDocumentModal();
|
||||
},
|
||||
|
@ -49,7 +56,9 @@
|
|||
var self = this;
|
||||
|
||||
$('.type-modes').on('click', function (elem) {
|
||||
self.defaultMode = $(elem.currentTarget).text().toLowerCase();
|
||||
var mode = $(elem.currentTarget).text().toLowerCase();
|
||||
localStorage.setItem('JSONEditorMode', mode);
|
||||
self.defaultMode = mode;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
redirectToGraphViewer: function (e) {
|
||||
var name = $(e.currentTarget).attr('id');
|
||||
name = name.substr(0, name.length - 5);
|
||||
window.location = window.location + '/' + encodeURIComponent(name);
|
||||
window.location.hash = window.location.hash.substr(0, window.location.hash.length - 1) + '2/' + encodeURIComponent(name);
|
||||
},
|
||||
|
||||
// please remove this when gv2 is launched
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
'layout': {
|
||||
type: 'select',
|
||||
name: 'Layout algorithm',
|
||||
desc: 'Different graph displaying algorithms. No overlap is very fast, force is slower and fruchtermann is the slowest. The calculation time strongly depends on your nodes and edges counts.',
|
||||
desc: 'Different graph algorithms. No overlap is very fast, force is slower and fruchtermann is the slowest. The calculation time strongly depends on your nodes and edges counts.',
|
||||
noverlap: {
|
||||
name: 'No overlap',
|
||||
val: 'noverlap'
|
||||
|
@ -77,13 +77,13 @@
|
|||
type: 'select',
|
||||
name: 'Label by coll?',
|
||||
desc: 'Set label text by collection. If activated node label attribute will be ignored.',
|
||||
no: {
|
||||
name: 'No',
|
||||
val: 'false'
|
||||
},
|
||||
yes: {
|
||||
name: 'Yes',
|
||||
val: 'true'
|
||||
},
|
||||
no: {
|
||||
name: 'No',
|
||||
val: 'false'
|
||||
}
|
||||
},
|
||||
'nodeLabelThreshold': {
|
||||
|
@ -134,13 +134,13 @@
|
|||
type: 'select',
|
||||
name: 'Label by coll?',
|
||||
desc: 'Set label text by collection. If activated edge label attribute will be ignored.',
|
||||
no: {
|
||||
name: 'No',
|
||||
val: 'false'
|
||||
},
|
||||
yes: {
|
||||
name: 'Yes',
|
||||
val: 'true'
|
||||
},
|
||||
no: {
|
||||
name: 'No',
|
||||
val: 'false'
|
||||
}
|
||||
},
|
||||
'edgeLabelThreshold': {
|
||||
|
@ -326,8 +326,8 @@
|
|||
edgeType: 'line',
|
||||
nodeSize: '',
|
||||
edgeEditable: 'false',
|
||||
nodeLabelByCollection: 'false',
|
||||
edgeLabelByCollection: 'false',
|
||||
nodeLabelByCollection: 'true',
|
||||
edgeLabelByCollection: 'true',
|
||||
nodeStart: ''
|
||||
};
|
||||
this.saveGraphSettings(null, null, null, obj);
|
||||
|
|
|
@ -101,12 +101,12 @@
|
|||
},
|
||||
|
||||
downloadSVG: function () {
|
||||
var self = this;
|
||||
|
||||
this.currentGraph.toSVG({
|
||||
var size = parseInt($('#graph-container').width(), 10);
|
||||
sigma.plugins.image(this.currentGraph, this.currentGraph.renderers[0], {
|
||||
download: true,
|
||||
filename: self.name + '.svg',
|
||||
size: 1000
|
||||
size: size,
|
||||
background: 'white',
|
||||
zoom: true
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -340,7 +340,7 @@
|
|||
this.cursorY = e.y;
|
||||
},
|
||||
|
||||
deleteNode: function (id) {
|
||||
deleteNode: function (e, id) {
|
||||
var self = this;
|
||||
var documentKey;
|
||||
var collectionId;
|
||||
|
@ -393,7 +393,7 @@
|
|||
try {
|
||||
var arr = JSON.parse($('#delete-nodes-arr-id').text());
|
||||
_.each(arr, function (id) {
|
||||
self.deleteNode(id);
|
||||
self.deleteNode(null, id);
|
||||
});
|
||||
} catch (ignore) {
|
||||
}
|
||||
|
@ -465,6 +465,9 @@
|
|||
addNode: function () {
|
||||
var self = this;
|
||||
|
||||
var x = self.addNodeX / 100;
|
||||
var y = self.addNodeY / 100;
|
||||
|
||||
var collectionId = $('.modal-body #new-node-collection-attr').val();
|
||||
var key = $('.modal-body #new-node-key-attr').last().val();
|
||||
|
||||
|
@ -477,8 +480,8 @@
|
|||
label: id.split('/')[1] || '',
|
||||
size: self.graphConfig.nodeSize || Math.random(),
|
||||
color: self.graphConfig.nodeColor || '#2ecc71',
|
||||
x: self.cursorX,
|
||||
y: self.cursorY
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
|
||||
window.modalView.hide();
|
||||
|
@ -961,7 +964,7 @@
|
|||
};
|
||||
|
||||
$('#nodeContextMenu').css('left', x + 115);
|
||||
$('#nodeContextMenu').css('top', y + 72);
|
||||
$('#nodeContextMenu').css('top', y + 71);
|
||||
$('#nodeContextMenu').width(100);
|
||||
$('#nodeContextMenu').height(100);
|
||||
|
||||
|
@ -1098,7 +1101,6 @@
|
|||
|
||||
renderGraph: function (graph, toFocus) {
|
||||
var self = this;
|
||||
console.log(graph);
|
||||
|
||||
this.graphSettings = graph.settings;
|
||||
|
||||
|
@ -1147,7 +1149,7 @@
|
|||
|
||||
var settings = {
|
||||
doubleClickEnabled: false,
|
||||
minNodeSize: 3.5,
|
||||
minNodeSize: 20,
|
||||
minEdgeSize: 1,
|
||||
maxEdgeSize: 4,
|
||||
enableEdgeHovering: true,
|
||||
|
@ -1156,13 +1158,12 @@
|
|||
defaultEdgeType: 'line',
|
||||
edgeHoverSizeRatio: 2,
|
||||
edgeHoverExtremities: true,
|
||||
nodesPowRatio: 1,
|
||||
// lasso settings
|
||||
autoRescale: true,
|
||||
mouseEnabled: true,
|
||||
touchEnabled: true,
|
||||
nodesPowRatio: 1,
|
||||
font: 'Roboto',
|
||||
edgesPowRatio: 1
|
||||
font: 'Roboto'
|
||||
};
|
||||
|
||||
if (renderer === 'canvas') {
|
||||
|
@ -1262,51 +1263,47 @@
|
|||
|
||||
if (!self.aqlMode) {
|
||||
s.bind('rightClickStage', function (e) {
|
||||
self.addNodeX = e.data.captor.x;
|
||||
self.addNodeY = e.data.captor.y;
|
||||
self.createContextMenu(e);
|
||||
self.clearMouseCanvas();
|
||||
});
|
||||
}
|
||||
|
||||
s.bind('overNode', function (e) {
|
||||
var showAttributes = function (e, node) {
|
||||
$('.nodeInfoDiv').remove();
|
||||
|
||||
if (self.contextState.createEdge === false) {
|
||||
var callback = function (error, data) {
|
||||
if (!error) {
|
||||
var obj = {};
|
||||
var counter = 0;
|
||||
var more = false;
|
||||
|
||||
_.each(data, function (val, key) {
|
||||
if (counter < 15) {
|
||||
if (typeof val === 'string') {
|
||||
if (val.length > 10) {
|
||||
obj[key] = val.substr(0, 15) + ' ...';
|
||||
} else {
|
||||
obj[key] = val;
|
||||
}
|
||||
if (window.location.hash.indexOf('graph') > -1) {
|
||||
var callback = function (error, data) {
|
||||
if (!error) {
|
||||
var attributes = '';
|
||||
_.each(data, function (value, key) {
|
||||
if (key !== '_key' && key !== '_id' && key !== '_rev' && key !== '_from' && key !== '_to') {
|
||||
attributes += ('<span class="nodeAttribute">' + key + '</span>');
|
||||
}
|
||||
} else {
|
||||
more = true;
|
||||
}
|
||||
counter++;
|
||||
});
|
||||
});
|
||||
var string = '<div id="nodeInfoDiv" class="nodeInfoDiv">' + attributes + '</div>';
|
||||
|
||||
var string = '<div id="nodeInfoDiv" class="nodeInfoDiv">' +
|
||||
'<pre>' + JSON.stringify(obj, null, 2);
|
||||
|
||||
if (more) {
|
||||
string = string.substr(0, string.length - 2);
|
||||
string += ' \n\n ... \n\n } </pre></div>';
|
||||
} else {
|
||||
string += '</pre></div>';
|
||||
$(self.el).append(string);
|
||||
}
|
||||
};
|
||||
|
||||
$(self.el).append(string);
|
||||
if (node) {
|
||||
self.documentStore.getDocument(e.data.node.id.split('/')[0], e.data.node.id.split('/')[1], callback);
|
||||
} else {
|
||||
self.documentStore.getDocument(e.data.edge.id.split('/')[0], e.data.edge.id.split('/')[1], callback);
|
||||
}
|
||||
};
|
||||
|
||||
self.documentStore.getDocument(e.data.node.id.split('/')[0], e.data.node.id.split('/')[1], callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
s.bind('overNode', function (e) {
|
||||
showAttributes(e, true);
|
||||
});
|
||||
|
||||
s.bind('overEdge', function (e) {
|
||||
showAttributes(e, false);
|
||||
});
|
||||
|
||||
s.bind('outNode', function (e) {
|
||||
|
@ -1315,6 +1312,12 @@
|
|||
}
|
||||
});
|
||||
|
||||
s.bind('outEdge', function (e) {
|
||||
if (self.contextState.createEdge === false) {
|
||||
$('.nodeInfoDiv').remove();
|
||||
}
|
||||
});
|
||||
|
||||
s.bind('clickNode', function (e) {
|
||||
if (self.contextState.createEdge === true) {
|
||||
// create the edge
|
||||
|
@ -1469,6 +1472,21 @@
|
|||
}
|
||||
// clear up info div
|
||||
$('#calculatingGraph').remove();
|
||||
|
||||
// make nodes a bit bigger
|
||||
var maxNodeSize = s.settings('maxNodeSize');
|
||||
var factor = 1;
|
||||
var length = s.graph.nodes().length;
|
||||
|
||||
if (length < 100) {
|
||||
factor = 2.5;
|
||||
} else if (length < 1000) {
|
||||
factor = 0.7;
|
||||
}
|
||||
|
||||
maxNodeSize = maxNodeSize * factor;
|
||||
s.settings('maxNodeSize', maxNodeSize);
|
||||
s.refresh();
|
||||
},
|
||||
|
||||
keyUpFunction: function (event) {
|
||||
|
|
|
@ -375,13 +375,6 @@
|
|||
if (string === 'JSON') {
|
||||
$('#outputEditor' + count).show();
|
||||
|
||||
$('#sentWrapper' + count).hide();
|
||||
$('#outputGraph' + count).hide();
|
||||
$('#outputTable' + count).hide();
|
||||
} else if (string === 'AQL') {
|
||||
$('#sentWrapper' + count).show();
|
||||
|
||||
$('#outputEditor' + count).hide();
|
||||
$('#outputGraph' + count).hide();
|
||||
$('#outputTable' + count).hide();
|
||||
} else if (string === 'Table') {
|
||||
|
@ -389,13 +382,11 @@
|
|||
|
||||
$('#outputGraph' + count).hide();
|
||||
$('#outputEditor' + count).hide();
|
||||
$('#sentWrapper' + count).hide();
|
||||
} else if (string === 'Graph') {
|
||||
$('#outputGraph' + count).show();
|
||||
|
||||
$('#outputTable' + count).hide();
|
||||
$('#outputEditor' + count).hide();
|
||||
$('#sentWrapper' + count).hide();
|
||||
}
|
||||
|
||||
// deselect editors
|
||||
|
@ -1004,6 +995,14 @@
|
|||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: 'executeSelectedQuery',
|
||||
bindKey: {win: 'Ctrl-Alt-Return', mac: 'Command-Alt-Return', linux: 'Ctrl-Alt-Return'},
|
||||
exec: function () {
|
||||
self.executeQuery(true);
|
||||
}
|
||||
});
|
||||
|
||||
this.aqlEditor.commands.addCommand({
|
||||
name: 'saveQuery',
|
||||
bindKey: {win: 'Ctrl-Shift-S', mac: 'Command-Shift-S', linux: 'Ctrl-Shift-S'},
|
||||
|
@ -1257,7 +1256,7 @@
|
|||
return quit;
|
||||
},
|
||||
|
||||
executeQuery: function () {
|
||||
executeQuery: function (selected) {
|
||||
if (this.verifyQueryAndParams()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1294,45 +1293,39 @@
|
|||
sentBindParamEditor.setReadOnly(true);
|
||||
this.setEditorAutoHeight(sentBindParamEditor);
|
||||
|
||||
this.fillResult(outputEditor, sentQueryEditor, counter);
|
||||
this.fillResult(outputEditor, sentQueryEditor, counter, selected);
|
||||
this.outputCounter++;
|
||||
},
|
||||
|
||||
readQueryData: function () {
|
||||
readQueryData: function (selected) {
|
||||
// var selectedText = this.aqlEditor.session.getTextRange(this.aqlEditor.getSelectionRange())
|
||||
var sizeBox = $('#querySize');
|
||||
var data = {
|
||||
query: this.aqlEditor.getValue(),
|
||||
id: 'currentFrontendQuery'
|
||||
};
|
||||
|
||||
if (selected) {
|
||||
data.query = this.aqlEditor.getSelectedText();
|
||||
} else {
|
||||
data.query = this.aqlEditor.getValue();
|
||||
}
|
||||
|
||||
if (sizeBox.val() === 'all') {
|
||||
data.batchSize = 1000000;
|
||||
} else {
|
||||
data.batchSize = parseInt(sizeBox.val(), 10);
|
||||
}
|
||||
|
||||
// var parsedBindVars = {}, tmpVar
|
||||
if (Object.keys(this.bindParamTableObj).length > 0) {
|
||||
/*
|
||||
_.each(this.bindParamTableObj, function(value, key) {
|
||||
try {
|
||||
tmpVar = JSON.parse(value)
|
||||
}
|
||||
catch (e) {
|
||||
tmpVar = value
|
||||
}
|
||||
parsedBindVars[key] = tmpVar
|
||||
});*/
|
||||
data.bindVars = this.bindParamTableObj;
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
},
|
||||
|
||||
fillResult: function (outputEditor, sentQueryEditor, counter) {
|
||||
fillResult: function (outputEditor, sentQueryEditor, counter, selected) {
|
||||
var self = this;
|
||||
|
||||
var queryData = this.readQueryData();
|
||||
var queryData = this.readQueryData(selected);
|
||||
|
||||
if (queryData) {
|
||||
sentQueryEditor.setValue(self.aqlEditor.getValue(), 1);
|
||||
|
|
|
@ -44,19 +44,22 @@
|
|||
}
|
||||
|
||||
.nodeInfoDiv {
|
||||
left: 175px;
|
||||
border-radius: 3px;
|
||||
bottom: 0;
|
||||
height: 25px;
|
||||
left: 165px;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
top: 130px;
|
||||
right: 15px;
|
||||
z-index: 10;
|
||||
|
||||
pre {
|
||||
background-color: rgba(64, 74, 83, .9);
|
||||
border-radius: 2px;
|
||||
.nodeAttribute {
|
||||
background-color: $c-info-blue;
|
||||
border-radius: 3px;
|
||||
color: $c-white;
|
||||
max-height: 400px;
|
||||
max-width: 330px;
|
||||
overflow: hidden;
|
||||
font-weight: 100;
|
||||
margin-right: 5px;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,6 +119,14 @@
|
|||
color: $c-black;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 216px;
|
||||
}
|
||||
|
||||
.left {
|
||||
color: $c-white;
|
||||
height: 40px;
|
||||
|
@ -127,6 +138,14 @@
|
|||
|
||||
.pure-u-2-3 {
|
||||
text-align: right;
|
||||
|
||||
.fa-info-circle {
|
||||
float: right;
|
||||
font-size: 14pt;
|
||||
margin-right: 0;
|
||||
margin-top: 7px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.heading {
|
||||
|
@ -137,7 +156,7 @@
|
|||
|
||||
.rangeLabel {
|
||||
float: left;
|
||||
margin-left: 4px;
|
||||
margin-left: 0;
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
|
|
@ -381,9 +381,10 @@
|
|||
border-radius: 3px;
|
||||
color: $c-white;
|
||||
cursor: pointer;
|
||||
padding: 4px 3px;
|
||||
position: relative;
|
||||
right: -24px;
|
||||
top: 45px;
|
||||
right: -6px;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
|
||||
span {
|
||||
|
|
Loading…
Reference in New Issue