[vis] expose a #requesting() method for indicating transitions in vis state
This commit is contained in:
parent
bc53427877
commit
67f09b5da5
|
@ -174,6 +174,19 @@ define(function (require) {
|
|||
return this.type.createFilter(this, key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook into param onRequest handling, and tell the aggConfig that it
|
||||
* is being sent to elasticsearc.
|
||||
*
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
AggConfig.prototype.requesting = function () {
|
||||
var self = this;
|
||||
self.type.params.forEach(function (param) {
|
||||
if (param.onRequest) param.onRequest(self);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert this aggConfig to it's dsl syntax.
|
||||
*
|
||||
|
@ -185,18 +198,10 @@ define(function (require) {
|
|||
*/
|
||||
AggConfig.prototype.toDsl = function () {
|
||||
if (this.type.hasNoDsl) return;
|
||||
|
||||
var self = this;
|
||||
self.type.params.forEach(function (param) {
|
||||
if (param.onRequest) {
|
||||
param.onRequest(self);
|
||||
}
|
||||
});
|
||||
|
||||
var output = self.write();
|
||||
var output = this.write();
|
||||
|
||||
var configDsl = {};
|
||||
configDsl[self.type.name] = output.params;
|
||||
configDsl[this.type.name] = output.params;
|
||||
|
||||
// if the config requires subAggs, write them to the dsl as well
|
||||
if (output.subAggs) {
|
||||
|
|
|
@ -90,6 +90,10 @@ define(function (require) {
|
|||
return new Vis(this.indexPattern, this.getState());
|
||||
};
|
||||
|
||||
Vis.prototype.requesting = function () {
|
||||
_.invoke(this.aggs.getRequestAggs(), 'requesting');
|
||||
};
|
||||
|
||||
Vis.prototype.isHierarchical = function () {
|
||||
if (_.isFunction(this.type.hierarchicalData)) {
|
||||
return !!this.type.hierarchicalData(this);
|
||||
|
|
|
@ -589,6 +589,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
$scope.searchSource.aggs(function () {
|
||||
$scope.vis.requesting();
|
||||
return $scope.vis.aggs.toDsl();
|
||||
});
|
||||
|
||||
|
|
|
@ -199,7 +199,9 @@ define(function (require) {
|
|||
$state.save();
|
||||
searchSource.set('filter', $state.filters);
|
||||
if (!$state.linked) searchSource.set('query', $state.query);
|
||||
if ($scope.vis.type.requiresSearch) courier.fetch();
|
||||
if ($scope.vis.type.requiresSearch) {
|
||||
courier.fetch();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ define(function (require) {
|
|||
})
|
||||
.then(function (vis) {
|
||||
self.searchSource.aggs(function () {
|
||||
self.vis.requesting();
|
||||
return self.vis.aggs.toDsl();
|
||||
});
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ define(function (require) {
|
|||
lte: bounds.max.valueOf()
|
||||
};
|
||||
}
|
||||
|
||||
return filter;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue