Repository: ambari Updated Branches: refs/heads/branch-2.5 50e36c7f8 -> f1cedfd89
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/f1cedfd8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f1cedfd8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f1cedfd8 Branch: refs/heads/branch-2.5 Commit: f1cedfd89ebfd274f3d3e14769a9ea0db620e047 Parents: 50e36c7 Author: Jaimin Jetly <[email protected]> Authored: Thu Jan 5 18:15:12 2017 -0800 Committer: Jaimin Jetly <[email protected]> Committed: Thu Jan 5 18:17:11 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/f1cedfd8/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 be3fac1..6f1efd8 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -95,7 +95,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({ @@ -1096,6 +1101,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/f1cedfd8/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 3642e5a..6e35bd5 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/f1cedfd8/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 78ed0a6..fd66144 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 () {
