You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2017/03/27 22:57:48 UTC
[38/51] [abbrv] ambari git commit: AMBARI-19299 Wrong number of
filtered hosts.(atkach)
AMBARI-19299 Wrong number of filtered hosts.(atkach)
(cherry picked from commit 0bdd14f686b68cf18c010d00f3e67e0231a6cb54)
Change-Id: I390484344a04805e6e44ff444b9a24692d246d6e
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5caa73d7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5caa73d7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5caa73d7
Branch: refs/heads/AMBARI-2.4.2.16
Commit: 5caa73d7adadd5afb237459f41ea5e5c58f9d5c5
Parents: e3d0b7e
Author: Andrii Tkach <at...@apache.org>
Authored: Tue Dec 27 13:00:02 2016 +0200
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Wed Mar 1 12:23:18 2017 -0800
----------------------------------------------------------------------
.../app/controllers/global/update_controller.js | 18 +++++++++---------
ambari-web/app/controllers/main/host.js | 20 +++++++++++++-------
ambari-web/app/utils/http_client.js | 6 +++++-
3 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5caa73d7/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 4631f09..c54e669 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -266,7 +266,7 @@ App.UpdateController = Em.Controller.extend({
realUrl += loggingResource;
}
- var clientCallback = function (skipCall, queryParams) {
+ var clientCallback = function (skipCall, queryParams, itemTotal) {
var completeCallback = function () {
callback();
if (loadMetricsSeparately) {
@@ -290,6 +290,11 @@ App.UpdateController = Em.Controller.extend({
App.HttpClient.get(realUrl, App.hostsMapper, {
complete: completeCallback,
+ beforeMap: function(response) {
+ if (itemTotal) {
+ response.itemTotal = itemTotal;
+ }
+ },
doGetAsPost: true,
params: self.computeParameters(queryParams),
error: error
@@ -398,17 +403,12 @@ App.UpdateController = Em.Controller.extend({
if (skipCall) {
params.callback(skipCall);
} else {
- // get all non-hostcomponent related keys
- queryParams = queryParams.filter(function (param) {
- return !param.isComponentRelatedFilter;
- });
- // force specific hosts
- queryParams.push({
+ queryParams = [{
key: 'Hosts/host_name',
value: hostNames,
type: 'MULTIPLE'
- });
- params.callback(skipCall, queryParams);
+ }];
+ params.callback(skipCall, queryParams, itemTotal);
}
},
getHostByHostComponentsErrorCallback: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5caa73d7/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index b85ed95..336bd25 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -105,17 +105,20 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
{
name: 'hostComponents',
key: 'host_components/HostRoles/component_name',
- type: 'EQUAL'
+ type: 'EQUAL',
+ isComponentRelatedFilter: true
},
{
name: 'services',
key: 'host_components/HostRoles/service_name',
- type: 'MATCH'
+ type: 'MATCH',
+ isComponentRelatedFilter: true
},
{
name: 'state',
key: 'host_components/HostRoles/state',
- type: 'MATCH'
+ type: 'MATCH',
+ isComponentRelatedFilter: true
},
{
name: 'healthClass',
@@ -130,12 +133,14 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
{
name: 'componentsWithStaleConfigsCount',
key: 'host_components/HostRoles/stale_configs',
- type: 'EQUAL'
+ type: 'EQUAL',
+ isComponentRelatedFilter: true
},
{
name: 'componentsInPassiveStateCount',
key: 'host_components/HostRoles/maintenance_state',
- type: 'MULTIPLE'
+ type: 'MULTIPLE',
+ isComponentRelatedFilter: true
},
{
name: 'selected',
@@ -165,7 +170,8 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
'(host_components/HostRoles/component_name={0}&host_components/HostRoles/desired_admin_state={1})',
'(host_components/HostRoles/component_name={0}&host_components/HostRoles/maintenance_state={1})'
],
- type: 'COMBO'
+ type: 'COMBO',
+ isComponentRelatedFilter: true
}
],
@@ -259,7 +265,7 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
value: filter.value,
type: property.type,
isFilter: true,
- isComponentRelatedFilter: ([13,15].indexOf(filter.iColumn) != -1)
+ isComponentRelatedFilter: property.isComponentRelatedFilter
};
if (filter.type === 'string' && sortProperties.someProperty('name', colPropAssoc[filter.iColumn])) {
if (Em.isArray(filter.value)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5caa73d7/ambari-web/app/utils/http_client.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/http_client.js b/ambari-web/app/utils/http_client.js
index 6b94d81..7a9f51a 100644
--- a/ambari-web/app/utils/http_client.js
+++ b/ambari-web/app/utils/http_client.js
@@ -109,7 +109,11 @@ App.HttpClient = Em.Object.create({
} catch (err) {
console.warn('App.store.commit error:', err);
}
- mapper.map($.parseJSON(xhr.responseText));
+ var response = $.parseJSON(xhr.responseText);
+ if (tmp_val.beforeMap) {
+ tmp_val.beforeMap.call(self, response);
+ }
+ mapper.map(response);
tmp_val.complete.call(self);
xhr.abort();
} else {