Skip to content

Commit

Permalink
Getting filters to a reasonable place
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 22, 2015
1 parent e0586ec commit 8682196
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions panoramix/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class QueryForm(OmgWtForm):
css_classes = field_css_classes
standalone = HiddenField()
async = HiddenField()
extra_filters = HiddenField()
json = HiddenField()
slice_id = HiddenField()
slice_name = HiddenField()
Expand Down
1 change: 0 additions & 1 deletion panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ def query(
con=engine
)
sql = sqlparse.format(sql, reindent=True)
print(sql)
return QueryResult(
df=df, duration=datetime.now() - qry_start_dttm, query=sql)

Expand Down
6 changes: 1 addition & 5 deletions panoramix/static/panoramix.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ var px = (function() {
if (dashboard !== undefined){
for (var f in dashboard.filters) {
if (slice_id !== f){
form_data[dashboard.filters[f][0]] = dashboard.filters[f][1];
form_data['flt_col_1'] = dashboard.filters[f][0];
form_data['flt_op_1'] = 'in';
form_data['flt_eq_1'] = dashboard.filters[f][1][0];
//form_data['extra_filters'] = JSON.stringify(dashboard.filters)
form_data['extra_filters'] = JSON.stringify(dashboard.filters)
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ def query_filters(self):
eq = form_data.get("flt_eq_" + str(i))
if col and op and eq:
filters.append((col, op, eq))

# Extra filters (coming from dashboard)
extra_filters = form_data.get('extra_filters', [])
if extra_filters:
extra_filters = json.loads(extra_filters)
for slice_id, (col, vals) in extra_filters.items():
filters += [(col, 'in', ",".join(vals))]

return filters

def query_obj(self):
Expand Down

0 comments on commit 8682196

Please sign in to comment.