-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'migrate-to-react' into feat/AN-4128_make-new-data-query…
…-compatible-with-old-example-dashboard-json
- Loading branch information
Showing
7 changed files
with
437 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import type { SelectableValue } from '@grafana/data'; | ||
|
||
export type Aggregation = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'stddev' | 'percentile' | 'variance' | 'median'; | ||
const AGGREGATIONS = ['count', 'sum', 'avg', 'min', 'max', 'stddev', 'percentile', 'variance', 'median'] as const; | ||
|
||
export const SELECTABLE_AGGREGATIONS: Array<SelectableValue<Aggregation>> = [ | ||
{ value: 'count', label: 'Count' }, | ||
{ value: 'sum', label: 'Sum' }, | ||
{ value: 'avg', label: 'Avg' }, | ||
{ value: 'min', label: 'Min' }, | ||
{ value: 'max', label: 'Max' }, | ||
{ value: 'stddev', label: 'Stddev' }, | ||
{ value: 'percentile', label: 'Percentile' }, | ||
{ value: 'variance', label: 'Variance' }, | ||
{ value: 'median', label: 'Median' }, | ||
]; | ||
export type Aggregation = (typeof AGGREGATIONS)[number]; | ||
|
||
export const SELECTABLE_AGGREGATIONS: Array<SelectableValue<Aggregation>> = AGGREGATIONS.map((aggregation) => ({ | ||
value: aggregation, | ||
label: aggregation, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
import { SelectableValue } from '@grafana/data'; | ||
|
||
export enum METRICS { | ||
AVG_CONCURRENTVIEWERS = 'AVG_CONCURRENTVIEWERS', | ||
MAX_CONCURRENTVIEWERS = 'MAX_CONCURRENTVIEWERS', | ||
AVG_DROPPED_FRAMES = 'AVG_DROPPED_FRAMES', | ||
} | ||
const METRICS = ['AVG_CONCURRENTVIEWERS', 'MAX_CONCURRENTVIEWERS', 'AVG_DROPPED_FRAMES'] as const; | ||
|
||
export type Metric = (typeof METRICS)[keyof typeof METRICS]; | ||
export type Metric = (typeof METRICS)[number]; | ||
|
||
export const SELECTABLE_METRICS: Array<SelectableValue<Metric>> = [ | ||
{ value: METRICS.AVG_CONCURRENTVIEWERS, label: 'Avg Concurrent Viewers' }, | ||
{ value: METRICS.MAX_CONCURRENTVIEWERS, label: 'Max Concurrent Viewers' }, | ||
{ value: METRICS.AVG_DROPPED_FRAMES, label: 'Avg Dropped Frames' }, | ||
]; | ||
export const SELECTABLE_METRICS: Array<SelectableValue<Metric>> = METRICS.map((metric) => ({ | ||
value: metric, | ||
label: metric, | ||
})); | ||
|
||
export const isMetric = (value: string): boolean => { | ||
return Object.values(METRICS).includes(value as Metric); | ||
export const isMetric = (value: string): value is Metric => { | ||
return METRICS.includes(value as Metric); | ||
}; |
Oops, something went wrong.