Skip to content

Commit

Permalink
Merge branch 'migrate-to-react' into feat/AN-4128_make-new-data-query…
Browse files Browse the repository at this point in the history
…-compatible-with-old-example-dashboard-json
  • Loading branch information
MGJamJam committed Jun 20, 2024
2 parents cd7a1bb + e612f20 commit b4abceb
Show file tree
Hide file tree
Showing 7 changed files with 437 additions and 778 deletions.
19 changes: 7 additions & 12 deletions bitmovin-analytics-datasource/src/types/aggregations.ts
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,
}));
21 changes: 8 additions & 13 deletions bitmovin-analytics-datasource/src/types/metric.ts
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);
};
Loading

0 comments on commit b4abceb

Please sign in to comment.