Browse Source

AMBARI-3322. Nagios and Ganglia links appears on the service pages even if N and G are not installed. (onechiporenko)

Oleg Nechiporenko 11 years ago
parent
commit
985bb7b336

+ 4 - 0
ambari-web/app/controllers/global/cluster_controller.js

@@ -167,6 +167,10 @@ App.ClusterController = Em.Controller.extend({
     return !!App.Service.find().findProperty('serviceName', 'NAGIOS');
     return !!App.Service.find().findProperty('serviceName', 'NAGIOS');
   }.property('App.router.updateController.isUpdated', 'dataLoadList.services'),
   }.property('App.router.updateController.isUpdated', 'dataLoadList.services'),
 
 
+  isGangliaInstalled:function () {
+    return !!App.Service.find().findProperty('serviceName', 'GANGLIA');
+  }.property('App.router.updateController.isUpdated', 'dataLoadList.services'),
+
   /**
   /**
    * Sorted list of alerts.
    * Sorted list of alerts.
    * Changes whenever alerts are loaded.
    * Changes whenever alerts are loaded.

+ 5 - 1
ambari-web/app/controllers/main/service/info/summary.js

@@ -39,5 +39,9 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({
   
   
   isNagiosInstalled: function(){
   isNagiosInstalled: function(){
     return App.router.get('clusterController.isNagiosInstalled');
     return App.router.get('clusterController.isNagiosInstalled');
-  }.property('App.router.clusterController.isNagiosInstalled')
+  }.property('App.router.clusterController.isNagiosInstalled'),
+
+  isGangliaInstalled: function(){
+    return App.router.get('clusterController.isGangliaInstalled');
+  }.property('App.router.clusterController.isGangliaInstalled')
 });
 });

+ 6 - 2
ambari-web/app/templates/main/service/info/summary.hbs

@@ -104,7 +104,9 @@
       <div class="box-header">
       <div class="box-header">
         <h4>{{t services.alerts.headingOfList}}</h4>
         <h4>{{t services.alerts.headingOfList}}</h4>
         <div class="btn-group">
         <div class="btn-group">
-          <a class="btn" target="_blank" rel="tooltip" title="Go to Nagios" {{bindAttr href="controller.nagiosUrl"}}><i class="icon-link"></i></a>
+          {{#if controller.isNagiosInstalled}}
+            <a class="btn" target="_blank" rel="tooltip" title="Go to Nagios" {{bindAttr href="controller.nagiosUrl"}}><i class="icon-link"></i></a>
+          {{/if}}
         </div>
         </div>
       </div>
       </div>
       <ul id='summary-alerts-list' class="alerts">
       <ul id='summary-alerts-list' class="alerts">
@@ -134,7 +136,9 @@
       <div class="box-header">
       <div class="box-header">
         <h4>{{controller.content.label}} {{t common.metrics}}</h4>
         <h4>{{controller.content.label}} {{t common.metrics}}</h4>
         <div class="btn-group">
         <div class="btn-group">
-          <a class="btn" target="_blank" rel="tooltip" title="Go to Ganglia" {{bindAttr href="view.gangliaUrl"}}><i class="icon-link"></i></a>
+          {{#if controller.isGangliaInstalled}}
+            <a class="btn" target="_blank" rel="tooltip" title="Go to Ganglia" {{bindAttr href="view.gangliaUrl"}}><i class="icon-link"></i></a>
+          {{/if}}
         </div>
         </div>
       </div>
       </div>
       
       

+ 1 - 0
ambari-web/app/views/main/service/info/summary.js

@@ -431,6 +431,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
 
 
   gangliaUrl:function () {
   gangliaUrl:function () {
     var gangliaUrl = App.router.get('clusterController.gangliaUrl');
     var gangliaUrl = App.router.get('clusterController.gangliaUrl');
+    if (!gangliaUrl) return null;
     var svcName = this.get('service.serviceName');
     var svcName = this.get('service.serviceName');
     if (svcName) {
     if (svcName) {
       switch (svcName.toLowerCase()) {
       switch (svcName.toLowerCase()) {