Merge pull request #98 from flant/fix_6_7

fix: make it work in 6.7 and 7.0+
This commit is contained in:
Ivan Mikheykin
2020-05-23 13:16:28 +03:00
committed by GitHub
7 changed files with 41 additions and 19 deletions
+7 -8
View File
@@ -379,15 +379,14 @@ System.register(["lodash", "jquery", "d3", "./libs/d3-scale-chromatic/index", "a
} else { } else {
rangeFrom = 0; rangeFrom = 0;
} }
} } // console.log("legend state:", {
// rangeFrom: rangeFrom,
// rangeTo: rangeTo,
// maxValue: maxValue,
// minValue: minValue,
// colorMode: panel.color.mode
// });
console.log("legent state:", {
rangeFrom: rangeFrom,
rangeTo: rangeTo,
maxValue: maxValue,
minValue: minValue,
colorMode: panel.color.mode
});
if (panel.color.mode === 'spectrum') { if (panel.color.mode === 'spectrum') {
var colorScheme = _.find(ctrl.colorSchemes, { var colorScheme = _.find(ctrl.colorSchemes, {
+1 -1
View File
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -405,6 +405,16 @@ System.register(["lodash", "./color_legend", "app/core/utils/kbn", "app/plugins/
var chartWidth = _.max([panelWidth - 200, panelWidth / 2]); var chartWidth = _.max([panelWidth - 200, panelWidth / 2]);
return chartWidth; return chartWidth;
} // Quick workaround for 6.7 and 7.0+. There is no call to
// calculateInterval in updateTimeRange in those versions.
}, {
key: "updateTimeRange",
value: function updateTimeRange() {
var ret = _get(_getPrototypeOf(StatusHeatmapCtrl.prototype), "updateTimeRange", this).call(this);
this.calculateInterval();
return ret;
} // calculateInterval is called on 'refresh' to calculate an interval } // calculateInterval is called on 'refresh' to calculate an interval
// for datasource. // for datasource.
// It is override of calculateInterval from MetricsPanelCtrl. // It is override of calculateInterval from MetricsPanelCtrl.
@@ -502,9 +512,11 @@ System.register(["lodash", "./color_legend", "app/core/utils/kbn", "app/plugins/
value: function onDataReceived(dataList) { value: function onDataReceived(dataList) {
var _this3 = this; var _this3 = this;
//console.log("data",dataList)
this.data = dataList; this.data = dataList;
this.bucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true); this.bucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true);
this.noDatapoints = this.bucketMatrix.noDatapoints; this.noDatapoints = this.bucketMatrix.noDatapoints; //console.log("buckets",this.bucketMatrix)
this.annotationsPromise.then(function (result) { this.annotationsPromise.then(function (result) {
_this3.loading = false; //this.alertState = result.alertState; _this3.loading = false; //this.alertState = result.alertState;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -83,13 +83,13 @@ coreModule.directive('statusHeatmapLegend', function() {
} }
} }
console.log("legent state:", { // console.log("legend state:", {
rangeFrom: rangeFrom, // rangeFrom: rangeFrom,
rangeTo: rangeTo, // rangeTo: rangeTo,
maxValue: maxValue, // maxValue: maxValue,
minValue: minValue, // minValue: minValue,
colorMode: panel.color.mode // colorMode: panel.color.mode
}); // });
if (panel.color.mode === 'spectrum') { if (panel.color.mode === 'spectrum') {
let colorScheme = _.find(ctrl.colorSchemes, {value: panel.color.colorScheme}); let colorScheme = _.find(ctrl.colorSchemes, {value: panel.color.colorScheme});
+11
View File
@@ -262,6 +262,14 @@ class StatusHeatmapCtrl extends MetricsPanelCtrl {
return chartWidth!; return chartWidth!;
} }
// Quick workaround for 6.7 and 7.0+. There is no call to
// calculateInterval in updateTimeRange in those versions.
updateTimeRange() {
let ret = super.updateTimeRange();
this.calculateInterval();
return ret;
}
// calculateInterval is called on 'refresh' to calculate an interval // calculateInterval is called on 'refresh' to calculate an interval
// for datasource. // for datasource.
// It is override of calculateInterval from MetricsPanelCtrl. // It is override of calculateInterval from MetricsPanelCtrl.
@@ -356,10 +364,13 @@ class StatusHeatmapCtrl extends MetricsPanelCtrl {
onDataReceived(dataList: any) { onDataReceived(dataList: any) {
//console.log("data",dataList)
this.data = dataList; this.data = dataList;
this.bucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true); this.bucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true);
this.noDatapoints = this.bucketMatrix.noDatapoints; this.noDatapoints = this.bucketMatrix.noDatapoints;
//console.log("buckets",this.bucketMatrix)
this.annotationsPromise.then( this.annotationsPromise.then(
(result: { alertState: any; annotations: any }) => { (result: { alertState: any; annotations: any }) => {
this.loading = false; this.loading = false;