GroupBy: add new groupby variable type and optional groupByKeys (#81717)

* add new groupby type

* rename to groupByKeys + introduce GroupByVariableModel

* fix unit test

* update scenes package

* update interface

* update fixture

* update unit test

* bump to scenes 2.6.2

* remove baseFilters for now
This commit is contained in:
Ashley Harrison
2024-02-07 11:14:04 +00:00
committed by GitHub
parent 5b9b990220
commit af8ea896d0
13 changed files with 97 additions and 34 deletions

View File

@@ -560,6 +560,7 @@ export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
/** Filters to dynamically apply to all queries */
filters?: AdHocVariableFilter[];
groupByKeys?: string[];
// Request Timing
startTime: number;

View File

@@ -1,4 +1,5 @@
import { LoadingState } from './data';
import { MetricFindValue } from './datasource';
import { DataSourceRef } from './query';
export type VariableType = TypedVariableModel['type'];
@@ -13,6 +14,7 @@ export interface VariableModel {
export type TypedVariableModel =
| QueryVariableModel
| AdHocVariableModel
| GroupByVariableModel
| ConstantVariableModel
| DataSourceVariableModel
| IntervalVariableModel
@@ -64,6 +66,14 @@ export interface AdHocVariableModel extends BaseVariableModel {
baseFilters?: AdHocVariableFilter[];
}
export interface GroupByVariableModel extends BaseVariableModel {
type: 'groupby';
datasource: DataSourceRef | null;
groupByKeys: string[];
defaultOptions?: MetricFindValue[];
multi: true;
}
export interface VariableOption {
selected: boolean;
text: string | string[];