mirror of https://gitee.com/bigwinds/arangodb
ui - cacheable explain
This commit is contained in:
parent
49b200aab4
commit
c288e65a06
|
@ -526,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();
|
||||
|
@ -699,7 +702,10 @@
|
|||
self.renderQueryResultBox(counter, null, true);
|
||||
self.renderQueryResult(query, counter, true);
|
||||
self.fillSentQueryValue(counter);
|
||||
self.bindQueryResultButtons(null, counter);
|
||||
|
||||
if (query.sentQuery) {
|
||||
self.bindQueryResultButtons(null, counter);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -1590,84 +1596,91 @@
|
|||
var self = this;
|
||||
var outputEditor = ace.edit('outputEditor' + counter);
|
||||
|
||||
self.warningsFunc(data, outputEditor);
|
||||
window.progressView.hide();
|
||||
// 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') {
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after(
|
||||
'<div id="outputTable' + counter + '" class="outputTable"></div>'
|
||||
);
|
||||
$('#outputTable' + counter).show();
|
||||
self.renderOutputTable(result, counter);
|
||||
|
||||
var result = self.analyseQuery(data.result);
|
||||
// console.log('Using ' + result.defaultType + ' as data format.');
|
||||
if (result.defaultType === 'table') {
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after(
|
||||
'<div id="outputTable' + counter + '" class="outputTable"></div>'
|
||||
);
|
||||
$('#outputTable' + counter).show();
|
||||
self.renderOutputTable(result, counter);
|
||||
// apply max height for table output dynamically
|
||||
var maxHeight = $('.centralRow').height() - 250;
|
||||
$('.outputEditorWrapper .tableWrapper').css('max-height', maxHeight);
|
||||
|
||||
// apply max height for table output dynamically
|
||||
var maxHeight = $('.centralRow').height() - 250;
|
||||
$('.outputEditorWrapper .tableWrapper').css('max-height', maxHeight);
|
||||
$('#outputEditor' + counter).hide();
|
||||
} else if (result.defaultType === 'graph') {
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after('<div id="outputGraph' + counter + '"></div>');
|
||||
$('#outputGraph' + counter).show();
|
||||
self.renderOutputGraph(result, counter);
|
||||
|
||||
$('#outputEditor' + counter).hide();
|
||||
} else if (result.defaultType === 'graph') {
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop').after('<div id="outputGraph' + counter + '"></div>');
|
||||
$('#outputGraph' + counter).show();
|
||||
self.renderOutputGraph(result, counter);
|
||||
|
||||
$('#outputEditor' + counter).hide();
|
||||
}
|
||||
|
||||
// add active class to choosen display method
|
||||
$('#' + result.defaultType + '-switch').addClass('active').css('display', 'inline');
|
||||
|
||||
var appendSpan = function (value, icon, css) {
|
||||
if (!css) {
|
||||
css = '';
|
||||
}
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop .pull-left').append(
|
||||
'<span class="' + css + '"><i class="fa ' + icon + '"></i><i class="iconText">' + value + '</i></span>'
|
||||
);
|
||||
};
|
||||
|
||||
$('#outputEditorWrapper' + counter + ' .pull-left #spinner').remove();
|
||||
|
||||
var time = '-';
|
||||
if (data && data.extra && data.extra.stats) {
|
||||
time = data.extra.stats.executionTime.toFixed(3) + ' s';
|
||||
}
|
||||
appendSpan(
|
||||
data.result.length + ' elements', 'fa-calculator'
|
||||
);
|
||||
appendSpan(time, 'fa-clock-o');
|
||||
|
||||
if (data.extra) {
|
||||
if (data.extra.profile) {
|
||||
appendSpan('', 'fa-caret-down');
|
||||
self.appendProfileDetails(counter, data.extra.profile);
|
||||
$('#outputEditor' + counter).hide();
|
||||
}
|
||||
|
||||
if (data.extra.stats) {
|
||||
if (data.extra.stats.writesExecuted > 0 || data.extra.stats.writesIgnored > 0) {
|
||||
appendSpan(
|
||||
data.extra.stats.writesExecuted + ' writes', 'fa-check-circle positive'
|
||||
);
|
||||
if (data.extra.stats.writesIgnored === 0) {
|
||||
// add active class to choosen display method
|
||||
$('#' + result.defaultType + '-switch').addClass('active').css('display', 'inline');
|
||||
|
||||
var appendSpan = function (value, icon, css) {
|
||||
if (!css) {
|
||||
css = '';
|
||||
}
|
||||
$('#outputEditorWrapper' + counter + ' .arangoToolbarTop .pull-left').append(
|
||||
'<span class="' + css + '"><i class="fa ' + icon + '"></i><i class="iconText">' + value + '</i></span>'
|
||||
);
|
||||
};
|
||||
|
||||
var time = '-';
|
||||
if (data && data.extra && data.extra.stats) {
|
||||
time = data.extra.stats.executionTime.toFixed(3) + ' s';
|
||||
}
|
||||
appendSpan(
|
||||
data.result.length + ' elements', 'fa-calculator'
|
||||
);
|
||||
appendSpan(time, 'fa-clock-o');
|
||||
|
||||
if (data.extra) {
|
||||
if (data.extra.profile) {
|
||||
appendSpan('', 'fa-caret-down');
|
||||
self.appendProfileDetails(counter, data.extra.profile);
|
||||
}
|
||||
|
||||
if (data.extra.stats) {
|
||||
if (data.extra.stats.writesExecuted > 0 || data.extra.stats.writesIgnored > 0) {
|
||||
appendSpan(
|
||||
data.extra.stats.writesIgnored + ' writes ignored', 'fa-check-circle positive', 'additional'
|
||||
);
|
||||
} else {
|
||||
appendSpan(
|
||||
data.extra.stats.writesIgnored + ' writes ignored', 'fa-exclamation-circle warning', 'additional'
|
||||
data.extra.stats.writesExecuted + ' writes', 'fa-check-circle positive'
|
||||
);
|
||||
if (data.extra.stats.writesIgnored === 0) {
|
||||
appendSpan(
|
||||
data.extra.stats.writesIgnored + ' writes ignored', 'fa-check-circle positive', 'additional'
|
||||
);
|
||||
} else {
|
||||
appendSpan(
|
||||
data.extra.stats.writesIgnored + ' writes ignored', 'fa-exclamation-circle warning', 'additional'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#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');
|
||||
$('#outputEditorWrapper' + counter + ' #downloadQueryResult').show();
|
||||
$('#outputEditorWrapper' + counter + ' #copy2aqlEditor').show();
|
||||
$('#outputEditorWrapper' + counter + ' #cancelCurrentQuery').remove();
|
||||
|
||||
if (!data.msg) {
|
||||
$('#outputEditorWrapper' + counter + ' #downloadQueryResult').show();
|
||||
$('#outputEditorWrapper' + counter + ' #copy2aqlEditor').show();
|
||||
}
|
||||
|
||||
self.setEditorAutoHeight(outputEditor);
|
||||
self.deselect(outputEditor);
|
||||
|
@ -1687,6 +1700,11 @@
|
|||
// 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) {
|
||||
|
|
Loading…
Reference in New Issue