Repository: ambari Updated Branches: refs/heads/trunk 0ba68682f -> 5e1f13dcd
AMBARI-6037. Load public host names for Quick Links. Additional patch. (Max Shepel via akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5e1f13dc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5e1f13dc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5e1f13dc Branch: refs/heads/trunk Commit: 5e1f13dcdad073e1ae3ac407b217ad84c73cbabf Parents: 0ba6868 Author: Aleksandr Kovalenko <[email protected]> Authored: Fri Jun 6 14:25:09 2014 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Fri Jun 6 14:25:20 2014 +0300 ---------------------------------------------------------------------- .../controllers/global/cluster_controller.js | 6 ++-- ambari-web/app/utils/ajax/ajax.js | 2 +- .../app/views/common/quick_view_link_view.js | 30 +++++++++++++------- 3 files changed, 24 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5e1f13dc/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 e899ee8..a9368b4 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -158,7 +158,8 @@ App.ClusterController = Em.Controller.extend({ sender: this, data: { clusterName: App.get('clusterName'), - masterComponents: 'GANGLIA_SERVER' + masterComponents: 'GANGLIA_SERVER', + urlParams: '' }, success: 'setGangliaUrlSuccessCallback' }); @@ -187,7 +188,8 @@ App.ClusterController = Em.Controller.extend({ sender: this, data: { clusterName: App.get('clusterName'), - masterComponents: 'NAGIOS_SERVER' + masterComponents: 'NAGIOS_SERVER', + urlParams: '' }, success: 'setNagiosUrlSuccessCallback' }); http://git-wip-us.apache.org/repos/asf/ambari/blob/5e1f13dc/ambari-web/app/utils/ajax/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index 7997249..851e09f 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -2167,7 +2167,7 @@ var urls = { 'mock': '' }, 'hosts.for_quick_links': { - 'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({masterComponents})&fields=Hosts/public_host_name,host_components&minimal_response=true', + 'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({masterComponents})&fields=Hosts/public_host_name,host_components/HostRoles/component_name{urlParams}&minimal_response=true', 'mock': '' }, 'hosts.confirmed.install': { http://git-wip-us.apache.org/repos/asf/ambari/blob/5e1f13dc/ambari-web/app/views/common/quick_view_link_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js index a70cd8b..b1ffa07 100644 --- a/ambari-web/app/views/common/quick_view_link_view.js +++ b/ambari-web/app/views/common/quick_view_link_view.js @@ -87,7 +87,8 @@ App.QuickViewLinks = Em.View.extend({ sender: this, data: { clusterName: App.get('clusterName'), - masterComponents: App.StackServiceComponent.find().filterProperty('isMaster', true).mapProperty('componentName').join(',') + masterComponents: App.StackServiceComponent.find().filterProperty('isMaster', true).mapProperty('componentName').join(','), + urlParams: ',host_components/component/metrics/hbase/master/IsActiveMaster' }, success: 'setQuickLinksSuccessCallback' }); @@ -96,7 +97,6 @@ App.QuickViewLinks = Em.View.extend({ setQuickLinksSuccessCallback: function (response) { this.loadTags(); var serviceName = this.get('content.serviceName'); - var components = this.get('content.hostComponents'); var hosts = []; var self = this; var version = App.get('currentStackVersionNumber'); @@ -132,15 +132,23 @@ App.QuickViewLinks = Em.View.extend({ case "GANGLIA": case "NAGIOS": case "HUE": - hosts[0] = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('isMaster', true).get("host").get("publicHostName"); + hosts[0] = App.singleNodeInstall ? App.singleNodeAlias : response.items[0].Hosts.public_host_name; break; case "HBASE": - var masterComponents = components.filterProperty('componentName', 'HBASE_MASTER'); + var masterComponents = response.items.filter(function (item) { + return item.host_components.mapProperty('HostRoles.component_name').contains('HBASE_MASTER'); + }); var activeMaster, standbyMasters, otherMasters; if (App.supports.multipleHBaseMasters) { - activeMaster = masterComponents.filterProperty('haStatus', 'true'); - standbyMasters = masterComponents.filterProperty('haStatus', 'false'); - otherMasters = masterComponents.filterProperty('haStatus', null); + activeMaster = masterComponents.filter(function (item) { + return item.host_components.mapProperty('component')[0].mapProperty('metrics.hbase.master.IsActiveMaster').contains('true'); + }); + standbyMasters = masterComponents.filter(function (item) { + return item.host_components.mapProperty('component')[0].mapProperty('metrics.hbase.master.IsActiveMaster').contains('false'); + }); + otherMasters = masterComponents.filter(function (item) { + return item.host_components.mapProperty('component')[0].mapProperty('metrics.hbase.master.IsActiveMaster').contains(undefined); + }); } if (masterComponents) { if (App.singleNodeInstall) { @@ -149,21 +157,21 @@ App.QuickViewLinks = Em.View.extend({ // need all hbase_masters hosts in quick links if (activeMaster) { activeMaster.forEach(function(item) { - hosts.push({'publicHostName': response.items.mapProperty('Hosts').findProperty('host_name', item.get('host.hostName')).public_host_name, 'status': Em.I18n.t('quick.links.label.active')}); + hosts.push({'publicHostName': item.Hosts.public_host_name, 'status': Em.I18n.t('quick.links.label.active')}); }); } if (standbyMasters) { standbyMasters.forEach(function(item) { - hosts.push({'publicHostName': response.items.mapProperty('Hosts').findProperty('host_name', item.get('host.hostName')).public_host_name, 'status': Em.I18n.t('quick.links.label.standby')}); + hosts.push({'publicHostName': item.Hosts.public_host_name, 'status': Em.I18n.t('quick.links.label.standby')}); }); } if (otherMasters) { otherMasters.forEach(function(item) { - hosts.push({'publicHostName': response.items.mapProperty('Hosts').findProperty('host_name', item.get('host.hostName')).public_host_name}); + hosts.push({'publicHostName': item.Hosts.public_host_name}); }); } } else { - hosts[0] = masterComponents[0].get('host.publicHostName'); + hosts[0] = masterComponents[0].Hosts.public_host_name; } } break;
