mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-14 19:21:46 +03:00
Autocomplete on all database objects
This commit is contained in:
parent
e54030dee9
commit
5d2ec70476
File diff suppressed because one or more lines are too long
@ -1,8 +1,9 @@
|
||||
var editor = null;
|
||||
var connected = false;
|
||||
var bookmarks = {};
|
||||
var default_rows_limit = 100;
|
||||
var currentObject = null;
|
||||
var editor = null;
|
||||
var connected = false;
|
||||
var bookmarks = {};
|
||||
var default_rows_limit = 100;
|
||||
var currentObject = null;
|
||||
var autocompleteObjects = [];
|
||||
|
||||
var filterOptions = {
|
||||
"equal": "= 'DATA'",
|
||||
@ -162,6 +163,23 @@ function loadSchemas() {
|
||||
$(".schema").addClass("expanded");
|
||||
}
|
||||
|
||||
// Clear out all autocomplete objects
|
||||
autocompleteObjects = [];
|
||||
for (schema in data) {
|
||||
for (kind in data[schema]) {
|
||||
if (!(kind == "table" || kind == "view" || kind == "materialized_view")) {
|
||||
continue
|
||||
}
|
||||
for (item in data[schema][kind]) {
|
||||
autocompleteObjects.push({
|
||||
caption: data[schema][kind][item],
|
||||
value: data[schema][kind][item],
|
||||
meta: kind
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bindContextMenus();
|
||||
});
|
||||
}
|
||||
@ -712,13 +730,21 @@ function buildTableFilters(name, type) {
|
||||
});
|
||||
}
|
||||
|
||||
var objectAutocompleter = {
|
||||
getCompletions: function (editor, session, pos, prefix, callback) {
|
||||
callback(null, autocompleteObjects);
|
||||
}
|
||||
}
|
||||
|
||||
function initEditor() {
|
||||
var writeQueryTimeout = null;
|
||||
|
||||
editor = ace.edit("custom_query");
|
||||
editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocompletion: true,
|
||||
});
|
||||
editor.completers.push(objectAutocompleter);
|
||||
|
||||
editor.setFontSize(13);
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
|
Loading…
Reference in New Issue
Block a user