fixing LIKE constant name (#5110)

This commit is contained in:
Gabe Lyons
2018-05-31 11:34:51 -07:00
committed by Maxime Beauchemin
parent cefc206a36
commit f3778c3c81
4 changed files with 7 additions and 5 deletions

View File

@@ -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', () => {

View File

@@ -19,7 +19,7 @@ const OPERATORS_TO_SQL = {
'<=': '<=',
in: 'in',
'not in': 'not in',
like: 'like',
LIKE: 'like',
};
function translateToSql(adhocMetric, { useSimple } = {}) {

View File

@@ -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;
}

View File

@@ -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['=='],