-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
354ef9b
commit e8ae49d
Showing
3 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{% extends "panoramix/base.html" %} | ||
|
||
{% block head_css %} | ||
{{super()}} | ||
<link rel="stylesheet" type="text/css" href="/static/lib/dataTables/jquery.dataTables.min.css" /> | ||
<link rel="stylesheet" type="text/css" href="/static/lib/dataTables/dataTables.bootstrap.css" /> | ||
<style type="text/css"> | ||
.topsql { | ||
height: 250px; | ||
} | ||
.bordered { | ||
padding: 5px 10px; | ||
border: 1px solid grey; | ||
border-radius: 5px; | ||
background-color: #EEE; | ||
} | ||
.metadata { | ||
overflow: auto; | ||
width: 300px; | ||
height: 100px; | ||
} | ||
.fillup { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.fillheight { | ||
height: 100%; | ||
} | ||
#interactive { | ||
padding-top: 10px; | ||
} | ||
#results { | ||
overflow: auto; | ||
font-size: 12px; | ||
} | ||
#results table tbody tr td{ | ||
padding: 2px 4px; | ||
} | ||
|
||
</style> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<h2>db: [{{ db }}]</h2> | ||
<div class="topsql row"> | ||
<div class="col-xs-7 fillheight"> | ||
<textarea id="sql" class="fillup">SELECT * FROM information_schema.tables; | ||
</textarea> | ||
</div> | ||
<div class="col-xs-5 fillheight"> | ||
<div class="metadata fillup bordered"> | ||
Tables | ||
</div> | ||
</div> | ||
</div> | ||
<div id="interactive"> | ||
<input type="hidden" id="database_id" value="{{ database_id }}"> | ||
<button class="btn btn-primary" id="run">Run!</button> | ||
<button class="btn btn-default" id="view">Create View</button> | ||
</div> | ||
<div id="results_section"> | ||
<hr/> | ||
<img id="loading" width="25" style="display: none;" src="/static/img/loading.gif"> | ||
</div> | ||
<div> | ||
<div id="results" class="bordered"></div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block tail_js %} | ||
{{ super() }} | ||
<script src="/static/lib/bootstrap-toggle.min.js"></script> | ||
<script src="/static/lib/dataTables/jquery.dataTables.min.js"></script> | ||
<script src="/static/lib/dataTables/dataTables.bootstrap.js"></script> | ||
<script> | ||
$(document).ready(function() { | ||
$("#run").click(function() { | ||
$('#results').hide(0); | ||
$('#loading').show(0); | ||
$.ajax({ | ||
type: "POST", | ||
url: '/panoramix/runsql/', | ||
data: { | ||
'data': JSON.stringify({ | ||
'database_id': $('#database_id').val(), | ||
'sql': $('#sql').val(), | ||
})}, | ||
success: function(data) { | ||
$('#loading').hide(0); | ||
$('#results').show(0); | ||
$('#results').html(data); | ||
|
||
var datatable = $('table').DataTable({ | ||
paging: false, | ||
searching: true, | ||
}); | ||
}, | ||
error: function() { | ||
$('#loading').hide(0); | ||
}, | ||
}); | ||
}); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters