mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[explore] fixing bugs in controls (#2496)
This commit is contained in:
parent
56f28859b7
commit
e14b74fdbf
@ -22,7 +22,6 @@ operatorsArr.forEach(op => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
choices: PropTypes.array,
|
|
||||||
changeFilter: PropTypes.func,
|
changeFilter: PropTypes.func,
|
||||||
removeFilter: PropTypes.func,
|
removeFilter: PropTypes.func,
|
||||||
filter: PropTypes.object.isRequired,
|
filter: PropTypes.object.isRequired,
|
||||||
@ -32,7 +31,6 @@ const propTypes = {
|
|||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
changeFilter: () => {},
|
changeFilter: () => {},
|
||||||
removeFilter: () => {},
|
removeFilter: () => {},
|
||||||
choices: [],
|
|
||||||
datasource: null,
|
datasource: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,8 +52,7 @@ export default class Filter extends React.Component {
|
|||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: `/superset/filter/${datasource.type}/${datasource.id}/${col}/`,
|
url: `/superset/filter/${datasource.type}/${datasource.id}/${col}/`,
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
this.props.changeFilter('choices', data);
|
this.setState({ valuesLoading: false, valueChoices: data });
|
||||||
this.setState({ valuesLoading: false });
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -100,7 +97,7 @@ export default class Filter extends React.Component {
|
|||||||
name="filter-value"
|
name="filter-value"
|
||||||
value={filter.val}
|
value={filter.val}
|
||||||
isLoading={this.state.valuesLoading}
|
isLoading={this.state.valuesLoading}
|
||||||
choices={filter.choices}
|
choices={this.state.valueChoices}
|
||||||
onChange={this.changeSelect.bind(this)}
|
onChange={this.changeSelect.bind(this)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -709,8 +709,7 @@ class DruidDatasource(Model, BaseDatasource):
|
|||||||
client = self.cluster.get_pydruid_client()
|
client = self.cluster.get_pydruid_client()
|
||||||
client.topn(**qry)
|
client.topn(**qry)
|
||||||
df = client.export_pandas()
|
df = client.export_pandas()
|
||||||
|
return [row[column_name] for row in df.to_records(index=False)]
|
||||||
return [row[0] for row in df.to_records(index=False)]
|
|
||||||
|
|
||||||
def get_query_str( # noqa / druid
|
def get_query_str( # noqa / druid
|
||||||
self,
|
self,
|
||||||
@ -981,7 +980,11 @@ class DruidDatasource(Model, BaseDatasource):
|
|||||||
eq = flt['val']
|
eq = flt['val']
|
||||||
cond = None
|
cond = None
|
||||||
if op in ('in', 'not in'):
|
if op in ('in', 'not in'):
|
||||||
eq = [types.replace("'", '').strip() for types in eq]
|
eq = [
|
||||||
|
types.replace("'", '').strip()
|
||||||
|
if isinstance(types, basestring)
|
||||||
|
else types
|
||||||
|
for types in eq]
|
||||||
elif not isinstance(flt['val'], basestring):
|
elif not isinstance(flt['val'], basestring):
|
||||||
eq = eq[0] if len(eq) > 0 else ''
|
eq = eq[0] if len(eq) > 0 else ''
|
||||||
if col in self.num_cols:
|
if col in self.num_cols:
|
||||||
|
Loading…
Reference in New Issue
Block a user