Jelajahi Sumber

AMBARI-18696 - Add Hive&Tez View Links to Hive Summary Page (rzang)

Richard Zang 8 tahun lalu
induk
melakukan
052de09b9a

+ 4 - 0
ambari-web/app/controllers/main/service/info/summary.js

@@ -849,6 +849,10 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
         }
       })
     });
+  },
+
+  goToView: function(event) {
+    App.router.route('main' + event.context.href);
   }
 
 });

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

@@ -55,6 +55,8 @@ Em.I18n.translations = {
   'app.settings.no.privileges': 'This user does not have any privileges.',
   'app.settings.clusterRole': 'Cluster Role',
   'app.settings.viewPermissions': 'View Permissions',
+  'app.goToView': 'Go To View',
+  'app.debugHiveQuery': 'Debug Hive Query',
 
   'app.aboutAmbari.getInvolved': 'Get involved!',
   'app.aboutAmbari.version': 'Version',

+ 1 - 1
ambari-web/app/templates/main/dashboard/widgets/hbase_links.hbs

@@ -58,7 +58,7 @@
 
         <div class="link-button">
           {{#if view.model.quickLinks.length}}
-            {{#view App.QuickViewLinks contentBinding="view.model"}}
+            {{#view App.QuickLinksView contentBinding="view.model"}}
               <div class="btn-group">
                 <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
                   {{t common.more}}

+ 1 - 1
ambari-web/app/templates/main/dashboard/widgets/hdfs_links.hbs

@@ -79,7 +79,7 @@
 
     <div class="link-button">
       {{#if view.model.quickLinks.length}}
-        {{#view App.QuickViewLinks contentBinding="view.model"}}
+        {{#view App.QuickLinksView contentBinding="view.model"}}
           <div class="btn-group">
             <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
               {{t common.more}}

+ 1 - 1
ambari-web/app/templates/main/dashboard/widgets/yarn_links.hbs

@@ -46,7 +46,7 @@
 
         <div class="link-button">
           {{#if view.model.quickLinks.length}}
-            {{#view App.QuickViewLinks contentBinding="view.model"}}
+            {{#view App.QuickLinksView contentBinding="view.model"}}
               <div class="btn-group">
                 <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
                   {{t common.more}}

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

@@ -18,7 +18,7 @@
 
 {{view App.MainServiceInfoMenuView configTabBinding="view.hasConfigTab" heatmapTabBinding="view.hasHeatmapTab"}}
   <div class="span3 quick-links-wrapper">
-    {{#view App.QuickViewLinks contentBinding="view.service"}}
+    {{#view App.QuickLinksView contentBinding="view.service"}}
       {{#if view.showQuickLinks}}
         <ul class="nav nav-pills move">
           <li class="dropdown quick-links-dropdown">

+ 8 - 0
ambari-web/app/templates/main/service/services/hive.hbs

@@ -35,4 +35,12 @@
      </td>
    </tr>
   {{/if}}
+{{/each}}
+{{#each link in view.viewLinks}}
+    <tr>
+        <td class="summary-label">{{link.label}}</td>
+        <td class="summary-value" >
+            <a href="#" target="_blank" {{action goToView link target="controller"}}>{{t app.goToView}}</a>
+        </td>
+    </tr>
 {{/each}}

+ 2 - 2
ambari-web/app/views/common/log_search_ui_link_view.js

@@ -24,9 +24,9 @@ require('views/common/quick_view_link_view');
  * This view helps to get and format correct link to LogSearch UI with query params.
  * Used mostly for navigation to concrete log file.
  *
- * @augments App.QuickViewLinks
+ * @augments App.QuickLinksView
  */
-App.LogSearchUILinkView = App.QuickViewLinks.extend({
+App.LogSearchUILinkView = App.QuickLinksView.extend({
   content: function() {
     return App.Service.find().findProperty('serviceName', 'LOGSEARCH');
   }.property(),

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

@@ -26,7 +26,7 @@ var App = require('app');
  * @property {?string} status
  */
 
-App.QuickViewLinks = Em.View.extend({
+App.QuickLinksView = Em.View.extend({
 
   /**
    * @type {boolean}

+ 24 - 1
ambari-web/app/views/main/service/services/hive.js

@@ -22,7 +22,30 @@ App.MainDashboardServiceHiveView = App.MainDashboardServiceView.extend({
   templateName: require('templates/main/service/services/hive'),
   serviceName: 'HIVE',
   isFullWidth: true,
-  
+  viewsToShow: {
+  'AUTO_HIVE_INSTANCE': {},
+  'TEZ_CLUSTER_INSTANCE': {
+    overwriteLabel: 'app.debugHiveQuery'
+  }},
+  viewLinks: function() {
+    var viewsToShow = this.get('viewsToShow');
+    var links = [];
+    App.router.get('mainViewsController.ambariViews').forEach(function(item) {
+      var view = viewsToShow[item.get('instanceName')];
+      if (view) {
+        var link = {
+          href: item.href,
+          label: item.label
+        };
+        if (view.overwriteLabel) {
+          link.label = Em.I18n.t(view.overwriteLabel);
+        }
+        links.push(link);
+      }
+    });
+    return links;
+  }.property('App.router.mainViewController.ambariViews'),
+
   didInsertElement: function () {
     var controller = this.get('controller');
     this._super();