mirror of
https://github.com/apache/superset.git
synced 2026-04-23 01:55:09 +00:00
Getting the back button to work
This commit is contained in:
@@ -49,6 +49,12 @@ var px = (function() {
|
||||
var visualizations = {};
|
||||
var dashboard = undefined;
|
||||
|
||||
function getParam(name) {
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function UTC(dttm){
|
||||
return v = new Date(dttm.getUTCFullYear(), dttm.getUTCMonth(), dttm.getUTCDate(), dttm.getUTCHours(), dttm.getUTCMinutes(), dttm.getUTCSeconds());
|
||||
@@ -333,12 +339,6 @@ var px = (function() {
|
||||
for(var i=0; i < collapsed_fieldsets.length; i++){
|
||||
toggle_fieldset($('legend:contains("' + collapsed_fieldsets[i] + '")'), false);
|
||||
}
|
||||
function getParam(name) {
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
$(".select2").select2({dropdownAutoWidth : true});
|
||||
$(".select2Sortable").select2({dropdownAutoWidth : true});
|
||||
@@ -445,6 +445,8 @@ var px = (function() {
|
||||
|
||||
function initSqlEditorView() {
|
||||
var editor = ace.edit("sql");
|
||||
editor.$blockScrolling = Infinity
|
||||
|
||||
var textarea = $('#sql').hide();
|
||||
editor.setTheme("ace/theme/crimson_editor");
|
||||
editor.setOptions({
|
||||
@@ -453,7 +455,6 @@ var px = (function() {
|
||||
});
|
||||
editor.getSession().setMode("ace/mode/sql");
|
||||
editor.focus();
|
||||
|
||||
$("select").select2({dropdownAutoWidth : true});
|
||||
function showTableMetadata() {
|
||||
$(".metadata").load('/panoramix/table/' + $("#dbtable").val() + '/');
|
||||
@@ -468,10 +469,19 @@ var px = (function() {
|
||||
editor.setValue(msg);
|
||||
});
|
||||
});
|
||||
$("#select_star").click();
|
||||
editor.setValue(getParam('sql'));
|
||||
$(window).bind("popstate", function(event) {
|
||||
// Browser back button
|
||||
var returnLocation = history.location || document.location;
|
||||
// Could do something more lightweight here, but we're not optimizing
|
||||
// for the use of the back button anyways
|
||||
editor.setValue(getParam('sql'));
|
||||
$("#run").click();
|
||||
});
|
||||
$("#run").click(function() {
|
||||
$('#results').hide(0);
|
||||
$('#loading').show(0);
|
||||
history.pushState({}, document.title, '?sql=' + encodeURIComponent(editor.getValue()));
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/panoramix/runsql/',
|
||||
|
||||
@@ -72,8 +72,7 @@
|
||||
</div>
|
||||
<div class="topsql row">
|
||||
<div class="col-xs-7 fillheight">
|
||||
<textarea id="sql" class="fillup">SELECT * FROM information_schema.tables;
|
||||
</textarea>
|
||||
<textarea id="sql" class="fillup"></textarea>
|
||||
</div>
|
||||
<div class="col-xs-5 fillheight">
|
||||
<div class="metadata fillup bordered">
|
||||
|
||||
Reference in New Issue
Block a user