Repository: ambari Updated Branches: refs/heads/branch-2.5 c63cb94ec -> 40c206a76
AMBARI-19781 Reassign wizard erases config properties attributes. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/40c206a7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/40c206a7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/40c206a7 Branch: refs/heads/branch-2.5 Commit: 40c206a76869d5725fac37abb2953351623b5ba1 Parents: c63cb94 Author: Max Shepel <[email protected]> Authored: Mon Jan 30 23:47:51 2017 +0200 Committer: Max Shepel <[email protected]> Committed: Mon Jan 30 23:47:51 2017 +0200 ---------------------------------------------------------------------- .../main/service/reassign/step4_controller.js | 15 +++++++++++---- .../main/service/reassign/step4_controller_test.js | 10 +++++----- 2 files changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/40c206a7/ambari-web/app/controllers/main/service/reassign/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index 431a67f..e14cb2a 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -754,10 +754,14 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro var componentName = this.get('content.reassign.component_name'); var targetHostName = this.get('content.reassignHosts.target'); var configs = {}; + var attributes = {}; var secureConfigs = []; data.items.forEach(function (item) { configs[item.type] = item.properties; + if (item.properties_attributes) { + attributes[item.type] = item.properties_attributes; + } }, this); this.setAdditionalConfigs(configs, componentName, targetHostName); @@ -797,7 +801,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro } this.saveClusterStatus(secureConfigs, this.getComponentDir(configs, componentName)); - this.saveConfigsToServer(configs); + this.saveConfigsToServer(configs, attributes); this.saveServiceProperties(configs); }, @@ -831,13 +835,14 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro /** * make PUT call to save configs to server * @param configs + * @param attributes */ - saveConfigsToServer: function (configs) { + saveConfigsToServer: function (configs, attributes) { App.ajax.send({ name: 'common.across.services.configurations', sender: this, data: { - data: '[' + this.getServiceConfigData(configs).toString() + ']' + data: '[' + this.getServiceConfigData(configs, attributes).toString() + ']' }, success: 'onSaveConfigs', error: 'onTaskError' @@ -846,10 +851,11 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro /** * gather and format config data before sending to server * @param configs + * @param attributes * @return {Array} * @method getServiceConfigData */ - getServiceConfigData: function (configs) { + getServiceConfigData: function (configs, attributes) { var componentName = this.get('content.reassign.component_name'); var tagName = 'version' + (new Date).getTime(); var configData = Object.keys(configs).map(function (_siteName) { @@ -857,6 +863,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro type: _siteName, tag: tagName, properties: configs[_siteName], + properties_attributes: attributes[_siteName] || {}, service_config_version_note: Em.I18n.t('services.reassign.step4.save.configuration.note').format(App.format.role(componentName, false)) } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/40c206a7/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js index 32bbdbd..362153a 100644 --- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js @@ -1095,13 +1095,13 @@ describe('App.ReassignMasterWizardStep4Controller', function () { it('No services', function () { services = []; controller.set('content.reassign.component_name', 'COMP1'); - expect(controller.getServiceConfigData([])).to.eql([]); + expect(controller.getServiceConfigData({})).to.eql([]); }); it('No services in stackServices', function () { services = [Em.Object.create({serviceName: 'S1'})]; stackServices = []; controller.set('content.reassign.component_name', 'COMP1'); - expect(controller.getServiceConfigData([])).to.eql([]); + expect(controller.getServiceConfigData({}, {})).to.eql([]); }); it('Services in stackServices, but configTypesRendered is empty', function () { services = [Em.Object.create({serviceName: 'S1'})]; @@ -1110,7 +1110,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { configTypesRendered: {} })]; controller.set('content.reassign.component_name', 'COMP1'); - expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}"); + expect(controller.getServiceConfigData({}, {})[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}"); }); it('Services in stackServices, and configTypesRendered has data, but configs is empty', function () { services = [Em.Object.create({serviceName: 'S1'})]; @@ -1121,7 +1121,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { }) ]; controller.set('content.reassign.component_name', 'COMP1'); - expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}"); + expect(controller.getServiceConfigData({}, {})[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}"); }); it('Services in stackServices, and configTypesRendered has data, and configs present', function () { services = [Em.Object.create({serviceName: 'S1'})]; @@ -1137,7 +1137,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { } }; controller.set('content.reassign.component_name', 'COMP1'); - expect(JSON.parse(controller.getServiceConfigData(configs)[0]).Clusters.desired_config.length).to.equal(1); + expect(JSON.parse(controller.getServiceConfigData(configs, {})[0]).Clusters.desired_config.length).to.equal(1); }); });
