Repository: ambari
Updated Branches:
  refs/heads/trunk 4c0b1f430 -> 45338f5e8


AMBARI-17491 Hive Database URL config updated by Ambari stack advisor 
recommendation. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 45338f5e838c3d99b54e7e08daeedfd3f6c71557
Parents: 4c0b1f4
Author: ababiichuk <[email protected]>
Authored: Thu Jun 30 11:25:24 2016 +0300
Committer: ababiichuk <[email protected]>
Committed: Thu Jun 30 12:05:40 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 26 +++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/45338f5e/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js 
b/ambari-web/app/controllers/main/service/item.js
index 79188aa..f551168 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1454,13 +1454,33 @@ App.MainServiceItemController = 
Em.Controller.extend(App.SupportClientConfigsDow
 
   /**
    * Describes condition when recommendation should be applied
-   * For removing services it's always true
-   * This property required for request for recommendations
+   * Unfortunately for removing services it's not always true
+   * Property should be updated only if it depends on service that will be 
removed
+   * (similar as on add service)
    *
    * @return {Boolean}
    * @override
    */
-  allowUpdateProperty: function() { return true; },
+  allowUpdateProperty: function (parentProperties, name, fileName) {
+    var stackProperty = App.configsCollection.getConfigByName(name, fileName);
+    if (!stackProperty || (stackProperty.serviceName === 
this.get('content.serviceName'))) {
+      /**
+       * update properties for current service (in case will be used not only 
for removing service)
+       * and properties that are not defined in stack
+       */
+      return true;
+    }
+    if (stackProperty.propertyDependsOn.length) {
+      /**
+       * update properties that depends on current service
+       */
+      return !!stackProperty.propertyDependsOn.filter(function (p) {
+        var service = App.config.get('serviceByConfigTypeMap')[p.type];
+        return service && (this.get('content.serviceName') === 
service.get('serviceName'));
+      }, this).length;
+    }
+    return false;
+  },
 
   /**
    * Just config version note

Reply via email to