Commit 5e487508 by Ryan McKinley Committed by Torkel Ödegaard

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

parent ef44a05b
......@@ -15,6 +15,7 @@ import {
ScopedVars,
toSeriesData,
guessFieldTypes,
DataQuery,
} from '@grafana/ui';
interface RenderProps {
......@@ -24,7 +25,7 @@ interface RenderProps {
export interface Props {
datasource: string | null;
queries: any[];
queries: DataQuery[];
panelId: number;
dashboardId?: number;
isVisible?: boolean;
......
......@@ -6,7 +6,8 @@ import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { getExploreUrl } from 'app/core/utils/explore';
import { applyPanelTimeOverrides, getResolution } from 'app/features/dashboard/utils/panel';
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 {
scope: any;
......@@ -17,15 +18,15 @@ class MetricsPanelCtrl extends PanelCtrl {
datasourceSrv: any;
timeSrv: any;
templateSrv: any;
range: any;
range: TimeRange;
interval: any;
intervalMs: any;
resolution: any;
timeInfo: any;
timeInfo?: string;
skipDataOnInit: boolean;
dataStream: any;
dataSubscription: any;
dataList: any;
dataSubscription?: Unsubscribable;
dataList: LegacyResponseData[];
constructor($scope, $injector) {
super($scope, $injector);
......
......@@ -164,7 +164,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
const logBase = this.panel.yAxis.logBase;
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)
const isIntervalString = kbn.interval_regex.test(this.panel.xBucketSize);
......@@ -333,7 +333,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
if (datapoints && datapoints.length > 0) {
const last = datapoints[datapoints.length - 1][1];
const from = this.range.from;
if (last - from < -10000) {
if (last - from.valueOf() < -10000) {
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