Updated Branches: refs/heads/trunk 2b2c62b11 -> a018cc3bc
AMBARI-3856. Host selection dialog title and description should be passed in (Denys Buzhor via alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a018cc3b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a018cc3b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a018cc3b Branch: refs/heads/trunk Commit: a018cc3bc93851f4e05447ae645370419578eca0 Parents: 2b2c62b Author: Alex Antonenko <[email protected]> Authored: Mon Nov 25 18:56:30 2013 +0200 Committer: Alex Antonenko <[email protected]> Committed: Mon Nov 25 18:58:05 2013 +0200 ---------------------------------------------------------------------- .../service/manage_config_groups_controller.js | 31 +++++++++++++------- ambari-web/app/messages.js | 4 +-- ambari-web/app/styles/application.less | 2 +- .../templates/common/configs/overrideWindow.hbs | 8 ++--- ambari-web/app/utils/hosts.js | 19 ++++++++---- 5 files changed, 41 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a018cc3b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js index a94dda0..7d7e543 100644 --- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js +++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js @@ -178,17 +178,26 @@ App.ManageConfigGroupsController = Em.Controller.extend({ addHosts: function () { var availableHosts = this.get('selectedConfigGroup.availableHosts'); - var group = this.get('selectedConfigGroup'); - hostsManagement.launchHostsSelectionDialog(availableHosts, [], false, this.get('componentsForFilter'), function (selectedHosts) { - if (selectedHosts) { - var defaultHosts = group.get('parentConfigGroup.hosts'); - var configGroupHosts = group.get('hosts'); - selectedHosts.forEach(function (hostName) { - configGroupHosts.pushObject(hostName); - defaultHosts.removeObject(hostName); - }); - } - }); + var popupDescription = { + header: Em.I18n.t('hosts.selectHostsDialog.title'), + dialogMessage: Em.I18n.t('hosts.selectHostsDialog.message') + }; + hostsManagement.launchHostsSelectionDialog(availableHosts, [], false, [], this.addHostsCallback.bind(this), popupDescription); + }, + + /** + * add hosts callback + */ + addHostsCallback: function (selectedHosts) { + var group = this.get('selectedConfigGroup'); + if (selectedHosts) { + var defaultHosts = group.get('parentConfigGroup.hosts'); + var configGroupHosts = group.get('hosts'); + selectedHosts.forEach(function (hostName) { + configGroupHosts.pushObject(hostName); + defaultHosts.removeObject(hostName); + }); + } }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/a018cc3b/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index e951894..9b022e5 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1280,8 +1280,8 @@ Em.I18n.translations = { 'hosts.host.add':'Add New Hosts', 'hosts.table.noHosts':'No hosts to display', - 'hosts.selectHostsDialog.title': 'Select Hosts to override', - 'hosts.selectHostsDialog.message': 'Select hosts where the override config group has to be applied', + 'hosts.selectHostsDialog.title': 'Select Configuration Group Hosts', + 'hosts.selectHostsDialog.message': 'Select hosts that should belong to this configuration group. Configurations for these hosts will be overridden from the default values.', 'hosts.selectHostsDialog.filter.placeHolder': 'Filter...', 'hosts.selectHostsDialog.selectedHostsLink': '{0} out of {1} hosts selected', http://git-wip-us.apache.org/repos/asf/ambari/blob/a018cc3b/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index f911d7f..6f3f49c 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -1289,7 +1289,7 @@ input{ } .hosts-table-container{ width:100%; -height: 270px; +height: 250px; overflow: auto; border: 1px solid #eee; } http://git-wip-us.apache.org/repos/asf/ambari/blob/a018cc3b/ambari-web/app/templates/common/configs/overrideWindow.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/overrideWindow.hbs b/ambari-web/app/templates/common/configs/overrideWindow.hbs index badb276..48199c3 100644 --- a/ambari-web/app/templates/common/configs/overrideWindow.hbs +++ b/ambari-web/app/templates/common/configs/overrideWindow.hbs @@ -19,7 +19,7 @@ {{! #with view.categoryConfigProperty}} <form class="form-horizontal" autocomplete="off"> <div class="override-controls"> - <h4 class="message">{{t hosts.selectHostsDialog.message}}</h4> + <h4 class="message">{{view.parentView.dialogMessage}}</h4> {{#if view.parentView.warningMessage}} <div class="text-warning"> {{view.parentView.warningMessage}} @@ -64,7 +64,7 @@ <!-- Host-components drop-down --> <div class="btn-group"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> - Components + {{t common.components}} <span class="caret"></span> </a> <ul class="dropdown-menu"> @@ -94,7 +94,7 @@ <th width="10%"> {{view Ember.Checkbox checkedBinding="view.allHostsSelected"}} </th> - <th width="45%">Host</th> + <th width="45%">{{t common.host}}</th> <th width="45%">{{view.filterColumn.name}}</th> </tr> </thead> @@ -118,4 +118,4 @@ </div> </div> </form> -{{! /with}} \ No newline at end of file +{{! /with}} http://git-wip-us.apache.org/repos/asf/ambari/blob/a018cc3b/ambari-web/app/utils/hosts.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/hosts.js b/ambari-web/app/utils/hosts.js index 80c50a8..6f963c3 100644 --- a/ambari-web/app/utils/hosts.js +++ b/ambari-web/app/utils/hosts.js @@ -28,16 +28,25 @@ module.exports = { * @param selectedHosts {App.Host[]} List of hosts already selected from the available hosts * @param selectAtleastOneHost {boolean} If true atleast one host has to be selected * @param validComponents {App.HostComponent[]} List of host-component types to pick from. - * @param callback Callback function which is invoked when dialog + * @param callback Callback function which is invoked when dialog + * @param popupDescription {Object} Consist header and message for popup + * Example: {header: 'header', dialogMessage: 'message'} * is closed, cancelled or OK is pressed. */ launchHostsSelectionDialog : function(availableHosts, selectedHosts, - selectAtleastOneHost, validComponents, callback) { + selectAtleastOneHost, validComponents, callback, popupDescription) { + // set default popup description + var defaultPopupDescription = { + header: Em.I18n.t('hosts.selectHostsDialog.title'), + dialogMessage: Em.I18n.t('hosts.selectHostsDialog.message') + }; + if (popupDescription !== null) { + popupDescription = $.extend(true, defaultPopupDescription, popupDescription); + } App.ModalPopup.show({ classNames: [ 'sixty-percent-width-modal' ], - header: Em.I18n.t('hosts.selectHostsDialog.title'), - primary: Em.I18n.t('ok'), - secondary: Em.I18n.t('common.cancel'), + header: popupDescription.header, + dialogMessage: popupDescription.dialogMessage, warningMessage: null, onPrimary: function () { console.debug('(old-selectedHosts)=', selectedHosts);
