You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2015/04/10 03:15:25 UTC
[2/3] ambari git commit: AMBARI-10396. Dependent configs dialog
should allow selection of config-groups (ababiichuk via srimanth)
AMBARI-10396. Dependent configs dialog should allow selection of config-groups (ababiichuk via srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/afae3449
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/afae3449
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/afae3449
Branch: refs/heads/trunk
Commit: afae3449b92244f43b553bc55ad04b0fdab0709c
Parents: 2d30cd5
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Apr 9 11:01:27 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Apr 9 18:14:03 2015 -0700
----------------------------------------------------------------------
ambari-web/app/messages.js | 7 +--
.../mixins/common/configs/enhanced_configs.js | 57 +++++++++-----------
ambari-web/app/styles/application.less | 12 +++++
.../modal_popups/dependent_configs_list.hbs | 17 +++---
.../common/modal_popups/select_groups_popup.hbs | 9 +---
.../dependent_configs_list_popup.js | 26 +++++----
.../common/modal_popups/select_groups_popup.js | 55 ++++++-------------
7 files changed, 85 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 73691db..e605056 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -340,12 +340,13 @@ Em.I18n.translations = {
'popup.invalid.KDC.admin.principal': 'Admin principal',
'popup.invalid.KDC.admin.password': 'Admin password',
- 'popup.dependent.configs.header': 'Dependent Properties',
- 'popup.dependent.configs.title': 'Properties that was changed has dependent properties. It\'s recommended to update these properties!',
+ 'popup.dependent.configs.header': 'Dependent Configurations',
+ 'popup.dependent.configs.title': 'Configurations depending on changes made are show below. It is recommended to update these values',
'popup.dependent.configs.table.saveProperty': 'Save property',
'popup.dependent.configs.table.currentValue': 'Current value',
- 'popup.dependent.configs.table.recommendedValue': 'Recommended value',
+ 'popup.dependent.configs.table.recommendedValue': 'Recommended',
+ 'popup.dependent.configs.select.config.group.header': 'Select Config Group',
'popup.dependent.configs.select.config.group': 'Please select to which config group would you like to save dependent properties',
'popup.dependent.configs.dependencies.info': 'There are {0} configs was changed in {1} services.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index c14867b..1781d5d 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -57,6 +57,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* configGroup: {string},
* value: {string},
* serviceName: {string},
+ * allowChangeGroup: {boolean}, //used to disable group link for current service
+ * serviceDisplayName: {string},
* recommendedValue: {string}
* }
* @private
@@ -91,7 +93,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
/**
* contains config group name that need to be saved
* {
- * serviceName: configGroupName
+ * serviceName: {String} configGroupName
* }
* @type {Object}
*/
@@ -111,6 +113,10 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
onConfigGroupChangeForEnhanced: function() {
this.clearDependentConfigs();
+ this.get('dependentServiceNames').forEach(function(serviceName) {
+ var defaultGroup = this.get('dependentConfigGroups').filterProperty('service.serviceName', serviceName).findProperty('isDefault');
+ this.get('groupsToSave')[serviceName] = defaultGroup.get('name');
+ }, this);
}.observes('selectedConfigGroup'),
@@ -132,23 +138,14 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* to which dependent configs will ve saved
* @method showSelectGroupsPopup
*/
- showSelectGroupsPopup: function(callback) {
- var servicesWithConfigGroups = [];
- this.get('dependentServiceNames').forEach(function(serviceName) {
- if (serviceName !== this.get('content.serviceName')) {
- if (!this.get('groupsToSave')[serviceName]) {
- var groups = this.get('dependentConfigGroups').filterProperty('service.serviceName', serviceName).mapProperty('name').uniq();
- servicesWithConfigGroups.push({
- serviceName: serviceName,
- configGroupNames: groups
- })
- }
+ showSelectGroupPopup: function(event) {
+ var serviceName = event.context;
+ if (serviceName !== this.get('content.serviceName')) {
+ var groups = this.get('dependentConfigGroups').filterProperty('service.serviceName', serviceName).mapProperty('name').uniq();
+ if (groups.length) {
+ var configs = this.get('_dependentConfigValues').filterProperty('serviceName', serviceName);
+ App.showSelectGroupsPopup(serviceName, groups, this.get('groupsToSave'), configs);
}
- }, this);
- if (servicesWithConfigGroups.length > 0) {
- App.showSelectGroupsPopup(servicesWithConfigGroups, this.get('groupsToSave'), callback);
- } else {
- callback();
}
},
@@ -223,16 +220,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* @method dependenciesSuccess
*/
dependenciesSuccess: function (data, opt, params) {
- var self = this;
- if (!this.get('selectedConfigGroup.isDefault')) {
- self.showSelectGroupsPopup(function () {
- self._saveRecommendedValues(data, params.initial);
- self._updateDependentConfigs(self.get('selectedConfigGroup.isDefault'));
- });
- } else {
- self._saveRecommendedValues(data, params.initial);
- self._updateDependentConfigs(self.get('selectedConfigGroup.isDefault'));
- }
+ this._saveRecommendedValues(data, params.initial);
+ this._updateDependentConfigs();
},
/**
@@ -241,9 +230,9 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
*/
showChangedDependentConfigs: function(event, callback, secondary) {
var self = this;
- if (self.get('_dependentConfigValues.length') > 0) {
+ if (this.get('_dependentConfigValues.length') > 0) {
App.showDependentConfigsPopup(this.get('_dependentConfigValues'), function() {
- self._updateDependentConfigs(self.get('selectedConfigGroup.isDefault'));
+ self._updateDependentConfigs();
if (callback) {
callback();
}
@@ -297,10 +286,9 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
/**
* save values that are stored in <code>_dependentConfigValues<code>
* to step configs
- * @param isDefaultConfigGroup
* @private
*/
- _updateDependentConfigs: function(isDefaultConfigGroup) {
+ _updateDependentConfigs: function() {
var self = this;
var dependentConfigs = this.get('_dependentConfigValues');
this.get('stepConfigs').forEach(function(serviceConfigs) {
@@ -309,9 +297,12 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
var dependentConfig = dependentConfigs.filterProperty('propertyName', cp.get('name')).findProperty('fileName', App.config.getConfigTagFromFileName(cp.get('filename')));
if (dependentConfig) {
var valueToSave = dependentConfig.saveRecommended ? dependentConfig.recommendedValue : dependentConfig.value;
- if (isDefaultConfigGroup || selectedGroup.get('isDefault')) {
+ if (selectedGroup.get('isDefault')) {
cp.set('value', valueToSave);
} else {
+ if (serviceConfigs.get('serviceName') !== self.get('content.serviceName')) {
+ cp.set('value', cp.get('defaultValue'));
+ }
var overridenConfig = cp.get('overrides') && cp.get('overrides').findProperty('group.name', selectedGroup.get('name'));
if (overridenConfig) {
overridenConfig.set('value', valueToSave);
@@ -430,6 +421,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
configGroup: group ? group.get('name') : service.get('displayName') + " Default",
value: value,
serviceName: serviceName,
+ allowChangeGroup: serviceName != this.get('content.serviceName') && !this.get('selectedConfigGroup.isDefault'),
+ serviceDisplayName: service.get('displayName'),
recommendedValue: configs[key].properties[propertyName]
});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index e5b8a9b..2af791a 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5580,6 +5580,18 @@ input[type="checkbox"].align-checkbox {
}
}
+#config-dependencies {
+ max-height: 500px;
+ overflow-y: auto;
+ td {
+ min-width: 120px;
+ }
+ td.check-box-col {
+ min-width: 5px;
+ width: 5px;
+ }
+}
+
.path-link {
white-space: nowrap;
cursor: pointer;
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
index 3c02de9..c42d50d 100644
--- a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
+++ b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
@@ -19,11 +19,11 @@
<div class="alert alert-warning">
{{t popup.dependent.configs.title}}
</div>
-<div id="config-validation-warnings" class="limited-height-2">
- <table class="table no-borders">
+<div id="config-dependencies" class="limited-height-2">
+ <table class="table table-striped">
<thead>
<tr>
- <th>{{t popup.dependent.configs.table.saveProperty}}</th>
+ <th class="check-box-col">{{view view.ToggleAll}}</th>
<th>{{t common.property}}</th>
<th>{{t common.service}}</th>
<th>{{t common.configGroup}}</th>
@@ -35,10 +35,15 @@
<tbody>
{{#each config in view.parentView.configs}}
<tr>
- <td>{{view Em.Checkbox checkedBinding="config.saveRecommended"}}</td>
+ <td class="check-box-col">{{view Em.Checkbox checkedBinding="config.saveRecommended"}}</td>
<td>{{config.propertyName}}</td>
- <td>{{config.serviceName}}</td>
- <td>{{config.configGroup}}</td>
+ <td>{{config.serviceDisplayName}}</td>
+ <td>
+ <span {{bindAttr class="config.allowChangeGroup::not-active-link"}} ><a href="javascript:void(null);" class="black"
+ {{action showSelectGroupPopup config.serviceName target="App.router.mainServiceInfoConfigsController"}}>
+ {{config.configGroup}}
+ </a></span>
+ </td>
<td>{{config.fileName}}</td>
<td>{{config.value}}</td>
<td>{{config.recommendedValue}}</td>
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/templates/common/modal_popups/select_groups_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/select_groups_popup.hbs b/ambari-web/app/templates/common/modal_popups/select_groups_popup.hbs
index 09ee681..00a24ef 100644
--- a/ambari-web/app/templates/common/modal_popups/select_groups_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/select_groups_popup.hbs
@@ -16,17 +16,12 @@
* limitations under the License.
}}
-<div class="alert alert-warning">
- {{t popup.dependent.configs.select.config.group}}
-</div>
<form class="form-horizontal">
-{{#each service in view.parentView.dependentServices}}
<div class="form-group">
- <label class="col-sm-2 control-label">{{service.serviceName}} </label>
+ <label class="col-sm-2 control-label"><strong>{{view.parentView.serviceName}} </strong> </label>
<div class="col-sm-8">
- {{view App.selectConfigGroupForService contentBinding="service.configGroupNames" serviceNameBinding="service.serviceName" groupsToSaveBinding="groupsToSave"}}
+ {{view Ember.Select contentBinding="view.parentView.groups" valueBinding="view.parentView.selectedGroup"}}
</div>
</div>
-{{/each}}
</form>
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
index c412762..90729e6 100644
--- a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
+++ b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
@@ -21,35 +21,41 @@ var App = require('app');
/**
* Show confirmation popup
* @param {[Object]} configs
- * @param {function} [callback=null]
+ * @param {function} [primary=null]
* @param {function} [secondary=null]
* we use this parameter to defer saving configs before we make some decisions.
* @return {App.ModalPopup}
*/
-App.showDependentConfigsPopup = function (configs, callback, secondary) {
+App.showDependentConfigsPopup = function (configs, primary, secondary) {
return App.ModalPopup.show({
encodeBody: false,
header: Em.I18n.t('popup.dependent.configs.header'),
classNames: ['sixty-percent-width-modal','modal-full-width'],
configs: configs,
bodyClass: Em.View.extend({
- templateName: require('templates/common/modal_popups/dependent_configs_list')
+ templateName: require('templates/common/modal_popups/dependent_configs_list'),
+
+ ToggleAll: Em.Checkbox.extend({
+ didInsertElement: function () {
+ this.set('checked', !this.get('parentView.parentView.configs').someProperty('saveRecommended', false));
+ },
+ click: function () {
+ this.get('parentView.parentView.configs').setEach('saveRecommended', this.get('checked'));
+ }
+ })
}),
- stepConfigs: function() {
- return App.get('router.mainServiceInfoConfigsController.stepConfigs').objectAt(0).get('configs');
- }.property('controller.stepConfigs.@each'),
onPrimary: function () {
this._super();
- configs.forEach(function(c) {
+ this.get('configs').forEach(function (c) {
Em.set(c, 'saveRecommendedDefault', Em.get(c, 'saveRecommended'));
});
- if (callback) {
- callback();
+ if (primary) {
+ primary();
}
},
onSecondary: function() {
this._super();
- configs.forEach(function(c) {
+ this.get('configs').forEach(function(c) {
Em.set(c, 'saveRecommended', Em.get(c, 'saveRecommendedDefault'));
});
if (secondary) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/afae3449/ambari-web/app/views/common/modal_popups/select_groups_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/select_groups_popup.js b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
index 0448cdf..3774708 100644
--- a/ambari-web/app/views/common/modal_popups/select_groups_popup.js
+++ b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
@@ -20,58 +20,33 @@ var App = require('app');
/**
* Show confirmation popup
- * @param {[Object]} servicesWithGroups
+ * * @param {String} serviceName
+ * @param {String[]} groups
* @param {Object} groupsToSave
- * @param {function} [callback=null]
- * @param {function} [secondaryCallback=null]
- * we use this parameter to defer saving configs before we make some decisions.
+ * @param {Object[]} configs
* @return {App.ModalPopup}
*/
-App.showSelectGroupsPopup = function (servicesWithGroups, groupsToSave, callback, secondaryCallback) {
+App.showSelectGroupsPopup = function (serviceName, groups, groupsToSave, configs) {
return App.ModalPopup.show({
encodeBody: false,
primary: Em.I18n.t('common.save'),
secondary: Em.I18n.t('common.cancel'),
- header: Em.I18n.t('popup.dependent.configs.header'),
- dependentServices: servicesWithGroups,
+ header: Em.I18n.t('popup.dependent.configs.select.config.group.header'),
+ groups: groups,
+ serviceName: serviceName,
groupsToSave: groupsToSave,
+ selectedGroup: '',
+ didInsertElement: function() {
+ this._super();
+ this.set('selectedGroup', this.get('groupsToSave')[this.get('serviceName')]);
+ },
bodyClass: Em.View.extend({
templateName: require('templates/common/modal_popups/select_groups_popup')
}),
-
onPrimary: function () {
this._super();
- if (callback) {
- callback();
- }
- },
-
- onSecondary: function() {
- this._super();
- if(secondaryCallback) {
- secondaryCallback();
- }
+ this.get('groupsToSave')[this.get('serviceName')] = this.get('selectedGroup');
+ configs.setEach('configGroup', this.get('groupsToSave')[this.get('serviceName')]);
}
});
-};
-
-App.selectConfigGroupForService = Ember.Select.extend({
-
- /**
- * set Default group by default
- */
- didInsertElement: function() {
- var defaultVersion = this.get('content').find(function(cg) {
- return cg.contains('Default');
- });
- this.set('value', defaultVersion);
- },
-
- /**
- *
- */
- onChangeValue: function() {
- var groupsToSave = this.get('groupsToSave');
- groupsToSave[this.get('serviceName')] = this.get('value');
- }.observes('value')
-});
+};
\ No newline at end of file