Write current sql query after input query change
This commit is contained in:
parent
fb13ce8b07
commit
639ca96caa
File diff suppressed because one or more lines are too long
@ -291,9 +291,6 @@ function runQuery() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Automatically save last executed query so its not lost
|
||||
localStorage.setItem("pgweb_query", query);
|
||||
|
||||
executeQuery(query, function(data) {
|
||||
buildTable(data);
|
||||
|
||||
@ -358,6 +355,7 @@ function exportToCSV() {
|
||||
}
|
||||
|
||||
function initEditor() {
|
||||
var writeQueryTimeout = null;
|
||||
editor = ace.edit("custom_query");
|
||||
|
||||
editor.getSession().setMode("ace/mode/pgsql");
|
||||
@ -384,6 +382,16 @@ function initEditor() {
|
||||
}
|
||||
}]);
|
||||
|
||||
editor.on("change", function() {
|
||||
if (writeQueryTimeout) {
|
||||
clearTimeout(writeQueryTimeout);
|
||||
}
|
||||
|
||||
writeQueryTimeout = setTimeout(function() {
|
||||
localStorage.setItem("pgweb_query", editor.getValue());
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
var query = localStorage.getItem("pgweb_query");
|
||||
if (query && query.length > 0) {
|
||||
editor.setValue(query);
|
||||
|
Loading…
x
Reference in New Issue
Block a user