mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
feat: auto refresh dashboard (#37459)
Co-authored-by: Richard <richard@ip-192-168-1-32.sa-east-1.compute.internal> Co-authored-by: richard <richard@richards-MacBook-Pro-2.local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
committed by
GitHub
parent
f60432e34c
commit
fca8a49561
@@ -17,17 +17,26 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { buildQueryContext } from '@superset-ui/core';
|
||||
import { buildQueryContext, QueryFormOrderBy } from '@superset-ui/core';
|
||||
import { WordCloudFormData } from '../types';
|
||||
|
||||
export default function buildQuery(formData: WordCloudFormData) {
|
||||
// Set the single QueryObject's groupby field with series in formData
|
||||
const { metric, sort_by_metric } = formData;
|
||||
const { metric, sort_by_metric, series, row_limit } = formData;
|
||||
const orderby: QueryFormOrderBy[] = [];
|
||||
const shouldApplyOrderBy =
|
||||
row_limit !== undefined && row_limit !== null && row_limit !== 0;
|
||||
|
||||
if (sort_by_metric && metric) {
|
||||
orderby.push([metric, false]);
|
||||
}
|
||||
if (series) {
|
||||
orderby.push([series, true]);
|
||||
}
|
||||
|
||||
return buildQueryContext(formData, baseQueryObject => [
|
||||
{
|
||||
...baseQueryObject,
|
||||
...(sort_by_metric && { orderby: [[metric, false]] }),
|
||||
...(shouldApplyOrderBy && orderby.length > 0 && { orderby }),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user