You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/05/27 11:04:35 UTC
ambari git commit: AMBARI-16896. It is possible to save service
configs changes without applying config dependencies on step7 (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 99becb418 -> 553e6dfc7
AMBARI-16896. It is possible to save service configs changes without applying config dependencies
on step7 (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/553e6dfc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/553e6dfc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/553e6dfc
Branch: refs/heads/trunk
Commit: 553e6dfc783443daacbd6eba84c041c537b354aa
Parents: 99becb4
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu May 26 16:49:05 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri May 27 14:02:16 2016 +0300
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 10 ++++--
.../mixins/common/configs/enhanced_configs.js | 2 ++
.../common/configs/enhanced_configs_test.js | 32 ++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/553e6dfc/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 b6e6c21..91a0eef 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -27,6 +27,12 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
isRecommendedLoaded: true,
+ /**
+ * Is true while request to recommendations is in progress
+ * @type {Boolean}
+ */
+ recommendationsInProgress: false,
+
dataIsLoaded: false,
stepConfigs: [], //contains all field properties that are viewed in this service
@@ -136,8 +142,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
*/
isSubmitDisabled: function () {
if (!this.get('selectedService')) return true;
- return this.get('selectedService').get('errorCount') !== 0 || this.get('saveInProgress');
- }.property('selectedService.errorCount', 'saveInProgress'),
+ return this.get('selectedService').get('errorCount') !== 0 || this.get('saveInProgress') || this.get('recommendationsInProgress');
+ }.property('selectedService.errorCount', 'saveInProgress', 'recommendationsInProgress'),
/**
* Determines if some config value is changed
http://git-wip-us.apache.org/repos/asf/ambari/blob/553e6dfc/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 4ae9ca5..50c4339 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -174,6 +174,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
dataToSend.recommendations = recommendations;
var self = this;
+ this.set('recommendationsInProgress', true);
return App.ajax.send({
name: 'config.recommendations',
sender: this,
@@ -184,6 +185,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
success: 'loadRecommendationsSuccess',
error: 'loadRecommendationsError',
callback: function() {
+ self.set('recommendationsInProgress', false);
self.set('recommendationTimeStamp', (new Date).getTime());
if (onComplete) {
onComplete()
http://git-wip-us.apache.org/repos/asf/ambari/blob/553e6dfc/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
index 3ec4b07..012c221 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -17,6 +17,7 @@
*/
var App = require('app');
+var testHelpers = require('test/helpers');
describe('App.EnhancedConfigsMixin', function() {
@@ -157,5 +158,36 @@ describe('App.EnhancedConfigsMixin', function() {
)
});
});
+
+ describe("#loadConfigRecommendations", function () {
+ var mixinInstance;
+
+ beforeEach(function(){
+ mixinInstance = mixinObject.create({
+ recommendationsConfigs: {},
+ stepConfigs: [],
+ hostGroups: {
+ blueprint: {
+ configurations: {}
+ }
+ }
+ });
+ this.mockedCallback = sinon.stub();
+ });
+
+ it("shound call callback if changedConfigs is empty array", function() {
+ mixinInstance.loadConfigRecommendations([], this.mockedCallback);
+ expect(App.ajax.send.calledOnce).to.be.false;
+ expect(this.mockedCallback.calledOnce).to.be.true;
+ });
+
+ it("shound call callback from ajax callback if changedConfigs is not empty", function() {
+ mixinInstance.loadConfigRecommendations([{}], this.mockedCallback);
+ var args = testHelpers.findAjaxRequest('name', 'config.recommendations');
+ expect(args[0]).exists;
+ args[0].callback();
+ expect(this.mockedCallback.calledOnce).to.be.true;
+ });
+ });
});