You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/10/03 22:55:24 UTC
git commit: AMBARI-3441. Inefficient API call being made get
service's actual configs. (srimanth)
Updated Branches:
refs/heads/trunk 639b728d4 -> 6b8311d3e
AMBARI-3441. Inefficient API call being made get service's actual configs. (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/6b8311d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/6b8311d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/6b8311d3
Branch: refs/heads/trunk
Commit: 6b8311d3e17d8ec0bb4ef39a688e1c48fa3d0527
Parents: 639b728
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Wed Oct 2 18:09:49 2013 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Oct 3 13:55:10 2013 -0700
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 65 ++++++++++----------
1 file changed, 32 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b8311d3/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 99854c9..adf3c98 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -230,7 +230,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
propertyToHostAndComponent: {}
};
var self = this;
- var actualConfigsUrl = this.getUrl('/data/services/host_component_actual_configs.json', '/services?fields=components/host_components/HostRoles/actual_configs');
+ var actualConfigsUrl = this.getUrl('/data/services/host_component_actual_configs.json',
+ '/services/'+currentService+'?fields=components/host_components/HostRoles/actual_configs');
$.ajax({
type: 'GET',
url: actualConfigsUrl,
@@ -241,43 +242,41 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
var diffHostComponents = [];
console.debug("loadActualConfigs(" + actualConfigsUrl + "): Data=", data);
var configsToDownload = [];
- data.items.forEach(function (service) {
+ data.components.forEach(function (serviceComponent) {
// For current service, do any of the host_components differ in
// configuration?
- if (currentService === service.ServiceInfo.service_name) {
- service.components.forEach(function (serviceComponent) {
- serviceComponent.host_components.forEach(function (hostComponent) {
- if (hostComponent.HostRoles.actual_configs) {
- for (var site in hostComponent.HostRoles.actual_configs) {
- var actualConfigsTags = hostComponent.HostRoles.actual_configs[site];
- var desiredConfigTags = self.getDesiredConfigTag(site, hostComponent.HostRoles.host_name);
- var desiredConfigOverrideTag = desiredConfigTags.host_override != null ?
- desiredConfigTags.host_override : null;
- var actualConfigOverrideTag = (actualConfigsTags.host_overrides!=null &&
- actualConfigsTags.host_overrides.length>0) ?
- actualConfigsTags.host_overrides[0].tag : null;
- if ((actualConfigsTags.tag &&
- desiredConfigTags.tag &&
- desiredConfigTags.tag !== actualConfigsTags.tag) ||
+ if (currentService === serviceComponent.ServiceComponentInfo.service_name) {
+ serviceComponent.host_components.forEach(function (hostComponent) {
+ if (hostComponent.HostRoles.actual_configs) {
+ for (var site in hostComponent.HostRoles.actual_configs) {
+ var actualConfigsTags = hostComponent.HostRoles.actual_configs[site];
+ var desiredConfigTags = self.getDesiredConfigTag(site, hostComponent.HostRoles.host_name);
+ var desiredConfigOverrideTag = desiredConfigTags.host_override != null ?
+ desiredConfigTags.host_override : null;
+ var actualConfigOverrideTag = (actualConfigsTags.host_overrides!=null &&
+ actualConfigsTags.host_overrides.length>0) ?
+ actualConfigsTags.host_overrides[0].tag : null;
+ if ((actualConfigsTags.tag &&
+ desiredConfigTags.tag &&
+ desiredConfigTags.tag !== actualConfigsTags.tag) ||
(desiredConfigOverrideTag !== actualConfigOverrideTag)) {
- actualConfigsTags.host_override = actualConfigOverrideTag;
- // Restart may be necessary for this host-component
- diffHostComponents.push({
- componentName: hostComponent.HostRoles.component_name,
- serviceName: serviceComponent.ServiceComponentInfo.service_name,
- host: hostComponent.HostRoles.host_name,
- type: site,
- desiredConfigTags: desiredConfigTags,
- actualConfigTags: actualConfigsTags
- });
- self.addConfigDownloadParam(site, actualConfigsTags.tag, configsToDownload);
- self.addConfigDownloadParam(site, actualConfigsTags.host_override, configsToDownload);
- self.addConfigDownloadParam(site, desiredConfigTags.tag, configsToDownload);
- self.addConfigDownloadParam(site, desiredConfigTags.host_override, configsToDownload);
- }
+ actualConfigsTags.host_override = actualConfigOverrideTag;
+ // Restart may be necessary for this host-component
+ diffHostComponents.push({
+ componentName: hostComponent.HostRoles.component_name,
+ serviceName: serviceComponent.ServiceComponentInfo.service_name,
+ host: hostComponent.HostRoles.host_name,
+ type: site,
+ desiredConfigTags: desiredConfigTags,
+ actualConfigTags: actualConfigsTags
+ });
+ self.addConfigDownloadParam(site, actualConfigsTags.tag, configsToDownload);
+ self.addConfigDownloadParam(site, actualConfigsTags.host_override, configsToDownload);
+ self.addConfigDownloadParam(site, desiredConfigTags.tag, configsToDownload);
+ self.addConfigDownloadParam(site, desiredConfigTags.host_override, configsToDownload);
}
}
- });
+ }
});
}
});