mirror of https://github.com/apache/superset.git
chore: filter undefined operators (#20157)
This commit is contained in:
parent
56e96950c1
commit
d7e3ac306f
|
@ -61,10 +61,7 @@ export default function buildQueryContext(
|
|||
} = typeof options === 'function'
|
||||
? { buildQuery: options, queryFields: {} }
|
||||
: options || {};
|
||||
return {
|
||||
datasource: new DatasourceKey(formData.datasource).toObject(),
|
||||
force: formData.force || false,
|
||||
queries: buildQuery(buildQueryObject(formData, queryFields), {
|
||||
const queries = buildQuery(buildQueryObject(formData, queryFields), {
|
||||
extras: {},
|
||||
ownState,
|
||||
hooks: {
|
||||
|
@ -72,7 +69,17 @@ export default function buildQueryContext(
|
|||
setCachedChanges: () => {},
|
||||
...hooks,
|
||||
},
|
||||
}),
|
||||
});
|
||||
queries.forEach(query => {
|
||||
if (Array.isArray(query.post_processing)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
query.post_processing = query.post_processing.filter(Boolean);
|
||||
}
|
||||
});
|
||||
return {
|
||||
datasource: new DatasourceKey(formData.datasource).toObject(),
|
||||
force: formData.force || false,
|
||||
queries,
|
||||
form_data: formData,
|
||||
result_format: formData.result_format || 'json',
|
||||
result_type: formData.result_type || 'full',
|
||||
|
|
|
@ -86,7 +86,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||
is_timeseries,
|
||||
}),
|
||||
flattenOperator(fd, queryObject),
|
||||
].filter(Boolean),
|
||||
],
|
||||
} as QueryObject;
|
||||
return [normalizeOrderBy(tmpQueryObject)];
|
||||
}),
|
||||
|
|
|
@ -100,7 +100,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||
flattenOperator(formData, baseQueryObject),
|
||||
// todo: move prophet before flatten
|
||||
prophetOperator(formData, baseQueryObject),
|
||||
].filter(Boolean),
|
||||
],
|
||||
},
|
||||
];
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue