mirror of https://gitee.com/bigwinds/arangodb
Bug fix/quotation marks query editor (#4380)
This commit is contained in:
parent
3de120d915
commit
fdc0c62dbc
|
@ -7,6 +7,9 @@ devel
|
|||
superseded by other REST APIs and were partially dysfunctional. Therefore
|
||||
these two endpoints have been removed entirely.
|
||||
|
||||
* fix internal issue #81: quotation marks disappeared when switching table/json
|
||||
editor in the query editor ui
|
||||
|
||||
* fix internal issue #1439: improve performance of any-iterator for RocksDB
|
||||
|
||||
* added option `--rocksdb.throttle` to control whether write-throttling is enabled
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
$('#switchTypes').text('JSON');
|
||||
this.renderBindParamTable();
|
||||
}
|
||||
this.setCachedQuery(this.aqlEditor.getValue(), JSON.stringify(this.bindParamTableObj));
|
||||
} else {
|
||||
arangoHelper.arangoError('Bind parameter', 'Could not parse bind parameter');
|
||||
}
|
||||
|
@ -592,7 +593,7 @@
|
|||
var queryObject = this.getCachedQuery();
|
||||
var self = this;
|
||||
|
||||
if (queryObject !== null && queryObject !== undefined && queryObject !== '') {
|
||||
if (queryObject !== null && queryObject !== undefined && queryObject !== '' && Object.keys(queryObject).length > 0) {
|
||||
this.aqlEditor.setValue(queryObject.query, 1);
|
||||
|
||||
var queryName = localStorage.getItem('lastOpenQuery');
|
||||
|
@ -615,16 +616,7 @@
|
|||
try {
|
||||
// then fill values into input boxes
|
||||
self.bindParamTableObj = JSON.parse(queryObject.parameter);
|
||||
|
||||
var key;
|
||||
_.each($('#arangoBindParamTable input'), function (element) {
|
||||
key = $(element).attr('name');
|
||||
if (typeof self.bindParamTableObj[key] === 'object') {
|
||||
$(element).val(JSON.parse(self.bindParamTableObj[key]));
|
||||
} else {
|
||||
$(element).val(self.bindParamTableObj[key]);
|
||||
}
|
||||
});
|
||||
self.fillBindParamTable(self.bindParamTableObj);
|
||||
|
||||
// resave cached query
|
||||
self.setCachedQuery(self.aqlEditor.getValue(), JSON.stringify(self.bindParamTableObj));
|
||||
|
@ -1073,17 +1065,6 @@
|
|||
'</tr>'
|
||||
);
|
||||
counter++;
|
||||
/* _.each($('#arangoBindParamTable input'), function (element) {
|
||||
if ($(element).attr('name') === key) {
|
||||
if (val instanceof Array) {
|
||||
$(element).val(JSON.stringify(val)).addClass('arraytype');
|
||||
} else if (typeof val === 'object') {
|
||||
$(element).val('' + JSON.stringify(val) + '').addClass(typeof val + 'type');
|
||||
} else {
|
||||
$(element).val(val).addClass(typeof val + 'type');
|
||||
}
|
||||
}
|
||||
});*/
|
||||
});
|
||||
if (counter === 0) {
|
||||
$('#arangoBindParamTable tbody').append(
|
||||
|
@ -1119,8 +1100,23 @@
|
|||
$(element).val(JSON.stringify(val)).addClass('arraytype');
|
||||
} else if (typeof val === 'object') {
|
||||
$(element).val(JSON.stringify(val)).addClass(typeof val + 'type');
|
||||
} else {
|
||||
} else if (typeof val === 'number') {
|
||||
$(element).val(val).addClass(typeof val + 'type');
|
||||
} else {
|
||||
var isNumber = false;
|
||||
// check if a potential string value is a number
|
||||
try {
|
||||
if (typeof JSON.parse(val) === 'number') {
|
||||
isNumber = true;
|
||||
}
|
||||
} catch (ignore) {
|
||||
}
|
||||
|
||||
if (!isNumber) {
|
||||
$(element).val(val).addClass(typeof val + 'type');
|
||||
} else {
|
||||
$(element).val('"' + val + '"').addClass(typeof val + 'type');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue