AMBARI-19324 - Ambai-web action to download all client configs (rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0ab25563 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0ab25563 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0ab25563 Branch: refs/heads/branch-dev-patch-upgrade Commit: 0ab25563f1689b919374659fe1652362ccb1886a Parents: 1600277 Author: Richard Zang <[email protected]> Authored: Tue Jan 3 11:30:37 2017 -0800 Committer: Richard Zang <[email protected]> Committed: Tue Jan 3 11:30:37 2017 -0800 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service.js | 9 ++++++++- ambari-web/app/messages.js | 1 + .../main/host/details/support_client_configs_download.js | 10 ++++++++-- .../app/templates/main/service/all_services_actions.hbs | 7 +++++++ 4 files changed, 24 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab25563/ambari-web/app/controllers/main/service.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js index 2677723..e4d751d 100644 --- a/ambari-web/app/controllers/main/service.js +++ b/ambari-web/app/controllers/main/service.js @@ -19,7 +19,7 @@ var App = require('app'); var misc = require('utils/misc'); -App.MainServiceController = Em.ArrayController.extend({ +App.MainServiceController = Em.ArrayController.extend(App.SupportClientConfigsDownload, { name: 'mainServiceController', @@ -144,6 +144,13 @@ App.MainServiceController = Em.ArrayController.extend({ }, /** + * Download client configs for all services + */ + downloadAllClientConfigs: function() { + this.downloadClientConfigsCall({downloadAll: true}); + }, + + /** * Do request to server for "start|stop" all services * @param {string} state "STARTED|INSTALLED" * @param {object} query http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab25563/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index bba9e84..0b0b78e 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -2222,6 +2222,7 @@ Em.I18n.translations = { 'services.service.startAll':'Start All', 'services.service.stopAll':'Stop All', 'services.service.restartAllRequired':'Restart All Required', + 'services.service.downloadAllClientConfigs':'Download All Client Configs', 'services.service.startAll.confirmMsg' : 'You are about to start all services', 'services.service.stopAll.confirmMsg' : 'You are about to stop all services', 'services.service.refreshAll.confirmMsg': '<p>You are about to restart {0}</p>' + http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab25563/ambari-web/app/mixins/main/host/details/support_client_configs_download.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/main/host/details/support_client_configs_download.js b/ambari-web/app/mixins/main/host/details/support_client_configs_download.js index 6e7cd9b..58460f0 100644 --- a/ambari-web/app/mixins/main/host/details/support_client_configs_download.js +++ b/ambari-web/app/mixins/main/host/details/support_client_configs_download.js @@ -24,11 +24,14 @@ App.SupportClientConfigsDownload = Em.Mixin.create({ * @param {{hostName: string, componentName: string, displayName: string, serviceName: string}} data */ downloadClientConfigsCall: function (data) { - var url = this._getUrl(data.hostName, data.serviceName, data.componentName); + var url = this._getUrl(data.hostName, data.serviceName, data.componentName, data.downloadAll); var newWindow = window.open(url); newWindow.focus(); }, + _getDownloadAllUrl: function () { + return App.get('apiPrefix') + '/clusters/' + App.router.getClusterName() + '/components?format=client_config_tar'; + }, /** * * @param {string|null} hostName @@ -37,7 +40,10 @@ App.SupportClientConfigsDownload = Em.Mixin.create({ * @returns {string} * @private */ - _getUrl: function (hostName, serviceName, componentName) { + _getUrl: function (hostName, serviceName, componentName, downloadAll) { + if (downloadAll) { + return this._getDownloadAllUrl(); + } var isForHost = !Em.isNone(hostName); return App.get('apiPrefix') + '/clusters/' + App.router.getClusterName() + '/' + (isForHost ? 'hosts/' + hostName + '/host_components/' : 'services/' + serviceName + '/components/') + http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab25563/ambari-web/app/templates/main/service/all_services_actions.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/all_services_actions.hbs b/ambari-web/app/templates/main/service/all_services_actions.hbs index 7cd36c8..a185e4f 100644 --- a/ambari-web/app/templates/main/service/all_services_actions.hbs +++ b/ambari-web/app/templates/main/service/all_services_actions.hbs @@ -58,6 +58,13 @@ </a> </li> {{/isAuthorized}} + <li> + <a href="#" + {{action "downloadAllClientConfigs" target="view.serviceController"}}> + <i {{bindAttr class=":glyphicon :glyphicon-download-alt"}}></i> + {{t services.service.downloadAllClientConfigs}} + </a> + </li> </ul> </div> {{/isAuthorized}}
