broke out the setting of index/query/etc. on the datasource in discover app.

This commit is contained in:
Spencer Alger 2014-03-24 16:57:05 -07:00
parent 2d1585c7af
commit ba6a9474dd

View file

@ -100,17 +100,7 @@ define(function (require) {
}
};
$scope.fetch = function () {
if (!$scope.fields) getFields();
search
.size($scope.opts.sampleSize)
.query(!$scope.query ? null : {
query_string: {
query: $scope.query
}
});
function updateDataSource() {
if ($scope.opts.index !== search.get('index')) {
// set the index on the savedSearch
search.index($scope.opts.index);
@ -118,6 +108,19 @@ define(function (require) {
$scope.columns = $scope.fields = null;
}
if (!$scope.fields) getFields();
search
.size($scope.opts.sampleSize)
.query(!$scope.query ? null : {
query_string: {
query: $scope.query
}
});
}
$scope.fetch = function () {
updateDataSource();
// fetch just this savedSearch
search.fetch();
};
@ -212,6 +215,7 @@ define(function (require) {
}
}
updateDataSource();
$scope.$emit('application.load');
});
});