Business intelligence made simple
Moved code [skip ci]
Andrew Kane9dc856ef3f80
diff --git a/app/views/blazer/queries/_form.html.erb b/app/views/blazer/queries/_form.html.erbindex 1b2482fa..59a3c6d8 100644--- a/app/views/blazer/queries/_form.html.erb+++ b/app/views/blazer/queries/_form.html.erb@@ -79,7 +79,8 @@const cancelButton = document.getElementById("cancel-button")const results = document.getElementById("results-html")const loading = document.getElementById("loading")- let tablesXhr = null+ let editor+ let tablesXhrfunction getSQL() {const selectedText = editor.getSelectedText()@@ -124,17 +125,6 @@cancelAllQueries()}- runButton.addEventListener("click", run)- cancelButton.addEventListener("click", cancel)-- $(tableSelect).selectize({})- tableSelect.selectize.on("change", function (table) {- editor.setValue(previewStatement[dsSelect.value].replace("{table}", table), 1)- run()- this.clear(true)- this.blur()- })-function updateDataSource() {const dataSource = dsSelect.valuedocument.getElementById("schema-link").setAttribute("href", Routes.schema_queries_path({data_source: dataSource}))@@ -161,14 +151,6 @@})}- updateDataSource()-- $(dsSelect).selectize({})- dsSelect.selectize.on("change", function() {- updateDataSource()- this.blur()- })-function adjustHeight() {// https://stackoverflow.com/questions/11584061/let lines = editor.getSession().getScreenLength()@@ -215,7 +197,24 @@editor.focus()}- showEditor()+ runButton.addEventListener("click", run)+ cancelButton.addEventListener("click", cancel)+ $(tableSelect).selectize({})+ tableSelect.selectize.on("change", function (table) {+ editor.setValue(previewStatement[dsSelect.value].replace("{table}", table), 1)+ run()+ this.clear(true)+ this.blur()+ })++ $(dsSelect).selectize({})+ dsSelect.selectize.on("change", function() {+ updateDataSource()+ this.blur()+ })++ updateDataSource()+ showEditor()show(document.getElementById("app"))<% end %>