You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2013/11/20 16:40:42 UTC
git commit: AMBARI-3824 Provide change config-group action on host
configs. (atkach)
Updated Branches:
refs/heads/trunk 1e02ae786 -> a5229c1c4
AMBARI-3824 Provide change config-group action on host configs. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/a5229c1c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/a5229c1c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/a5229c1c
Branch: refs/heads/trunk
Commit: a5229c1c404bcfaff5aed9ac081c28b4e72af0c5
Parents: 1e02ae7
Author: atkach <an...@gmail.com>
Authored: Wed Nov 20 17:40:36 2013 +0200
Committer: atkach <an...@gmail.com>
Committed: Wed Nov 20 17:40:36 2013 +0200
----------------------------------------------------------------------
.../controllers/main/host/configs_service.js | 9 +++++
ambari-web/app/messages.js | 1 +
.../templates/common/configs/service_config.hbs | 2 +-
ambari-web/app/utils/config.js | 40 +++++++++++++++++++-
.../app/views/common/configs/services_config.js | 2 +
5 files changed, 52 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/a5229c1c/ambari-web/app/controllers/main/host/configs_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/configs_service.js b/ambari-web/app/controllers/main/host/configs_service.js
index 3b1414a..9bbda04 100644
--- a/ambari-web/app/controllers/main/host/configs_service.js
+++ b/ambari-web/app/controllers/main/host/configs_service.js
@@ -140,5 +140,14 @@ App.MainHostServiceConfigsController = App.MainServiceInfoConfigsController.exte
},
loadServiceConfigHostsOverridesErrorCallback: function (request, ajaxOptions, error) {
console.log("TRACE: error code status is: " + request.status);
+ },
+ /**
+ * invoke dialog for switching group of host
+ */
+ switchHostGroup: function () {
+ var self = this;
+ App.config.launchSwitchConfigGroupOfHostDialog(this.get('selectedConfigGroup'), this.get('configGroups'), this.get('host.hostName'), function(newGroup){
+ self.set('selectedConfigGroup', newGroup);
+ })
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/a5229c1c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 70b811a..10d7bbf 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1708,6 +1708,7 @@ Em.I18n.translations = {
'config.group.selection.dialog.err.name.exists': 'Configuration group with given name already exists',
'config.group.selection.dialog.err.create': 'Error creating new configuration group [{0}]',
'config.group.selection.dialog.no.groups': 'There are no existed Config Groups for this Service',
+ 'config.group.host.switch.dialog.title': 'Change Group',
'utils.ajax.errorMessage': 'Error message'
};
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/a5229c1c/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index 45e9fc7..5592fac 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -65,7 +65,7 @@
</ul>
</span>
{{#if controller.isHostsConfigsPage}}
- <a href="">{{t common.change}}</a>
+ <a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>
{{/if}}
<div class="pull-right">
{{view App.FilterComboboxView filterBinding="view.filter" columnsBinding="view.columns" }}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/a5229c1c/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 105eca7..93fade3 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1091,7 +1091,45 @@ App.config = Em.Object.create({
})
});
},
-
+ /**
+ * launch dialog where can be assigned another group to host
+ * @param selectedGroup
+ * @param configGroups
+ * @param hostName
+ * @param callback
+ */
+ launchSwitchConfigGroupOfHostDialog: function (selectedGroup, configGroups, hostName, callback) {
+ var self = this;
+ App.ModalPopup.show({
+ header: Em.I18n.t('config.group.host.switch.dialog.title'),
+ primary: Em.I18n.t('ok'),
+ secondary: Em.I18n.t('common.cancel'),
+ configGroups: configGroups,
+ selectedConfigGroup: selectedGroup,
+ enablePrimary: function () {
+ return this.get('selectedConfigGroup.name') !== selectedGroup.get('name');
+ }.property('selectedConfigGroup'),
+ onPrimary: function () {
+ if (this.get('enablePrimary')) {
+ var newGroup = this.get('selectedConfigGroup');
+ selectedGroup.get('hosts').removeObject(hostName);
+ if (!selectedGroup.get('isDefault')) {
+ self.updateConfigurationGroup(selectedGroup, function(){}, function(){});
+ }
+ newGroup.get('hosts').pushObject(hostName);
+ callback(newGroup);
+ if (!newGroup.get('isDefault')) {
+ self.updateConfigurationGroup(newGroup, function(){}, function(){});
+ }
+ this.hide();
+ }
+ },
+ bodyClass: Ember.View.extend({
+ template: Em.Handlebars.compile('{{t installer.controls.slaveComponentGroups}}: ' +
+ '{{view Em.Select contentBinding="view.parentView.configGroups" optionLabelPath="content.name" selectionBinding="view.parentView.selectedConfigGroup"}}')
+ })
+ });
+ },
/**
* Creates a new config-group for a service.
*
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/a5229c1c/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index c501abe..ee49fb9 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -41,6 +41,8 @@ App.ServiceConfigView = Em.View.extend({
return App.supports.hostOverridesInstaller;
case 'mainServiceInfoConfigsController':
return App.supports.hostOverrides;
+ case 'mainHostServiceConfigsController':
+ return App.supports.hostOverridesHost;
default:
return false;
}