Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving files around #145

Merged
merged 2 commits into from
Feb 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions panoramix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@


class MyIndexView(IndexView):
index_template = 'refactor/index.html'
index_template = 'panoramix/featured_datasets.html'

appbuilder = AppBuilder(
app, db.session,
base_template='refactor/base.html',
base_template='panoramix/base.html',
indexview=MyIndexView,
security_manager_class=app.config.get("CUSTOM_SECURITY_MANAGER"))

Expand Down
45 changes: 0 additions & 45 deletions panoramix/assets/html/base.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</title>
{% block head_meta %}{% endblock %}
{% block head_css %}
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/jquery-ui/themes/base/minified/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/node_modules/select2/select2-bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/panoramix.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/jquery-ui/themes/base/minified/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/select2/select2-bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/stylesheets/panoramix.css" />
<!-- Replace with custom bootstrap theme -->
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/themes/bootswatch.paper.min.css" />
<link rel="stylesheet" type="text/css" href="/static/assets/stylesheets/themes/bootswatch.paper.min.css" />
{% endblock %}
{% block head_js %}{% endblock %}
</head>
Expand Down
4 changes: 2 additions & 2 deletions panoramix/assets/html/explore.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "panoramix/basic.html" %}
{% extends "refactor/basic.html" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be assets/basic.html since refactor/ was renamed assets/?


{% block body %}
{% set datasource = viz.datasource %}
Expand Down Expand Up @@ -208,5 +208,5 @@ <h4 class="modal-title">Datasource Description</h4>

{% block tail_js %}
{{ super() }}
<script src="/static/refactor/javascripts/dist/explore.entry.js"></script>
<script src="/static/assets/javascripts/dist/explore.entry.js"></script>
{% endblock %}
70 changes: 0 additions & 70 deletions panoramix/assets/javascripts/modules/panoramix.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,75 +460,6 @@ var px = (function() {
});
}

function initSqlEditorView() {
var database_id = $('#database_id').val();
var editor = ace.edit("sql");
editor.$blockScrolling = Infinity
editor.getSession().setUseWrapMode(true);

var textarea = $('#sql').hide();
editor.setTheme("ace/theme/crimson_editor");
editor.setOptions({
minLines: 16,
maxLines: Infinity,
});
editor.getSession().setMode("ace/mode/sql");
editor.focus();
$("select").select2({dropdownAutoWidth : true});
function showTableMetadata() {
$(".metadata").load(
'/panoramix/table/' + database_id + '/' + $("#dbtable").val() + '/');
}
$("#dbtable").on("change", showTableMetadata);
showTableMetadata();
$("#create_view").click(function(){alert("Not implemented");});
$(".sqlcontent").show();
$("#select_star").click(function(){
$.ajax('/panoramix/select_star/' + database_id + '/' + $("#dbtable").val() + '/')
.done(function(msg){
editor.setValue(msg);
});
});
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/',
data: {
'data': JSON.stringify({
'database_id': $('#database_id').val(),
'sql': editor.getSession().getValue(),
})},
success: function(data) {
$('#loading').hide(0);
$('#results').show(0);
$('#results').html(data);

var datatable = $('table.sql_results').DataTable({
paging: false,
searching: true,
aaSorting: [],
});
},
error: function(err, err2) {
$('#loading').hide(0);
$('#results').show(0);
$('#results').html(err.responseText);
},
});
});
}

function initDashboardView() {
var gridster = $(".gridster ul").gridster({
Expand Down Expand Up @@ -633,7 +564,6 @@ var px = (function() {
timeFormatFactory: timeFormatFactory,
color: color(),
renderSlice: renderSlice,
initSqlEditorView: initSqlEditorView,
}
})();

Expand Down
87 changes: 87 additions & 0 deletions panoramix/assets/javascripts/sql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;
require('select2');
require('datatables');

var ace = require('brace');
require('brace/mode/sql');
require('brace/theme/crimson_editor');

$(document).ready(function() {
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 initSqlEditorView() {
var database_id = $('#database_id').val();
var editor = ace.edit("sql");
editor.$blockScrolling = Infinity
editor.getSession().setUseWrapMode(true);

var textarea = $('#sql').hide();
editor.setTheme("ace/theme/crimson_editor");
editor.setOptions({
minLines: 16,
maxLines: Infinity,
});
editor.getSession().setMode("ace/mode/sql");
editor.focus();
$("select").select2({dropdownAutoWidth : true});
function showTableMetadata() {
$(".metadata").load(
'/panoramix/table/' + database_id + '/' + $("#dbtable").val() + '/');
}
$("#dbtable").on("change", showTableMetadata);
showTableMetadata();
$("#create_view").click(function(){alert("Not implemented");});
$(".sqlcontent").show();
$("#select_star").click(function(){
$.ajax('/panoramix/select_star/' + database_id + '/' + $("#dbtable").val() + '/')
.done(function(msg){
editor.setValue(msg);
});
});
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/',
data: {
'data': JSON.stringify({
'database_id': $('#database_id').val(),
'sql': editor.getSession().getValue(),
})},
success: function(data) {
$('#loading').hide(0);
$('#results').show(0);
$('#results').html(data);

var datatable = $('table.sql_results').DataTable({
paging: false,
searching: true,
aaSorting: [],
});
},
error: function(err, err2) {
$('#loading').hide(0);
$('#results').show(0);
$('#results').html(err.responseText);
},
});
});
}
initSqlEditorView();
});
1 change: 1 addition & 0 deletions panoramix/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"d3-sankey": "^0.2.1",
"d3-tip": "^0.6.7",
"d3.layout.cloud": "^1.2.0",
"datatables": "^1.10.9",
"exports-loader": "^0.6.3",
"font-awesome": "^4.5.0",
"gridster": "^0.5.6",
Expand Down
4 changes: 3 additions & 1 deletion panoramix/assets/stylesheets/panoramix.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ legend.legend-style {
//position: relative !important;
z-index: 888;
}

.nvtooltip table td{
font-size: small !important;
}
legend {
width: auto;
border-bottom: 0px;
Expand Down
4 changes: 2 additions & 2 deletions panoramix/assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ var BUILD_DIR = path.resolve(__dirname, './javascripts/dist'); // output
var config = {
// for now generate one compiled js file per entry point / html page
entry: {
index: APP_DIR + '/javascripts/index.jsx',
//dashboard: APP_DIR + '/javascripts/dist/dashboard.js',
explore: APP_DIR + '/javascripts/explore.js',
// dashboard: APP_DIR + '/javascripts/dist/dashboard.js',
sql: APP_DIR + '/javascripts/sql.js',
},
output: {
path: BUILD_DIR,
Expand Down
2 changes: 2 additions & 0 deletions panoramix/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def load_world_bank_health_n_pop():
tbl = TBL(table_name=tbl_name)
tbl.description = utils.readfile(os.path.join(DATA_FOLDER, 'countries.md'))
tbl.main_dttm_col = 'year'
tbl.is_featured = True
tbl.database = get_or_create_db(db.session)
db.session.merge(tbl)
db.session.commit()
Expand Down Expand Up @@ -305,6 +306,7 @@ def load_birth_names():
obj = TBL(table_name = 'birth_names')
obj.main_dttm_col = 'ds'
obj.database = get_or_create_db(db.session)
obj.is_featured = True
db.session.merge(obj)
db.session.commit()
obj.fetch_metadata()
Expand Down
File renamed without changes.
Loading