mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-21 23:42:03 +00:00
fix: compatibility with Grafana 7.4
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -8,6 +8,12 @@ import { Emitter } from 'grafana/app/core/utils/emitter';
|
|||||||
// This method detects this behaviour and return true
|
// This method detects this behaviour and return true
|
||||||
// only for new Grafana versions.
|
// only for new Grafana versions.
|
||||||
export function hasAppEventCompatibleEmitter(emitter: Emitter): boolean {
|
export function hasAppEventCompatibleEmitter(emitter: Emitter): boolean {
|
||||||
|
// Grafana 7.4 has new event bus for Angular plugins. It is has a 'subscribe' method.
|
||||||
|
let emitterProto = Object.getPrototypeOf(emitter);
|
||||||
|
if (Object.prototype.hasOwnProperty.call(emitterProto, 'subscribe')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
let receiveEvents = 0;
|
let receiveEvents = 0;
|
||||||
let eventId: any = { name: 'non-existed-event-id' };
|
let eventId: any = { name: 'non-existed-event-id' };
|
||||||
let eventId2: any = { name: 'non-existed-event-id-2' };
|
let eventId2: any = { name: 'non-existed-event-id-2' };
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class StatusHeatmapCtrl extends MetricsPanelCtrl {
|
|||||||
bucketMatrixPager: BucketMatrixPager;
|
bucketMatrixPager: BucketMatrixPager;
|
||||||
|
|
||||||
graph: any;
|
graph: any;
|
||||||
discreteHelper: ColorModeDiscrete;
|
|
||||||
opacityScales: any = [];
|
opacityScales: any = [];
|
||||||
colorModes: any = [];
|
colorModes: any = [];
|
||||||
colorSchemes: any = [];
|
colorSchemes: any = [];
|
||||||
|
|||||||
+5
-4
@@ -1,9 +1,9 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
|
||||||
|
// TODO moment is used instead of @grafana/data to run in 6.2 and earlier.
|
||||||
/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */
|
/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */
|
||||||
// import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { toUtc } from '@grafana/data';
|
|
||||||
|
|
||||||
import kbn from 'grafana/app/core/utils/kbn';
|
import kbn from 'grafana/app/core/utils/kbn';
|
||||||
import { appEvents, contextSrv } from 'grafana/app/core/core';
|
import { appEvents, contextSrv } from 'grafana/app/core/core';
|
||||||
@@ -643,9 +643,10 @@ export class StatusmapRenderer {
|
|||||||
Math.max(this.selection.x1, this.selection.x2) - this.yAxisWidth - this.xGridSize / 2
|
Math.max(this.selection.x1, this.selection.x2) - this.yAxisWidth - this.xGridSize / 2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO use toUtc method from moment wrapper in @grafana/data
|
||||||
this.ctrl.timeSrv.setTime({
|
this.ctrl.timeSrv.setTime({
|
||||||
from: toUtc(timeFrom),
|
from: moment.utc(timeFrom),
|
||||||
to: toUtc(timeTo),
|
to: moment.utc(timeTo),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user