mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
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'
|
} = typeof options === 'function'
|
||||||
? { buildQuery: options, queryFields: {} }
|
? { buildQuery: options, queryFields: {} }
|
||||||
: options || {};
|
: options || {};
|
||||||
return {
|
const queries = buildQuery(buildQueryObject(formData, queryFields), {
|
||||||
datasource: new DatasourceKey(formData.datasource).toObject(),
|
|
||||||
force: formData.force || false,
|
|
||||||
queries: buildQuery(buildQueryObject(formData, queryFields), {
|
|
||||||
extras: {},
|
extras: {},
|
||||||
ownState,
|
ownState,
|
||||||
hooks: {
|
hooks: {
|
||||||
@ -72,7 +69,17 @@ export default function buildQueryContext(
|
|||||||
setCachedChanges: () => {},
|
setCachedChanges: () => {},
|
||||||
...hooks,
|
...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,
|
form_data: formData,
|
||||||
result_format: formData.result_format || 'json',
|
result_format: formData.result_format || 'json',
|
||||||
result_type: formData.result_type || 'full',
|
result_type: formData.result_type || 'full',
|
||||||
|
@ -86,7 +86,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||||||
is_timeseries,
|
is_timeseries,
|
||||||
}),
|
}),
|
||||||
flattenOperator(fd, queryObject),
|
flattenOperator(fd, queryObject),
|
||||||
].filter(Boolean),
|
],
|
||||||
} as QueryObject;
|
} as QueryObject;
|
||||||
return [normalizeOrderBy(tmpQueryObject)];
|
return [normalizeOrderBy(tmpQueryObject)];
|
||||||
}),
|
}),
|
||||||
|
@ -100,7 +100,7 @@ export default function buildQuery(formData: QueryFormData) {
|
|||||||
flattenOperator(formData, baseQueryObject),
|
flattenOperator(formData, baseQueryObject),
|
||||||
// todo: move prophet before flatten
|
// todo: move prophet before flatten
|
||||||
prophetOperator(formData, baseQueryObject),
|
prophetOperator(formData, baseQueryObject),
|
||||||
].filter(Boolean),
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user