mirror of https://github.com/apache/superset.git
Getting filters to a reasonable place
This commit is contained in:
parent
e0586ec666
commit
8682196eb8
|
@ -403,6 +403,7 @@ class FormFactory(object):
|
|||
css_classes = field_css_classes
|
||||
standalone = HiddenField()
|
||||
async = HiddenField()
|
||||
extra_filters = HiddenField()
|
||||
json = HiddenField()
|
||||
slice_id = HiddenField()
|
||||
slice_name = HiddenField()
|
||||
|
|
|
@ -508,7 +508,6 @@ class SqlaTable(Model, Queryable, AuditMixinNullable):
|
|||
con=engine
|
||||
)
|
||||
sql = sqlparse.format(sql, reindent=True)
|
||||
print(sql)
|
||||
return QueryResult(
|
||||
df=df, duration=datetime.now() - qry_start_dttm, query=sql)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,14 @@ class BaseViz(object):
|
|||
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):
|
||||
|
|
Loading…
Reference in New Issue