Run request when Raw Data tto Raw Document switch

This commit is contained in:
Ivana 2020-07-10 16:54:33 +02:00
parent b2b04dd1b1
commit b6e7609172

View File

@ -51,9 +51,15 @@ export class ElasticQueryCtrl extends QueryCtrl {
}
queryUpdated() {
// As Raw Data and Raw Document have the same request, we need to run refresh if they are updated
const isPossiblyRawDataSwitch = this.target.metrics.some(
(metric: any) => metric.type === 'raw_data' || metric.type === 'raw_document'
);
const newJson = angular.toJson(this.datasource.queryBuilder.build(this.target), true);
if (this.rawQueryOld && newJson !== this.rawQueryOld) {
this.refresh();
} else if (isPossiblyRawDataSwitch) {
this.refresh();
}
this.rawQueryOld = newJson;