Explorar o código

AMBARI-2600. Add Quick Links (Web UI) for Oozie, Hue, Nagios, Ganglia. (Antonenko Alexander via yusaku)

Yusaku Sako %!s(int64=12) %!d(string=hai) anos
pai
achega
6a0da9632c

+ 42 - 30
ambari-web/app/mappers/service_mapper.js

@@ -160,37 +160,32 @@ App.servicesMapper = App.QuickDataMapper.create({
           finalJson.rand = Math.random();
           result.push(finalJson);
           App.store.load(App.HDFSService, finalJson);
-        }
-        else
-          if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE") {
-            finalJson = this.mapreduceMapper(item);
-            finalJson.rand = Math.random();
-            result.push(finalJson);
-            App.store.load(App.MapReduceService, finalJson);
+        }else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE") {
+          finalJson = this.mapreduceMapper(item);
+          finalJson.rand = Math.random();
+          result.push(finalJson);
+          App.store.load(App.MapReduceService, finalJson);
+        }else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
+          finalJson = this.hbaseMapper(item);
+          finalJson.rand = Math.random();
+          result.push(finalJson);
+          App.store.load(App.HBaseService, finalJson);
+        }else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "FLUME") {
+          finalJson = this.flumeMapper(item);
+          finalJson.rand = Math.random();
+          result.push(finalJson);
+          if(finalJson.nodeObjs){
+            finalJson.nodeObjs.forEach(function(no){
+              App.store.load(App.FlumeNode, no);
+            });
           }
-          else
-            if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
-              finalJson = this.hbaseMapper(item);
-              finalJson.rand = Math.random();
-              result.push(finalJson);
-              App.store.load(App.HBaseService, finalJson);
-            } else
-              if (item && item.ServiceInfo && item.ServiceInfo.service_name == "FLUME") {
-                finalJson = this.flumeMapper(item);
-                finalJson.rand = Math.random();
-                result.push(finalJson);
-                if(finalJson.nodeObjs){
-                  finalJson.nodeObjs.forEach(function(no){
-                    App.store.load(App.FlumeNode, no);
-                  });
-                }
-                App.store.load(App.FlumeService, finalJson);
-              }
-              else {
-                finalJson = this.parseIt(item, this.config);
-                finalJson.rand = Math.random();
-                result.push(finalJson);
-              }
+          App.store.load(App.FlumeService, finalJson);
+        }else {
+          finalJson = this.parseIt(item, this.config);
+          finalJson.rand = Math.random();
+          this.mapQuickLinks(finalJson, item);
+          result.push(finalJson);
+        }
       }, this);
 
 
@@ -260,6 +255,23 @@ App.servicesMapper = App.QuickDataMapper.create({
     console.log('out service mapper.  Took ' + (new Date().getTime() - start) + 'ms');
   },
 
+  /**
+   * Map quick links to services:OOZIE,GANGLIA,NAGIOS,HUE
+   * @param finalJson
+   * @param item
+   */
+  mapQuickLinks: function (finalJson, item){
+    if(item && item.ServiceInfo && item.ServiceInfo.service_name == "OOZIE"){
+      finalJson.quick_links = [19];
+    }else if(item && item.ServiceInfo && item.ServiceInfo.service_name == "GANGLIA"){
+      finalJson.quick_links = [20];
+    }else if(item && item.ServiceInfo && item.ServiceInfo.service_name == "NAGIOS"){
+      finalJson.quick_links = [21];
+    }else if(item && item.ServiceInfo && item.ServiceInfo.service_name == "HUE"){
+      finalJson.quick_links = [22];
+    }
+  },
+
   hdfsMapper: function (item) {
     var finalConfig = jQuery.extend({}, this.config);
     // Change the JSON so that it is easy to map

+ 0 - 1
ambari-web/app/messages.js

@@ -1170,7 +1170,6 @@ Em.I18n.translations = {
   'dashboard.services.hive.clients':'Hive Clients',
   'dashboard.services.hive.client':'Hive Client',
 
-  'dashboard.services.oozie.webUi':'Oozie Web UI',
   'dashboard.services.oozie.clients':'Oozie Clients',
   'dashboard.services.oozie.client':'Oozie Client',
 

+ 24 - 0
ambari-web/app/models/quick_links.js

@@ -132,5 +132,29 @@ App.QuickLinks.FIXTURES = [
     label:'Thread Stacks',
     url:'http://%@:60010/stacks',
     service_id: 'HBASE'
+  },
+  {
+    id:19,
+    label:'Oozie Web UI',
+    url:'http://%@:11000/oozie',
+    service_id: 'OOZIE'
+  },
+  {
+    id:20,
+    label:'Ganglia Web UI',
+    url:'http://%@/ganglia',
+    service_id: 'GANGLIA'
+  },
+  {
+    id:21,
+    label:'Nagios Web UI',
+    url:'http://%@/nagios',
+    service_id: 'NAGIOS'
+  },
+  {
+    id:22,
+    label:'Hue Web UI',
+    url:'http://%@/hue',
+    service_id: 'HUE'
   }
 ];

+ 1 - 1
ambari-web/app/templates/main/dashboard/service/oozie.hbs

@@ -34,7 +34,7 @@
 
     <a href="#" {{action filterHosts view.clients.component}}>{{view.clients.title}}</a>,
 
-    <a href="{{unbound view.webUi}}" target="_blank">{{t dashboard.services.oozie.webUi}}</a>
+    <a href="{{unbound view.webUi}}" target="_blank">{{t services.oozie.webUi}}</a>
 
   </div>
 </div>

+ 28 - 16
ambari-web/app/views/common/quick_view_link_view.js

@@ -28,24 +28,32 @@ App.QuickViewLinks = Em.View.extend({
     var components = this.get('content.hostComponents');
     var host;
 
-    if (serviceName === 'HDFS') {
-      host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName');
-    } else if (serviceName === 'MAPREDUCE') {
-      host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'JOBTRACKER').get('host.publicHostName');
-    } else if (serviceName === 'HBASE') {
-      var component;
-      if (App.supports.multipleHBaseMasters) {
-        component = components.filterProperty('componentName', 'HBASE_MASTER').findProperty('haStatus', 'active');
-      } else {
-        component = components.findProperty('componentName', 'HBASE_MASTER');
-      }
-      if (component) {
-        if (App.singleNodeInstall) {
-          host = App.singleNodeAlias;
+    switch (serviceName) {
+      case "HDFS":
+        host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName', 'NAMENODE').get('host.publicHostName');
+        break;
+      case "MAPREDUCE":
+      case "OOZIE":
+      case "GANGLIA":
+      case "NAGIOS":
+      case "HUE":
+        host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('isMaster', true).get("host").get("publicHostName");
+        break;
+      case "HBASE":
+        var component;
+        if (App.supports.multipleHBaseMasters) {
+          component = components.filterProperty('componentName', 'HBASE_MASTER').findProperty('haStatus', 'active');
         } else {
-          host = component.get('host.publicHostName');
+          component = components.findProperty('componentName', 'HBASE_MASTER');
         }
-      }
+        if (component) {
+          if (App.singleNodeInstall) {
+            host = App.singleNodeAlias;
+          } else {
+            host = component.get('host.publicHostName');
+          }
+        }
+        break;
     }
     if (!host) {
       return [
@@ -68,6 +76,10 @@ App.QuickViewLinks = Em.View.extend({
       case "hdfs":
       case "mapreduce":
       case "hbase":
+      case "oozie":
+      case "ganglia":
+      case "nagios":
+      case "hue":
         return "_blank";
         break;
       default:

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

@@ -205,32 +205,6 @@ App.MainServiceInfoSummaryView = Em.View.extend({
       "user":"hive"
     }
   },
-  /**
-   * Get public host name (should be Master) for service
-   * @param {String} serviceName - GANGLIA, NAGIOS etc
-   * @return {*}
-   */
-  getServer: function(serviceName) {
-    var service=this.get('controller.content');
-    if(service.get("id") == serviceName) {
-      return (App.singleNodeInstall ? App.singleNodeAlias : service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName"));
-    }
-    else {
-      return '';
-    }
-  },
-  gangliaServer:function() {
-    return this.getServer("GANGLIA");
-  }.property('controller.content'),
-  nagiosServer:function(){
-    return this.getServer("NAGIOS");
-  }.property('controller.content'),
-  oozieServer:function(){
-    return this.getServer("OOZIE");
-  }.property('controller.content'),
-  hueServer:function(){
-    return this.getServer("HUE");
-  }.property('controller.content'),
 
   /**
    * Array of the hostComponents for service