You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/06/10 19:37:50 UTC

[1/2] ambari git commit: AMBARI-11842. Add Service wizard: Password configs missing (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk cd9d915aa -> 6779e0c95


AMBARI-11842. Add Service wizard: Password configs missing (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ec31c8a9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ec31c8a9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ec31c8a9

Branch: refs/heads/trunk
Commit: ec31c8a9dae0c2b9ccddc13dc5a1119ee472489c
Parents: cd9d915
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Jun 10 19:24:40 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Jun 10 20:37:21 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard/step7_controller.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ec31c8a9/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index fdc11c7..d20cee5 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -930,7 +930,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       var mappedConfigValue = type && configsMap[type] ? configsMap[type][_config.name] : null;
       if (!Em.isNone(mappedConfigValue) && ((installedServiceNames && installedServiceNames.contains(_config.serviceName) || nonServiceTab.someProperty('serviceName', _config.serviceName)))) {
         // prevent overriding already edited properties
-        if (_config.savedValue != mappedConfigValue) {
+        if (_config.savedValue != mappedConfigValue || _config.displayType == 'password') {
           _config.value = mappedConfigValue;
         }
         _config.savedValue = mappedConfigValue;


[2/2] ambari git commit: AMBARI-11843. Host config groups are lost (alexantonenko)

Posted by al...@apache.org.
AMBARI-11843. Host config groups are lost (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6779e0c9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6779e0c9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6779e0c9

Branch: refs/heads/trunk
Commit: 6779e0c95a23e7c45b9792d8136f4792f4587da1
Parents: ec31c8a
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Jun 10 19:34:53 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Jun 10 20:37:22 2015 +0300

----------------------------------------------------------------------
 .../service/manage_config_groups_controller.js  |  6 ++++--
 .../main/service/configs/config_overridable.js  | 22 +++++++++++++++++---
 ambari-web/app/utils/array_utils.js             | 20 ++++++++++++++++++
 3 files changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6779e0c9/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index df60dc6..f36158c 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -168,7 +168,8 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
       toClearHosts: groupsToClearHosts,
       toDelete: groupsToDelete,
       toSetHosts: groupsToSetHosts,
-      toCreate: groupsToCreate
+      toCreate: groupsToCreate,
+      initialGroups: originalGroupsCopy
     };
   }.property('selectedConfigGroup.hosts.@each', 'selectedConfigGroup.hosts.length', 'selectedConfigGroup.description', 'configGroups', 'isLoaded'),
 
@@ -780,7 +781,8 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
           if (!deleteQueriesRun && deleteQueriesCounter > 0) {
             deleteQueriesRun = true;
             modifiedConfigGroups.toClearHosts.forEach(function (cg) {
-              configsController.clearConfigurationGroupHosts(cg, finishFunction, finishFunction);
+              var initalGroupState = modifiedConfigGroups.initialGroups.findProperty('name', cg.get('name'));
+              configsController.clearConfigurationGroupHosts(cg, initalGroupState, finishFunction, finishFunction);
             }, this);
             modifiedConfigGroups.toDelete.forEach(function (cg) {
               configsController.deleteConfigurationGroup(cg, finishFunction, finishFunction);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6779e0c9/ambari-web/app/mixins/main/service/configs/config_overridable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/config_overridable.js b/ambari-web/app/mixins/main/service/configs/config_overridable.js
index df45e81..405e934 100644
--- a/ambari-web/app/mixins/main/service/configs/config_overridable.js
+++ b/ambari-web/app/mixins/main/service/configs/config_overridable.js
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+var arrayUtils = require('utils/array_utils');
 
 /**
  * Mixin with methods for config groups and overrides processing
@@ -358,20 +359,35 @@ App.ConfigOverridable = Em.Mixin.create({
   },
 
   /**
-   * Update config group's hosts list (clear it)
+   * Update config group's hosts list and leave only unmodified hosts in the group
    * Save updated config group on server
    * @param {App.ConfigGroup} configGroup
+   * @param {App.ConfigGroup} initalGroupState
    * @param {Function} successCallback
    * @param {Function} errorCallback
    * @method clearConfigurationGroupHosts
    */
-  clearConfigurationGroupHosts: function (configGroup, successCallback, errorCallback) {
+  clearConfigurationGroupHosts: function (configGroup, initalGroupState, successCallback, errorCallback) {
     configGroup = jQuery.extend({}, configGroup);
-    configGroup.set('hosts', []);
+    var unmodifiedHosts = this.getUnmodifiedHosts(configGroup, initalGroupState);
+    configGroup.set('hosts', unmodifiedHosts);
     this.updateConfigurationGroup(configGroup, successCallback, errorCallback);
   },
 
   /**
+   * Get the list of hosts that is not modified in the group
+   * @param configGroup - the new configuration of the group
+   * @param initialGroupState - the initial configuration of the group
+   * @returns {Array}
+   */
+  getUnmodifiedHosts: function (configGroup, initialGroupState) {
+    var currentHosts = configGroup.get('hosts');
+    var initialHosts = initialGroupState.get('hosts');
+
+    return arrayUtils.intersect(currentHosts, initialHosts);
+  },
+
+  /**
    * Do request to delete config group
    * @param {App.ConfigGroup} configGroup
    * @param {Function} [successCallback]

http://git-wip-us.apache.org/repos/asf/ambari/blob/6779e0c9/ambari-web/app/utils/array_utils.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/array_utils.js b/ambari-web/app/utils/array_utils.js
index be727ab..bee12ee 100644
--- a/ambari-web/app/utils/array_utils.js
+++ b/ambari-web/app/utils/array_utils.js
@@ -32,5 +32,25 @@ module.exports = {
       }
     });
     return result;
+  },
+
+
+  /**
+   * intersect two arrays and return the common values
+   *
+   * @param  {Array} arr1 - first array
+   * @param  {Array} arr2 - second array
+   * @return {Array} intersection - the intersection of arr1 and arr2
+   */
+  intersect: function (arr1, arr2) {
+    var intersection = [];
+    var shortest = arr1.length >= arr2.length ? arr2 : arr1;
+    var longest = arr1.length >= arr2.length ? arr1 : arr2;
+
+    shortest.forEach(function (entry) {
+      longest.indexOf(entry) > -1 ? intersection.push(entry) : null;
+    });
+
+    return intersection;
   }
 };