From ff1de7a8c511a94c215ded13c4fd594263e8d3ed Mon Sep 17 00:00:00 2001 From: Gabe Lyons Date: Thu, 31 May 2018 11:34:51 -0700 Subject: [PATCH] fixing LIKE constant name (#5110) (cherry picked from commit f3778c3c81b1e9a04869708b8206daf7734a0fa7) --- .../AdhocFilterEditPopoverSimpleTabContent_spec.jsx | 4 ++-- superset/assets/src/explore/AdhocFilter.js | 2 +- .../components/AdhocFilterEditPopoverSimpleTabContent.jsx | 2 ++ superset/assets/src/explore/constants.js | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/superset/assets/spec/javascripts/explore/components/AdhocFilterEditPopoverSimpleTabContent_spec.jsx b/superset/assets/spec/javascripts/explore/components/AdhocFilterEditPopoverSimpleTabContent_spec.jsx index 74ac96701e951..2014bbc7c9f3e 100644 --- a/superset/assets/spec/javascripts/explore/components/AdhocFilterEditPopoverSimpleTabContent_spec.jsx +++ b/superset/assets/spec/javascripts/explore/components/AdhocFilterEditPopoverSimpleTabContent_spec.jsx @@ -113,13 +113,13 @@ describe('AdhocFilterEditPopoverSimpleTabContent', () => { it('will filter operators for table datasources', () => { const { wrapper } = setup({ datasource: { type: 'table' } }); expect(wrapper.instance().isOperatorRelevant('regex')).to.be.false; - expect(wrapper.instance().isOperatorRelevant('like')).to.be.true; + expect(wrapper.instance().isOperatorRelevant('LIKE')).to.be.true; }); it('will filter operators for druid datasources', () => { const { wrapper } = setup({ datasource: { type: 'druid' } }); expect(wrapper.instance().isOperatorRelevant('regex')).to.be.true; - expect(wrapper.instance().isOperatorRelevant('like')).to.be.false; + expect(wrapper.instance().isOperatorRelevant('LIKE')).to.be.false; }); it('expands when its multi comparator input field expands', () => { diff --git a/superset/assets/src/explore/AdhocFilter.js b/superset/assets/src/explore/AdhocFilter.js index ba9651528c3d7..675cc27f613eb 100644 --- a/superset/assets/src/explore/AdhocFilter.js +++ b/superset/assets/src/explore/AdhocFilter.js @@ -19,7 +19,7 @@ const OPERATORS_TO_SQL = { '<=': '<=', in: 'in', 'not in': 'not in', - like: 'like', + LIKE: 'like', }; function translateToSql(adhocMetric, { useSimple } = {}) { diff --git a/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx b/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx index 36b7683cec75d..222772a464bf3 100644 --- a/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx +++ b/superset/assets/src/explore/components/AdhocFilterEditPopoverSimpleTabContent.jsx @@ -42,6 +42,8 @@ function translateOperator(operator) { return 'equals'; } else if (operator === OPERATORS['!=']) { return 'not equal to'; + } else if (operator === OPERATORS.LIKE) { + return 'like'; } return operator; } diff --git a/superset/assets/src/explore/constants.js b/superset/assets/src/explore/constants.js index d5dce01998f1d..39d70637829e4 100644 --- a/superset/assets/src/explore/constants.js +++ b/superset/assets/src/explore/constants.js @@ -16,11 +16,11 @@ export const OPERATORS = { '<=': '<=', in: 'in', 'not in': 'not in', - like: 'like', + LIKE: 'LIKE', regex: 'regex', }; -export const TABLE_ONLY_OPERATORS = [OPERATORS.like]; +export const TABLE_ONLY_OPERATORS = [OPERATORS.LIKE]; export const DRUID_ONLY_OPERATORS = [OPERATORS.regex]; export const HAVING_OPERATORS = [ OPERATORS['=='],