Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 18, 2015
1 parent f6753af commit cd09b0d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 9 additions & 3 deletions panoramix/templates/panoramix/datasource.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ <h4>Filters</h4>
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</button>
<hr>
<button type="button" class="btn btn-primary" id="druidify">Druidify!</button>
<button type="button" class="btn btn-default" id="bookmark">Bookmark</button>
<button type="button" class="btn btn-primary" id="druidify">
<i class="fa fa-bolt"></i>
Druidify!
</button>
<button type="button" class="btn btn-default" id="save">
<i class="fa fa-save"></i>
Save as Slice
</button>
<hr style="margin-bottom: 0px;">
<img src="{{ url_for("static", filename="tux_panoramix.png") }}" width=250>
<input type="hidden" id="slice_name" name="slice_name" value="TEST">
Expand Down Expand Up @@ -188,7 +194,7 @@ <h4 class="modal-title" id="myModalLabel">Query</h4>
});
}
$("#plus").click(add_filter);
$("#bookmark").click(function () {
$("#save").click(function () {
var slice_name = prompt("Name your slice!");
$("#slice_name").val(slice_name);
$.get( "/panoramix/save/", $("#query").serialize() );
Expand Down
16 changes: 13 additions & 3 deletions panoramix/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,24 @@ def save(self):
d = request.args.to_dict(flat=False)
as_list = ('metrics', 'groupby')
for m in as_list:
if d[m] and not isinstance(d[m]):
v = d.get(m)
if v and not isinstance(d[m], list):
d[m] = [d[m]]

table_id = druid_datasource_id = None
datasource_type = request.args.get('datasource_type')
if datasource_type == 'druid':
druid_datasource_id = request.args.get('datasource_id')
else:
table_id = request.args.get('datasource_id')

obj = models.Slice(
params=json.dumps(d, indent=4),
viz_type=request.args.get('viz_type'),
datasource_name=request.args.get('datasource_name'),
datasource_id=request.args.get('datasource_id'),
datasource_type=request.args.get('datasource_type'),
druid_datasource_id=druid_datasource_id,
table_id=table_id,
datasource_type=datasource_type,
slice_name=request.args.get('slice_name', 'junk'),
)
session.add(obj)
Expand Down

0 comments on commit cd09b0d

Please sign in to comment.