mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 07:17:08 -06:00
Graph: show range warning when all data is outside time range (#27603)
This commit is contained in:
parent
a524c57261
commit
54b677bda4
@ -271,35 +271,35 @@ export class GraphCtrl extends MetricsPanelCtrl {
|
||||
};
|
||||
}
|
||||
|
||||
// Look for data points outside time range
|
||||
// If any data is in range, do not return an error
|
||||
for (const series of this.seriesList) {
|
||||
if (!series.isOutsideRange) {
|
||||
continue;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const dataWarning: DataWarning = {
|
||||
title: 'Data outside time range',
|
||||
tip: 'Can be caused by timezone mismatch or missing time filter in query',
|
||||
};
|
||||
|
||||
const range = getDataTimeRange(this.dataList);
|
||||
|
||||
if (range) {
|
||||
dataWarning.actionText = 'Zoom to data';
|
||||
dataWarning.action = () => {
|
||||
getLocationSrv().update({
|
||||
partial: true,
|
||||
query: {
|
||||
from: range.from,
|
||||
to: range.to,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return dataWarning;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
// All data is outside the time range
|
||||
const dataWarning: DataWarning = {
|
||||
title: 'Data outside time range',
|
||||
tip: 'Can be caused by timezone mismatch or missing time filter in query',
|
||||
};
|
||||
|
||||
const range = getDataTimeRange(this.dataList);
|
||||
|
||||
if (range) {
|
||||
dataWarning.actionText = 'Zoom to data';
|
||||
dataWarning.action = () => {
|
||||
getLocationSrv().update({
|
||||
partial: true,
|
||||
query: {
|
||||
from: range.from,
|
||||
to: range.to,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return dataWarning;
|
||||
}
|
||||
|
||||
onRender() {
|
||||
|
Loading…
Reference in New Issue
Block a user