Browse Source

AMBARI-6305 "Quick Links" are unusably slow (takes more than 30 seconds for the links to appear). (atkach)

atkach 11 years ago
parent
commit
a6390a83e5

+ 5 - 3
ambari-web/app/controllers/global/cluster_controller.js

@@ -151,14 +151,15 @@ App.ClusterController = Em.Controller.extend({
       return 'http://gangliaserver/ganglia/?t=yes';
     } else {
       // We want live data here
-      if (this.get('isLoaded')) {
+      var gangliaServer = App.HostComponent.find().findProperty('componentName', 'GANGLIA_SERVER');
+      if (this.get('isLoaded') && gangliaServer) {
         this.set('isGangliaUrlLoaded', true);
         App.ajax.send({
           name: 'hosts.for_quick_links',
           sender: this,
           data: {
             clusterName: App.get('clusterName'),
-            masterComponents: 'GANGLIA_SERVER',
+            masterHosts: gangliaServer.get('hostName'),
             urlParams: ''
           },
           success: 'setGangliaUrlSuccessCallback'
@@ -181,6 +182,7 @@ App.ClusterController = Em.Controller.extend({
       return 'http://nagiosserver/nagios';
     } else {
       // We want live data here
+      var nagiosServer = App.HostComponent.find().findProperty('componentName', 'NAGIOS_SERVER');
       if (this.get('isLoaded')) {
         this.set('isNagiosUrlLoaded', false);
         App.ajax.send({
@@ -188,7 +190,7 @@ App.ClusterController = Em.Controller.extend({
           sender: this,
           data: {
             clusterName: App.get('clusterName'),
-            masterComponents: 'NAGIOS_SERVER',
+            masterHosts: nagiosServer.get('hostName'),
             urlParams: ''
           },
           success: 'setNagiosUrlSuccessCallback'

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -2065,7 +2065,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/HostRoles/component_name{urlParams}&minimal_response=true',
+    'real': '/clusters/{clusterName}/hosts?Hosts/host_name.in({masterHosts})&fields=Hosts/public_host_name,host_components/HostRoles/component_name{urlParams}&minimal_response=true',
     'mock': ''
   },
   'hosts.confirmed.install': {

+ 3 - 1
ambari-web/app/views/common/quick_view_link_view.js

@@ -50,12 +50,14 @@ App.QuickViewLinks = Em.View.extend({
   },
 
   getQuickLinksHosts: function () {
+    var masterHosts = App.HostComponent.find().filterProperty('isMaster').mapProperty('hostName').uniq();
+
     App.ajax.send({
       name: 'hosts.for_quick_links',
       sender: this,
       data: {
         clusterName: App.get('clusterName'),
-        masterComponents: App.StackServiceComponent.find().filterProperty('isMaster', true).mapProperty('componentName').join(','),
+        masterHosts: masterHosts.join(','),
         urlParams: ',host_components/metrics/hbase/master/IsActiveMaster'
       },
       success: 'setQuickLinksSuccessCallback'