Repository: ambari Updated Branches: refs/heads/trunk bc0110428 -> 7acf07ace
AMBARI-6789 FE Service config page fails saving deleted custom property. (Buzhor Denys via ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7acf07ac Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7acf07ac Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7acf07ac Branch: refs/heads/trunk Commit: 7acf07ace00955f64274b9f615a1aa643f6d8f9b Parents: bc01104 Author: aBabiichuk <[email protected]> Authored: Fri Aug 8 14:12:19 2014 +0300 Committer: aBabiichuk <[email protected]> Committed: Fri Aug 8 14:12:35 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/main/service/info/configs.js | 13 +++++++++---- ambari-web/app/utils/config.js | 2 +- ambari-web/app/views/common/configs/services_config.js | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7acf07ac/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 f672680..7f27f2e 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -50,6 +50,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ currentVersion: null, //version selected to view selectedVersion: null, + // file names of changed configs + modifiedFileNames: [], versionLoaded: false, isCurrentSelected: function () { return this.get('selectedVersion') === this.get('currentVersion'); @@ -154,6 +156,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ */ clearStep: function () { this.set("isApplyingChanges", false); + this.set('modifiedFileNames', []); this.set('isInit', true); this.set('hash', null); this.set('forceTransition', false); @@ -1115,14 +1118,16 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ var modifiedConfigs = configs // get only modified and created configs .filter(function(config) { return config.get('isNotDefaultValue') || config.get('isNotSaved'); }) - // get file names - .mapProperty('filename').uniq() + // get file names and add file names that was modified, for example after property removing + .mapProperty('filename').concat(this.get('modifiedFileNames')).uniq() // get configs by filename .map(function(fileName) { return configs.filterProperty('filename', fileName); - }) + }); + if (!!modifiedConfigs.length) { // concatenate results - .reduce(function(current, prev) { return current.concat(prev); }); + modifiedConfigs = modifiedConfigs.reduce(function(current, prev) { return current.concat(prev); }); + } // save modified original configs that have no group this.saveSiteConfigs(modifiedConfigs.filter(function(config) { return !config.get('group'); })); http://git-wip-us.apache.org/repos/asf/ambari/blob/7acf07ac/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index 77920b0..f910510 100644 --- a/ambari-web/app/utils/config.js +++ b/ambari-web/app/utils/config.js @@ -963,7 +963,7 @@ App.config = Em.Object.create({ group: group, id: 'site property', serviceName: group.get('service.serviceName'), - filename: config.type, + filename: this.getOriginalFileName(config.type), isUserProperty: true, isVisible: true, isOverridable: false http://git-wip-us.apache.org/repos/asf/ambari/blob/7acf07ac/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 429039e..6646f9d 100644 --- a/ambari-web/app/views/common/configs/services_config.js +++ b/ambari-web/app/views/common/configs/services_config.js @@ -678,6 +678,10 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, { removeProperty: function (event) { var serviceConfigProperty = event.contexts[0]; this.get('serviceConfigs').removeObject(serviceConfigProperty); + // push config's file name if this config was stored on server + if (!serviceConfigProperty.get('isNotSaved')) { + this.get('controller').get('modifiedFileNames').push(serviceConfigProperty.get('filename')); + } Em.$('body>.tooltip').remove(); //some tooltips get frozen when their owner's DOM element is removed },
