Commit 5e487508 by Ryan McKinley Committed by Torkel Ödegaard

Panels: Add types for DataList and range (#16500)

parent ef44a05b
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
ScopedVars, ScopedVars,
toSeriesData, toSeriesData,
guessFieldTypes, guessFieldTypes,
DataQuery,
} from '@grafana/ui'; } from '@grafana/ui';
interface RenderProps { interface RenderProps {
...@@ -24,7 +25,7 @@ interface RenderProps { ...@@ -24,7 +25,7 @@ interface RenderProps {
export interface Props { export interface Props {
datasource: string | null; datasource: string | null;
queries: any[]; queries: DataQuery[];
panelId: number; panelId: number;
dashboardId?: number; dashboardId?: number;
isVisible?: boolean; isVisible?: boolean;
......
...@@ -6,7 +6,8 @@ import { PanelCtrl } from 'app/features/panel/panel_ctrl'; ...@@ -6,7 +6,8 @@ import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { getExploreUrl } from 'app/core/utils/explore'; import { getExploreUrl } from 'app/core/utils/explore';
import { applyPanelTimeOverrides, getResolution } from 'app/features/dashboard/utils/panel'; import { applyPanelTimeOverrides, getResolution } from 'app/features/dashboard/utils/panel';
import { ContextSrv } from 'app/core/services/context_srv'; import { ContextSrv } from 'app/core/services/context_srv';
import { toLegacyResponseData, isSeriesData } from '@grafana/ui'; import { toLegacyResponseData, isSeriesData, LegacyResponseData, TimeRange } from '@grafana/ui';
import { Unsubscribable } from 'rxjs';
class MetricsPanelCtrl extends PanelCtrl { class MetricsPanelCtrl extends PanelCtrl {
scope: any; scope: any;
...@@ -17,15 +18,15 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -17,15 +18,15 @@ class MetricsPanelCtrl extends PanelCtrl {
datasourceSrv: any; datasourceSrv: any;
timeSrv: any; timeSrv: any;
templateSrv: any; templateSrv: any;
range: any; range: TimeRange;
interval: any; interval: any;
intervalMs: any; intervalMs: any;
resolution: any; resolution: any;
timeInfo: any; timeInfo?: string;
skipDataOnInit: boolean; skipDataOnInit: boolean;
dataStream: any; dataStream: any;
dataSubscription: any; dataSubscription?: Unsubscribable;
dataList: any; dataList: LegacyResponseData[];
constructor($scope, $injector) { constructor($scope, $injector) {
super($scope, $injector); super($scope, $injector);
......
...@@ -164,7 +164,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl { ...@@ -164,7 +164,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
const logBase = this.panel.yAxis.logBase; const logBase = this.panel.yAxis.logBase;
const xBucketNumber = this.panel.xBucketNumber || X_BUCKET_NUMBER_DEFAULT; const xBucketNumber = this.panel.xBucketNumber || X_BUCKET_NUMBER_DEFAULT;
const xBucketSizeByNumber = Math.floor((this.range.to - this.range.from) / xBucketNumber); const xBucketSizeByNumber = Math.floor((this.range.to.valueOf() - this.range.from.valueOf()) / xBucketNumber);
// Parse X bucket size (number or interval) // Parse X bucket size (number or interval)
const isIntervalString = kbn.interval_regex.test(this.panel.xBucketSize); const isIntervalString = kbn.interval_regex.test(this.panel.xBucketSize);
...@@ -333,7 +333,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl { ...@@ -333,7 +333,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
if (datapoints && datapoints.length > 0) { if (datapoints && datapoints.length > 0) {
const last = datapoints[datapoints.length - 1][1]; const last = datapoints[datapoints.length - 1][1];
const from = this.range.from; const from = this.range.from;
if (last - from < -10000) { if (last - from.valueOf() < -10000) {
series.isOutsideRange = true; series.isOutsideRange = true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment