Merge branch 'cache-service' into grafana-3.0
This commit is contained in:
@@ -295,14 +295,14 @@ function (angular, _, dateMath, utils, metricFunctions) {
|
||||
// Get items
|
||||
if (parts.length === 4) {
|
||||
//var items = this.queryProcessor.filterItems(template.host, template.app, true);
|
||||
return this.queryProcessor.filterItems(template.host, template.app, true)
|
||||
return this.queryProcessor.filterItems(template.group, template.host, template.app, true)
|
||||
.then(function(items) {
|
||||
return _.map(items, formatMetric);
|
||||
});
|
||||
}
|
||||
// Get applications
|
||||
else if (parts.length === 3) {
|
||||
return this.queryProcessor.filterApplications(template.host)
|
||||
return this.queryProcessor.filterApplications(template.group, template.host)
|
||||
.then(function(apps) {
|
||||
return _.map(apps, formatMetric);
|
||||
});
|
||||
|
||||
@@ -112,17 +112,20 @@ define([
|
||||
};
|
||||
|
||||
$scope.filterApplications = function () {
|
||||
var groupFilter = templateSrv.replace($scope.target.group.filter);
|
||||
var hostFilter = templateSrv.replace($scope.target.host.filter);
|
||||
$scope.datasource.queryProcessor.filterApplications(hostFilter).then(function(apps) {
|
||||
$scope.datasource.queryProcessor.filterApplications(groupFilter, hostFilter)
|
||||
.then(function(apps) {
|
||||
$scope.metric.filteredApplications = apps;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.filterItems = function () {
|
||||
var groupFilter = templateSrv.replace($scope.target.group.filter);
|
||||
var hostFilter = templateSrv.replace($scope.target.host.filter);
|
||||
var appFilter = templateSrv.replace($scope.target.application.filter);
|
||||
$scope.datasource.queryProcessor.filterItems(hostFilter, appFilter, $scope.target.showDisabledItems)
|
||||
.then(function(items) {
|
||||
$scope.datasource.queryProcessor.filterItems(groupFilter, hostFilter, appFilter,
|
||||
$scope.target.showDisabledItems).then(function(items) {
|
||||
$scope.metric.filteredItems = items;
|
||||
});
|
||||
};
|
||||
@@ -135,21 +138,21 @@ define([
|
||||
|
||||
// Handle group blur and filter hosts
|
||||
$scope.onGroupBlur = function() {
|
||||
$scope.filterHosts();
|
||||
$scope.initFilters();
|
||||
$scope.parseTarget();
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
// Handle host blur and filter applications
|
||||
$scope.onHostBlur = function() {
|
||||
$scope.filterApplications();
|
||||
$scope.initFilters();
|
||||
$scope.parseTarget();
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
// Handle application blur and filter items
|
||||
$scope.onApplicationBlur = function() {
|
||||
$scope.filterItems();
|
||||
$scope.initFilters();
|
||||
$scope.parseTarget();
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
@@ -63,12 +63,12 @@ function (angular, _, utils) {
|
||||
});
|
||||
};
|
||||
|
||||
this.filterApplications = function(hostFilter) {
|
||||
this.filterApplications = function(groupFilter, hostFilter) {
|
||||
var hosts = [];
|
||||
var apps = [];
|
||||
|
||||
var promises = [
|
||||
this.cache.getHosts(),
|
||||
this.filterHosts(groupFilter),
|
||||
this.cache.getApplications()
|
||||
];
|
||||
|
||||
@@ -103,15 +103,15 @@ function (angular, _, utils) {
|
||||
});
|
||||
};
|
||||
|
||||
this.filterItems = function (hostFilter, appFilter, showDisabledItems) {
|
||||
this.filterItems = function (groupFilter, hostFilter, appFilter, showDisabledItems) {
|
||||
var hosts = [];
|
||||
var apps = [];
|
||||
var items = [];
|
||||
|
||||
var promises = [
|
||||
this.cache.getHosts(),
|
||||
this.cache.getApplications(),
|
||||
this.cache.getItems()
|
||||
this.filterHosts(groupFilter),
|
||||
this.filterApplications(groupFilter, hostFilter),
|
||||
this.cache.getItems(),
|
||||
];
|
||||
|
||||
return $q.all(promises).then(function(results) {
|
||||
|
||||
Reference in New Issue
Block a user