You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2017/01/06 02:15:25 UTC

ambari git commit: AMBARI-19394. ambari-web action to download all client configs of a service. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/trunk b46a2f627 -> cae80946c


AMBARI-19394. ambari-web action to download all client configs of a service. (jaimin)


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

Branch: refs/heads/trunk
Commit: cae80946c98cb4ad9a44f99f66132ed149add50f
Parents: b46a2f6
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Thu Jan 5 18:15:12 2017 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Thu Jan 5 18:15:12 2017 -0800

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 18 +++++++++-
 ambari-web/app/messages.js                      |  1 +
 .../test/controllers/main/service/item_test.js  | 36 ++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cae80946/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 9c4b5b7..96dd700 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -97,7 +97,12 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   }.property('App.services.noConfigTypes','content.serviceName'),
 
   clientComponents: function () {
-    var clientNames = [];
+    var clientNames = [{
+      action:  'downloadAllClientConfigs',
+      context: {
+        label: Em.I18n.t('common.all.clients')
+      }
+    }];
     var clients = App.StackServiceComponent.find().filterProperty('serviceName', this.get('content.serviceName')).filterProperty('isClient');
     clients.forEach(function (item) {
       clientNames.push({
@@ -1098,6 +1103,17 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   },
 
   /**
+   * This method is called when user event to download configs for "All Clients"
+   * is made from service action menu
+   */
+  downloadAllClientConfigs: function() {
+    this.downloadClientConfigsCall({
+      serviceName: this.get('content.serviceName'),
+      resourceType: this.resourceTypeEnum.SERVICE
+    });
+  },
+
+  /**
    * On click handler for custom hawq command from items menu
    * @param context
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/cae80946/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1e25b3a..0c3e10a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -157,6 +157,7 @@ Em.I18n.translations = {
   'common.saveAnyway':'Save Anyway',
   'common.servers':'Servers',
   'common.clients':'Clients',
+  'common.all.clients':'All Clients',
   'common.user': 'User',
   'common.users': 'Users',
   'common.issues': 'Issues',

http://git-wip-us.apache.org/repos/asf/ambari/blob/cae80946/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 4b3a419..b582e86 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -1231,6 +1231,42 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
+  describe('#downloadAllClientConfigs()', function () {
+
+    var mainServiceItemController = App.MainServiceItemController.create({
+      content: {
+        clientComponents: [
+          Em.Object.create({
+            totalCount: 1,
+            componentName: 'C1',
+            displayName: 'd1'
+          }),
+          Em.Object.create({
+            totalCount: 1,
+            componentName: 'C2',
+            displayName: 'd2'
+          })
+        ],
+        serviceName: 'S1'
+      }
+    });
+
+    beforeEach(function () {
+      sinon.stub(mainServiceItemController, 'downloadClientConfigsCall', Em.K);
+    });
+    afterEach(function () {
+      mainServiceItemController.downloadClientConfigsCall.restore();
+    });
+
+    it('should call downloadClientConfigsCall method for all clients', function () {
+      mainServiceItemController.downloadAllClientConfigs();
+      expect(mainServiceItemController.downloadClientConfigsCall.calledWith({
+        serviceName: 'S1',
+        resourceType: mainServiceItemController.resourceTypeEnum.SERVICE
+      })).to.be.true;
+    });
+  });
+
   describe('#startLdapKnox() and #stopLdapKnox() should call startStopLdapKnox once: ', function () {