Repository: ambari
Updated Branches:
  refs/heads/trunk 6eecc2c15 -> 329b62fd7


AMBARI-7435 Issues with Hive Client Configs download. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/329b62fd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/329b62fd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/329b62fd

Branch: refs/heads/trunk
Commit: 329b62fd7f88ffeb0e3005b9cf6431f560e14928
Parents: 6eecc2c
Author: atkach <atk...@hortonworks.com>
Authored: Mon Sep 22 18:52:08 2014 +0300
Committer: atkach <atk...@hortonworks.com>
Committed: Mon Sep 22 18:52:08 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 28 +++++++++++++++++---
 ambari-web/app/templates/main/host/details.hbs  |  2 +-
 ambari-web/app/templates/main/service/item.hbs  | 13 ++++++++-
 ambari-web/app/views/main/service/item.js       |  6 +++--
 4 files changed, 42 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/329b62fd/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js 
b/ambari-web/app/controllers/main/service/item.js
index 84d833f..5325c2d 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -101,6 +101,21 @@ App.MainServiceItemController = Em.Controller.extend({
 
   allHosts: [],
 
+  clientComponents: function () {
+    var clientNames = [];
+    var clients = 
App.StackServiceComponent.find().filterProperty('serviceName', 
this.get('content.serviceName')).filterProperty('isClient');
+    clients.forEach(function (item) {
+      clientNames.push({
+        action: 'downloadClientConfigs',
+        context: {
+          name: item.get('componentName'),
+          label: item.get('displayName')
+        }
+      });
+    });
+    return clientNames;
+  }.property('content.serviceName'),
+
   /**
    * Common method for ajax (start/stop service) responses
    * @param data
@@ -611,6 +626,13 @@ App.MainServiceItemController = Em.Controller.extend({
     return (this.get('content.healthStatus') != 'green');
   }.property('content.healthStatus','isPending'),
 
+  /**
+   * Determine if service has than one service client components
+   */
+  isSeveralClients: function () {
+    return App.StackServiceComponent.find().filterProperty('serviceName', 
this.get('content.serviceName')).filterProperty('isClient').length > 1;
+  }.property('content.serviceName'),
+
   enableHighAvailability: function() {
     var ability_controller = 
App.router.get('mainAdminHighAvailabilityController');
     ability_controller.enableHighAvailability();
@@ -626,12 +648,12 @@ App.MainServiceItemController = Em.Controller.extend({
     ability_controller.enableRMHighAvailability();
   },
 
-  downloadClientConfigs: function () {
+  downloadClientConfigs: function (event) {
     var component = 
this.get('content.hostComponents').findProperty('isClient');
     componentsUtils.downloadClientConfigs.call(this, {
       serviceName: this.get('content.serviceName'),
-      componentName: component.get('componentName'),
-      displayName: component.get('displayName')
+      componentName: (event && event.name) || component.get('componentName'),
+      displayName: (event && event.label) || component.get('displayName')
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/329b62fd/ambari-web/app/templates/main/host/details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details.hbs 
b/ambari-web/app/templates/main/host/details.hbs
index 41ea3e0..784063f 100644
--- a/ambari-web/app/templates/main/host/details.hbs
+++ b/ambari-web/app/templates/main/host/details.hbs
@@ -55,7 +55,7 @@
                                   <ul class="dropdown-menu">
                                     {{#each client in view.clients}}
                                       <li>
-                                        <a {{action "downloadClientConfigs" 
client target="controller" href=true}}>{{client.service.displayName}}</a>
+                                        <a {{action "downloadClientConfigs" 
client target="controller" href=true}}>{{client.displayName}}</a>
                                       </li>
                                     {{/each}}
                                   </ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/329b62fd/ambari-web/app/templates/main/service/item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/item.hbs 
b/ambari-web/app/templates/main/service/item.hbs
index 71bf554..a264f5f 100644
--- a/ambari-web/app/templates/main/service/item.hbs
+++ b/ambari-web/app/templates/main/service/item.hbs
@@ -83,11 +83,22 @@
 
         <!-- Other service actions -->
         {{#each option in view.maintenance}}
-        <li {{bindAttr class="option.disabled option.isHidden:hidden"}}>
+        <li {{bindAttr class="option.disabled option.isHidden:hidden 
option.hasSubmenu:dropdown-submenu option.hasSubmenu:submenu-left"}}>
           <a {{action "doAction" option target="controller" href=true}} 
{{bindAttr data-title="option.tooltip"}} rel="HealthTooltip">
               <i {{bindAttr class="option.cssClass"}}></i>
               {{option.label}}
           </a>
+          {{#if option.hasSubmenu}}
+            <div class="dropdown-menu-wrap">
+              <ul class="dropdown-menu">
+                {{#each item in option.submenuOptions}}
+                  <li>
+                    <a {{action "doAction" item target="controller" 
href=true}}>{{item.context.label}}</a>
+                  </li>
+                {{/each}}
+              </ul>
+            </div>
+          {{/if}}
         </li>
         {{/each}}
       </ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/329b62fd/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js 
b/ambari-web/app/views/main/service/item.js
index 7a388fd..cfb481a 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -101,11 +101,13 @@ App.MainServiceItemView = Em.View.extend({
         disabled: false
       },
       DOWNLOAD_CLIENT_CONFIGS: {
-        action: 'downloadClientConfigs',
+        action: this.get('controller.isSeveralClients') ? '' : 
'downloadClientConfigs',
         label: Em.I18n.t('services.service.actions.downloadClientConfigs'),
         cssClass: 'icon-download-alt',
         isHidden: !(App.get('supports.downloadClientConfigs') && 
this.get('controller.content.hostComponents').findProperty('isClient')),
-        disabled: false
+        disabled: false,
+        hasSubmenu: this.get('controller.isSeveralClients'),
+        submenuOptions: this.get('controller.clientComponents')
       }
     }
   },

Reply via email to