QueryProcessing: Added missing error event for angular editors (#19059)

* QueryProcessing: Added missing error event for angular editors

* fix if else
This commit is contained in:
Torkel Ödegaard 2019-09-13 10:09:25 +02:00 committed by GitHub
parent 076a8fc85c
commit b6c501bc8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,8 +274,12 @@ function notifyAngularQueryEditorsOfData(panel: PanelModel, data: PanelData, edi
globalLastPanelDataCache = data;
const legacy = data.series.map(v => toLegacyResponseData(v));
panel.events.emit('data-received', legacy);
if (data.state === LoadingState.Done) {
const legacy = data.series.map(v => toLegacyResponseData(v));
panel.events.emit('data-received', legacy);
} else if (data.state === LoadingState.Error) {
panel.events.emit('data-error', data.error);
}
// Some query controllers listen to data error events and need a digest
// for some reason this needs to be done in next tick