mirror of
https://github.com/apache/superset.git
synced 2024-09-12 16:49:40 -04:00
Fixed creating new filter options in FilterBox (#3584)
This commit is contained in:
parent
076f9cd095
commit
efc63669a6
@ -77,19 +77,20 @@ class FilterBox extends React.Component {
|
||||
}
|
||||
// Add created options to filtersChoices, even though it doesn't exist,
|
||||
// or these options will exist in query sql but invisible to end user.
|
||||
if (this.state.selectedValues.hasOwnProperty()) {
|
||||
for (const filterKey of this.state.selectedValues) {
|
||||
const existValues = this.props.filtersChoices[filterKey].map(f => f.id);
|
||||
for (const v of this.state.selectedValues[filterKey]) {
|
||||
if (existValues.indexOf(v) === -1) {
|
||||
const addChoice = {
|
||||
filter: filterKey,
|
||||
id: v,
|
||||
text: v,
|
||||
metric: 0,
|
||||
};
|
||||
this.props.filtersChoices[filterKey].push(addChoice);
|
||||
}
|
||||
for (const filterKey in this.state.selectedValues) {
|
||||
if (!this.state.selectedValues.hasOwnProperty(filterKey)) {
|
||||
continue;
|
||||
}
|
||||
const existValues = this.props.filtersChoices[filterKey].map(f => f.id);
|
||||
for (const v of this.state.selectedValues[filterKey]) {
|
||||
if (existValues.indexOf(v) === -1) {
|
||||
const addChoice = {
|
||||
filter: filterKey,
|
||||
id: v,
|
||||
text: v,
|
||||
metric: 0,
|
||||
};
|
||||
this.props.filtersChoices[filterKey].push(addChoice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user