Skip to content

Commit 7e21545

Browse files
authored
feat: drill down queries support (#664)
* feat: drill down queries support * test: drillDown tests, useCubeQuery hook revert * compiled packages * refactor: drillMembers grouping * fix: measure filter * fix: measure filter case * dist files Fixes #190
1 parent fb9ab9d commit 7e21545

File tree

10 files changed

+1353
-746
lines changed

10 files changed

+1353
-746
lines changed

.eslintrc.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
module.exports = {
2-
"extends": "airbnb-base",
3-
"plugins": [
4-
"import"
2+
extends: 'airbnb-base',
3+
plugins: [
4+
'import'
55
],
6-
"rules": {
7-
"max-classes-per-file": 0,
8-
"prefer-object-spread": 0,
9-
"import/no-unresolved": 0,
10-
"comma-dangle": 0,
11-
"no-console": 0,
12-
"arrow-parens": 0,
13-
"import/extensions": 0,
14-
"quotes": ['warn', 'single'],
15-
"no-prototype-builtins": 0,
16-
"class-methods-use-this": 0,
17-
"no-param-reassign": 0,
18-
"no-mixed-operators": 0,
19-
"no-else-return": 0,
20-
"prefer-promise-reject-errors": 0,
21-
"no-plusplus": 0,
22-
"no-await-in-loop": 0,
23-
"operator-linebreak": ["error", "after"],
6+
rules: {
7+
'max-classes-per-file': 0,
8+
'prefer-object-spread': 0,
9+
'import/no-unresolved': 0,
10+
'comma-dangle': 0,
11+
'no-console': 0,
12+
'arrow-parens': 0,
13+
'import/extensions': 0,
14+
quotes: ['warn', 'single'],
15+
'no-prototype-builtins': 0,
16+
'class-methods-use-this': 0,
17+
'no-param-reassign': 0,
18+
'no-mixed-operators': 0,
19+
'no-else-return': 0,
20+
'prefer-promise-reject-errors': 0,
21+
'no-plusplus': 0,
22+
'no-await-in-loop': 0,
23+
'operator-linebreak': ['error', 'after'],
2424
'max-len': ['error', 120, 2, {
2525
ignoreUrls: true,
2626
ignoreComments: false,
2727
ignoreRegExpLiterals: true,
2828
ignoreStrings: true,
2929
ignoreTemplateLiterals: true,
30-
}]
30+
}],
31+
'no-unused-vars': ['warn']
3132
}
3233
};

packages/cubejs-api-gateway/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ const prepareAnnotation = (metaConfig, query) => {
3636
description: config.description,
3737
type: config.type,
3838
format: config.format,
39-
meta: config.meta
39+
meta: config.meta,
40+
...(memberType === 'measures' ? {
41+
drillMembers: config.drillMembers,
42+
drillMembersGrouped: config.drillMembersGrouped
43+
} : {})
4044
}];
4145
};
4246

@@ -121,7 +125,8 @@ const operators = [
121125
'notInDateRange',
122126
'onTheDate',
123127
'beforeDate',
124-
'afterDate'
128+
'afterDate',
129+
'measureFilter',
125130
];
126131

127132
const querySchema = Joi.object().keys({
@@ -188,13 +193,14 @@ const normalizeQuery = (query) => {
188193
'notInDateRange',
189194
'onTheDate',
190195
'beforeDate',
191-
'afterDate'
196+
'afterDate',
197+
'measureFilter',
192198
].indexOf(f.operator) === -1);
193199
if (filterWithIncorrectOperator) {
194200
throw new UserError(`Operator ${filterWithIncorrectOperator.operator} not supported for filter: ${JSON.stringify(filterWithIncorrectOperator)}`);
195201
}
196202
const filterWithoutValues = (query.filters || [])
197-
.find(f => !f.values && ['set', 'notSet'].indexOf(f.operator) === -1);
203+
.find(f => !f.values && ['set', 'notSet', 'measureFilter'].indexOf(f.operator) === -1);
198204
if (filterWithoutValues) {
199205
throw new UserError(`Values required for filter: ${JSON.stringify(filterWithoutValues)}`);
200206
}

0 commit comments

Comments
 (0)