You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/05/07 13:48:09 UTC
ambari git commit: AMBARI-10994. 'Set Recommended Value' action
should show up for configs with static-recommended-values (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 524368b4a -> e65bad149
AMBARI-10994. 'Set Recommended Value' action should show up for configs with static-recommended-values (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e65bad14
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e65bad14
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e65bad14
Branch: refs/heads/trunk
Commit: e65bad149d6722b788715a32aaec075183d2f3a8
Parents: 524368b
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu May 7 14:44:01 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu May 7 14:44:01 2015 +0300
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 16 ++++++++++----
.../common/configs/service_config_category.hbs | 2 +-
.../main/service/info/config_test.js | 23 ++++++++++++++++++++
3 files changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e65bad14/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 9513b9a..293bba7 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -405,7 +405,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
* if property defined in stack but somehow it missed from cluster properties (can be after stack upgrade)
* ui should add this properties to step configs
*/
- configs = self.addMissedPropertiesFromStack(configs);
+ configs = self.mergeWithStackProperties(configs);
//put properties from capacity-scheduler.xml into one config with textarea view
if (self.get('content.serviceName') === 'YARN') {
@@ -430,13 +430,20 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
/**
* adds properties form stack that doesn't belong to cluster
* to step configs
+ * also set recommended value if isn't exists
*
* @return {App.ServiceConfigProperty[]}
- * @method addMissedPropertiesFromStack
+ * @method mergeWithStackProperties
*/
- addMissedPropertiesFromStack: function(configs) {
+ mergeWithStackProperties: function(configs) {
this.get('advancedConfigs').forEach(function(advanced) {
- if (!configs.someProperty('name', advanced.get('name'))) {
+ var c = configs.findProperty('name', advanced.get('name'));
+ if (c) {
+ if (!c.get('recommendedValue')) {
+ c.set('recommendedValue', advanced.get('value'));
+ }
+ }
+ else {
configs.pushObject(App.ServiceConfigProperty.create({
name: advanced.get('name'),
displayName: advanced.get('displayName'),
@@ -445,6 +452,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
filename: advanced.get('fileName'),
isUserProperty: false,
isNotSaved: true,
+ recommendedValue: advanced.get('value'),
isFinal: advanced.get('isFinal'),
defaultIsFinal: advanced.get('defaultIsFinal'),
serviceName: advanced.get('serviceName'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/e65bad14/ambari-web/app/templates/common/configs/service_config_category.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_category.hbs b/ambari-web/app/templates/common/configs/service_config_category.hbs
index b58a644..e879871 100644
--- a/ambari-web/app/templates/common/configs/service_config_category.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_category.hbs
@@ -120,7 +120,7 @@
<a class="btn btn-small" href="#" data-toggle="tooltip"
{{action "setRecommendedValue" this target="view"}}
{{translateAttr data-original-title="services.service.config.setRecommendedValue"}}>
- <i class="icon-arrow-down text-info"></i>
+ <i class="icon-repeat"></i>
</a>
{{/if}}
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e65bad14/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index 7bed552..de0e618 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -1340,4 +1340,27 @@ describe("App.MainServiceInfoConfigsController", function () {
});
+ describe('#mergeWithStackProperties', function () {
+
+ it('should set recommended value', function () {
+ mainServiceInfoConfigsController.reopen({
+ advancedConfigs: [
+ Em.Object.create({
+ name: 'n1',
+ value: 'v1'
+ })
+ ]
+ });
+ var configs = [
+ Em.Object.create({
+ name: 'n1',
+ recommendedValue: null
+ })
+ ];
+ configs = mainServiceInfoConfigsController.mergeWithStackProperties(configs);
+ expect(configs.findProperty('name', 'n1').get('recommendedValue')).to.equal('v1');
+ });
+
+ });
+
});