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