未验证 提交 997befca 编写于 作者: V Ville Brofeldt 提交者: GitHub

fix(explore): pass partitionColumn when creating new adhoc filter (#12789)

* fix(explore): pass partitionColumn when creating new adhoc filter

* add default value to state

* remove duplicated code

* update translations
上级 49e6e420
...@@ -96,11 +96,13 @@ class AdhocFilterControl extends React.Component { ...@@ -96,11 +96,13 @@ class AdhocFilterControl extends React.Component {
onRemoveFilter={() => this.onRemoveFilter(index)} onRemoveFilter={() => this.onRemoveFilter(index)}
onMoveLabel={this.moveLabel} onMoveLabel={this.moveLabel}
onDropLabel={() => this.props.onChange(this.state.values)} onDropLabel={() => this.props.onChange(this.state.values)}
partitionColumn={this.state.partitionColumn}
/> />
); );
this.state = { this.state = {
values: filters, values: filters,
options: this.optionsForSelect(this.props), options: this.optionsForSelect(this.props),
partitionColumn: null,
}; };
} }
...@@ -128,18 +130,7 @@ class AdhocFilterControl extends React.Component { ...@@ -128,18 +130,7 @@ class AdhocFilterControl extends React.Component {
partitions.cols && partitions.cols &&
Object.keys(partitions.cols).length === 1 Object.keys(partitions.cols).length === 1
) { ) {
const partitionColumn = partitions.cols[0]; this.setState({ partitionColumn: partitions.cols[0] });
this.valueRenderer = (adhocFilter, index) => (
<AdhocFilterOption
adhocFilter={adhocFilter}
onFilterEdit={this.onFilterEdit}
options={this.state.options}
datasource={this.props.datasource}
partitionColumn={partitionColumn}
onRemoveFilter={() => this.onRemoveFilter(index)}
key={index}
/>
);
} }
} }
}) })
...@@ -323,6 +314,7 @@ class AdhocFilterControl extends React.Component { ...@@ -323,6 +314,7 @@ class AdhocFilterControl extends React.Component {
datasource={this.props.datasource} datasource={this.props.datasource}
options={this.state.options} options={this.state.options}
onFilterEdit={this.onNewFilter} onFilterEdit={this.onNewFilter}
partitionColumn={this.state.partitionColumn}
createNew createNew
> >
{trigger} {trigger}
......
...@@ -304,7 +304,11 @@ export default class AdhocFilterEditPopoverSimpleTabContent extends React.Compon ...@@ -304,7 +304,11 @@ export default class AdhocFilterEditPopoverSimpleTabContent extends React.Compon
} }
const operatorSelectProps = { const operatorSelectProps = {
placeholder: t('%s operators(s)', OPERATORS_OPTIONS.length), placeholder: t(
'%s operator(s)',
OPERATORS_OPTIONS.filter(op => this.isOperatorRelevant(op, subject))
.length,
),
// like AGGREGTES_OPTIONS, operator options are string // like AGGREGTES_OPTIONS, operator options are string
value: operator, value: operator,
onChange: this.onOperatorChange, onChange: this.onOperatorChange,
......
...@@ -1706,7 +1706,7 @@ ...@@ -1706,7 +1706,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": ["Spalten auflisten"], "%s column(s)": ["Spalten auflisten"],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": [""], "%s operator(s)": [""],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6082,7 +6082,7 @@ msgstr "" ...@@ -6082,7 +6082,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "" msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1616,7 +1616,7 @@ ...@@ -1616,7 +1616,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": [""], "%s column(s)": [""],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": [""], "%s operator(s)": [""],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6081,7 +6081,7 @@ msgstr "" ...@@ -6081,7 +6081,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "" msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1835,7 +1835,7 @@ ...@@ -1835,7 +1835,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": [""], "%s column(s)": [""],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": [""], "%s operator(s)": [""],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6154,7 +6154,7 @@ msgstr "" ...@@ -6154,7 +6154,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "" msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1955,7 +1955,7 @@ ...@@ -1955,7 +1955,7 @@
"To filter on a metric, use Custom SQL tab.": [ "To filter on a metric, use Custom SQL tab.": [
"À filtrer sur une métrique, utiliser l'onglet Custom SQL." "À filtrer sur une métrique, utiliser l'onglet Custom SQL."
], ],
"%s operators(s)": ["%s opérateur(s)"], "%s operator(s)": ["%s opérateur(s)"],
"Type a value here": ["Saisir une valeur ici"], "Type a value here": ["Saisir une valeur ici"],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": ["Choisir WHERE or HAVING..."], "choose WHERE or HAVING...": ["Choisir WHERE or HAVING..."],
......
...@@ -6228,7 +6228,7 @@ msgstr "À filtrer sur une métrique, utiliser l'onglet Custom SQL." ...@@ -6228,7 +6228,7 @@ msgstr "À filtrer sur une métrique, utiliser l'onglet Custom SQL."
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "%s opérateur(s)" msgstr "%s opérateur(s)"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1727,7 +1727,7 @@ ...@@ -1727,7 +1727,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": ["Visualizza colonne"], "%s column(s)": ["Visualizza colonne"],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": ["Seleziona operatore"], "%s operator(s)": ["Seleziona operatore"],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6126,7 +6126,7 @@ msgstr "" ...@@ -6126,7 +6126,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "Seleziona operatore" msgstr "Seleziona operatore"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1643,7 +1643,7 @@ ...@@ -1643,7 +1643,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": [""], "%s column(s)": [""],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": ["オペレータを選択"], "%s operator(s)": ["オペレータを選択"],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6072,7 +6072,7 @@ msgstr "" ...@@ -6072,7 +6072,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "オペレータを選択" msgstr "オペレータを選択"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1617,7 +1617,7 @@ ...@@ -1617,7 +1617,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": [""], "%s column(s)": [""],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": [""], "%s operator(s)": [""],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6072,7 +6072,7 @@ msgstr "" ...@@ -6072,7 +6072,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "" msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -6081,7 +6081,7 @@ msgstr "" ...@@ -6081,7 +6081,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "" msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1724,7 +1724,7 @@ ...@@ -1724,7 +1724,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": ["Lista de Colunas"], "%s column(s)": ["Lista de Colunas"],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": ["Selecione operador"], "%s operator(s)": ["Selecione operador"],
"type a value here": [""], "type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -5723,7 +5723,7 @@ msgstr "" ...@@ -5723,7 +5723,7 @@ msgstr ""
#: superset-frontend/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "Selecione operador" msgstr "Selecione operador"
#: superset-frontend/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -2244,7 +2244,7 @@ ...@@ -2244,7 +2244,7 @@
"To filter on a metric, use Custom SQL tab.": [ "To filter on a metric, use Custom SQL tab.": [
"Para filtrar uma métrica, use a aba SQL personalizado." "Para filtrar uma métrica, use a aba SQL personalizado."
], ],
"%s operators(s)": ["%s operador(es)"], "%s operator(s)": ["%s operador(es)"],
"Type a value here": ["digite um valor aqui"], "Type a value here": ["digite um valor aqui"],
"Filter value (case sensitive)": [ "Filter value (case sensitive)": [
"Filtrar valor (sensível a maiúscula/minúscula)" "Filtrar valor (sensível a maiúscula/minúscula)"
......
...@@ -6489,7 +6489,7 @@ msgstr "Para filtrar uma métrica, use a aba SQL personalizado." ...@@ -6489,7 +6489,7 @@ msgstr "Para filtrar uma métrica, use a aba SQL personalizado."
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "%s operador(es)" msgstr "%s operador(es)"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1839,7 +1839,7 @@ ...@@ -1839,7 +1839,7 @@
"%s column(s) and metric(s)": [""], "%s column(s) and metric(s)": [""],
"%s column(s)": ["Список столбцов"], "%s column(s)": ["Список столбцов"],
"To filter on a metric, use Custom SQL tab.": [""], "To filter on a metric, use Custom SQL tab.": [""],
"%s operators(s)": ["%s параметр(ы)"], "%s operator(s)": ["%s параметр(ы)"],
"Type a value here": [""], "Type a value here": [""],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": [""], "choose WHERE or HAVING...": [""],
......
...@@ -6170,7 +6170,7 @@ msgstr "" ...@@ -6170,7 +6170,7 @@ msgstr ""
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "%s параметр(ы)" msgstr "%s параметр(ы)"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
...@@ -1731,7 +1731,7 @@ ...@@ -1731,7 +1731,7 @@
"To filter on a metric, use Custom SQL tab.": [ "To filter on a metric, use Custom SQL tab.": [
"若要在计量值上筛选,请使用自定义SQL选项卡。" "若要在计量值上筛选,请使用自定义SQL选项卡。"
], ],
"%s operators(s)": ["%s 运算符"], "%s operator(s)": ["%s 运算符"],
"Type a value here": ["在这里键入一个值"], "Type a value here": ["在这里键入一个值"],
"Filter value (case sensitive)": [""], "Filter value (case sensitive)": [""],
"choose WHERE or HAVING...": ["选择WHERE或HAVING子句..."], "choose WHERE or HAVING...": ["选择WHERE或HAVING子句..."],
......
...@@ -6134,7 +6134,7 @@ msgstr "若要在计量值上筛选,请使用自定义SQL选项卡。" ...@@ -6134,7 +6134,7 @@ msgstr "若要在计量值上筛选,请使用自定义SQL选项卡。"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:307
#, python-format #, python-format
msgid "%s operators(s)" msgid "%s operator(s)"
msgstr "%s 运算符" msgstr "%s 运算符"
#: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326 #: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx:326
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册