Commit 54b677bd by Ryan McKinley Committed by GitHub

Graph: show range warning when all data is outside time range (#27603)

parent a524c572
...@@ -271,35 +271,35 @@ export class GraphCtrl extends MetricsPanelCtrl { ...@@ -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) { for (const series of this.seriesList) {
if (!series.isOutsideRange) { if (!series.isOutsideRange) {
continue; return undefined;
} }
}
const dataWarning: DataWarning = { // All data is outside the time range
title: 'Data outside time range', const dataWarning: DataWarning = {
tip: 'Can be caused by timezone mismatch or missing time filter in query', 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,
},
});
}; };
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;
return dataWarning;
} }
onRender() { onRender() {
......
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