You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2013/12/04 11:08:30 UTC
git commit: AMBARI-3961 Add flag to enable minimal responses. (atkach)
Updated Branches:
refs/heads/trunk 32e003998 -> a95e6e7f5
AMBARI-3961 Add flag to enable minimal responses. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a95e6e7f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a95e6e7f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a95e6e7f
Branch: refs/heads/trunk
Commit: a95e6e7f5b84d9e7cd231765491c0746aa3d5c6b
Parents: 32e0039
Author: atkach <an...@gmail.com>
Authored: Wed Dec 4 12:08:18 2013 +0200
Committer: atkach <an...@gmail.com>
Committed: Wed Dec 4 12:08:18 2013 +0200
----------------------------------------------------------------------
.../app/controllers/global/cluster_controller.js | 5 +++--
.../app/controllers/global/update_controller.js | 3 ++-
ambari-web/app/mappers/hosts_mapper.js | 13 +++++++------
ambari-web/app/mappers/status_mapper.js | 17 +++++++++--------
4 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95e6e7f/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 95e2370..bbf5fe5 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -268,7 +268,7 @@ App.ClusterController = Em.Controller.extend({
return false;
}
var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hc_host_status.json':'/data/dashboard/services.json';
- var statusUrl = '/hosts?fields=Hosts/host_status,host_components/HostRoles/state';
+ var statusUrl = '/hosts?fields=Hosts/host_status,host_components/HostRoles/state&minimal_response=true';
//desired_state property is eliminated since calculateState function is commented out, it become useless
statusUrl = this.getUrl(testUrl, statusUrl);
@@ -316,7 +316,8 @@ App.ClusterController = Em.Controller.extend({
var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
var hostsRealUrl = '/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count,Hosts/total_mem,' +
'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components,Hosts/disk_info,' +
- 'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free';
+ 'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free'+
+ '&minimal_response=true';
var usersUrl = App.testMode ? '/data/users/users.json' : App.apiPrefix + '/users/?fields=*';
var racksUrl = "/data/racks/racks.json";
var dataSetUrl = "/data/mirroring/all_datasets.json";
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95e6e7f/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 9bc2db3..8dd7bc0 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -81,7 +81,8 @@ App.UpdateController = Em.Controller.extend({
updateHost:function(callback) {
var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hosts.json' : '/data/hosts/hosts.json';
var hostsUrl = this.getUrl(testUrl, '/hosts?fields=Hosts/host_name,Hosts/host_status,Hosts/last_heartbeat_time,Hosts/disk_info,' +
- 'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free');
+ 'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free'+
+ '&minimal_response=true');
App.HttpClient.get(hostsUrl, App.hostsMapper, {
complete: callback
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95e6e7f/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 81d1f45..2922c46 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -68,17 +68,18 @@ App.hostsMapper = App.QuickDataMapper.create({
var isModelLoaded = false;
json.items.forEach(function (item) {
+ var hostName = item.Hosts.host_name;
//receive host_components when hosts were added
item.host_components = item.host_components || [];
item.host_components.forEach(function (host_component) {
- host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
+ host_component.id = host_component.HostRoles.component_name + "_" + hostName;
}, this);
- hostIds[item.Hosts.host_name] = true;
- currentHostStatuses[item.Hosts.host_name] = item.Hosts.host_status;
+ hostIds[hostName] = true;
+ currentHostStatuses[hostName] = item.Hosts.host_status;
var parsedItem = this.parseIt(item, this.config);
- var hostCache = cacheData[item.Hosts.host_name];
+ var hostCache = cacheData[hostName];
hostsWithFullInfo.push(parsedItem);
if (hostCache) {
@@ -86,10 +87,10 @@ App.hostsMapper = App.QuickDataMapper.create({
modifiedHosts.push(parsedItem);
delete hostCache.is_modified;
} else {
- hostsData[item.Hosts.host_name] = this.getDiscrepancies(parsedItem, previousResponse[item.Hosts.host_name]);
+ hostsData[hostName] = this.getDiscrepancies(parsedItem, previousResponse[hostName]);
}
}
- previousResponse[item.Hosts.host_name] = parsedItem;
+ previousResponse[hostName] = parsedItem;
}, this);
App.cache['previousHostStatuses'] = currentHostStatuses;
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95e6e7f/ambari-web/app/mappers/status_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/status_mapper.js b/ambari-web/app/mappers/status_mapper.js
index 45fd23f..67fa5cd 100644
--- a/ambari-web/app/mappers/status_mapper.js
+++ b/ambari-web/app/mappers/status_mapper.js
@@ -34,14 +34,15 @@ App.statusMapper = App.QuickDataMapper.create({
var hostComponentsOnService = {};
json.items.forEach(function (host) {
+ var hostName = host.Hosts.host_name;
//update hosts, which have status changed
- if (previousHostStatuses[host.Hosts.host_name] !== host.Hosts.host_status) {
- hostStatuses[host.Hosts.host_name] = host.Hosts.host_status;
+ if (previousHostStatuses[hostName] !== host.Hosts.host_status) {
+ hostStatuses[hostName] = host.Hosts.host_status;
}
- currentHostStatuses[host.Hosts.host_name] = host.Hosts.host_status;
+ currentHostStatuses[hostName] = host.Hosts.host_status;
var hostComponentsOnHost = [];
host.host_components.forEach(function (host_component) {
- host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
+ host_component.id = host_component.HostRoles.component_name + "_" + hostName;
var existedComponent = previousComponentStatuses[host_component.id];
var service = componentServiceMap[host_component.HostRoles.component_name];
@@ -55,11 +56,11 @@ App.statusMapper = App.QuickDataMapper.create({
id: host_component.id,
component_name: host_component.HostRoles.component_name,
work_status: host_component.HostRoles.state,
- host_id: host.Hosts.host_name,
+ host_id: hostName,
service_id: service
});
//update host-components only on adding due to Ember Data features
- if (hostsCache[host.Hosts.host_name]) hostsCache[host.Hosts.host_name].is_modified = true;
+ if (hostsCache[hostName]) hostsCache[hostName].is_modified = true;
}
currentComponentStatuses[host_component.id] = host_component.HostRoles.state;
@@ -76,8 +77,8 @@ App.statusMapper = App.QuickDataMapper.create({
/**
* updating relation between Host and his host-components
*/
- if (hostsCache[host.Hosts.host_name]) {
- hostsCache[host.Hosts.host_name].host_components = hostComponentsOnHost;
+ if (hostsCache[hostName]) {
+ hostsCache[hostName].host_components = hostComponentsOnHost;
}
}, this);