ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-13379. Ranger plugin toggles should be hidden for the services that are not installed or selected to get install. (jaimin)
Date Fri, 09 Oct 2015 19:10:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 4191d8817 -> fb3076352


AMBARI-13379. Ranger plugin toggles should be hidden for the services that are not installed
or selected to get install. (jaimin)


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

Branch: refs/heads/branch-2.1
Commit: fb3076352433f4650850e293b96d983e83a255d5
Parents: 4191d88
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Fri Oct 9 12:09:34 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Fri Oct 9 12:09:57 2015 -0700

----------------------------------------------------------------------
 .../server/state/theme/ConfigCondition.java     |  11 ++
 .../services/RANGER/themes/theme_version_1.json |  90 ++++++++++++-
 .../RANGER/configuration/ranger-admin-site.xml  |   2 +-
 .../RANGER/configuration/ranger-env.xml         |   2 +-
 .../RANGER/configuration/ranger-ugsync-site.xml |  28 ++---
 .../services/RANGER/themes/theme_version_2.json | 126 +++++++++++++++++--
 ambari-web/app/mappers/configs/themes_mapper.js |  17 ++-
 .../app/models/configs/config_condition.js      |   5 +
 .../configs/service_config_layout_tab_view.js   |   9 +-
 .../configs/widgets/config_widget_view.js       |  84 +++++++++----
 10 files changed, 305 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/java/org/apache/ambari/server/state/theme/ConfigCondition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/theme/ConfigCondition.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/theme/ConfigCondition.java
index 2d98660..bf54f8a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/theme/ConfigCondition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/theme/ConfigCondition.java
@@ -30,6 +30,8 @@ import java.util.List;
 public class ConfigCondition {
   @JsonProperty("configs")
   private List<String> configs;
+  @JsonProperty("resource")
+  private String resource;
   @JsonProperty("if")
   private String ifLabel;
   @JsonProperty("then")
@@ -69,6 +71,15 @@ public class ConfigCondition {
     this.elseLabel = elseLabel;
   }
 
+
+  public String getResource() {
+    return resource;
+  }
+
+  public void setResource(String resource) {
+    this.resource = resource;
+  }
+
   @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
   @JsonIgnoreProperties(ignoreUnknown = true)
   public class ConfigConditionResult {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
index 901512b..23f1a0b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
@@ -57,23 +57,103 @@
       "configs": [
         {
           "config": "ranger-env/ranger-hdfs-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col1"
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HDFS",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-hive-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col1"
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HIVE",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-hbase-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col2"
+          "subsection-name": "section-ranger-plugin-row1-col2",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HBASE",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-storm-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col2"
+          "subsection-name": "section-ranger-plugin-row1-col2",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "STORM",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-knox-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col3"
+          "subsection-name": "section-ranger-plugin-row1-col3",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "KNOX",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         }
       ]
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
index 49813d8..c2e94e2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
@@ -270,7 +270,7 @@
   <property>
     <name>ranger.ldap.ad.domain</name>
     <display-name>Domain Name (AD specific)</display-name>
-    <value>localhost</value>
+    <value></value>
     <description>AD domain, only used if Authentication method is AD</description>
     <description></description>
     <value-attributes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
index 5ed7b22..a25b891 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
@@ -28,7 +28,7 @@
 
   <property>
     <name>create_db_dbuser</name>
-    <value>false</value>
+    <value>true</value>
     <display-name>Setup Database and Databse User</display-name>
     <description>If set to Yes, Ranger will Setup Database and Databse User. This will
require to specify Database root user and password</description>
     <value-attributes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-ugsync-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-ugsync-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-ugsync-site.xml
index 4c12322..6f8d810 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-ugsync-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-ugsync-site.xml
@@ -178,8 +178,8 @@
   <property>
     <name>ranger.usersync.ldap.url</name>
     <display-name>LDAP (AD) URL</display-name>
-    <value>ldap://localhost:389</value>
-    <description>LDAP server URL</description>
+    <value></value>
+    <description>LDAP server URL. Example value = ldap://localhost:389</description>
   </property>
 
   <property>
@@ -225,7 +225,7 @@
   <property>
     <name>ranger.usersync.ldap.user.searchbase</name>
     <display-name>User Search Base</display-name>
-    <value>ou=users,dc=xasecure,dc=net</value>
+    <value></value>
     <description>"# search base for users
 # sample value would be ou=users,dc=hadoop,dc=apache,dc=org
 # overrides value specified in ranger.usersync.ldap.searchBase"</description>
@@ -353,7 +353,7 @@
   <property>
     <name>ranger.usersync.group.searchbase</name>
     <display-name>Group Search Base</display-name>
-    <value> </value>
+    <value></value>
     <description>"# search base for groups
 # sample value would be ou=groups,dc=hadoop,dc=apache,dc=org
 # overrides value specified in ranger.usersync.ldap.searchBase,  ranger.usersync.ldap.user.searchbase
@@ -375,44 +375,32 @@
   <property>
     <name>ranger.usersync.group.objectclass</name>
     <display-name>Group Object Class</display-name>
-    <value> </value>
+    <value></value>
     <description></description>
-    <value-attributes>
-      <empty-value-valid>true</empty-value-valid>
-    </value-attributes>
   </property>
 
   <property>
     <name>ranger.usersync.group.searchfilter</name>
-    <value> </value>
+    <value></value>
     <display-name>Group Search Filter</display-name>
     <description>"# optional additional filter constraining the groups selected for
syncing
 # a sample value would be (dept=eng)
 # please customize the value to suit your deployment
 # default value is empty"</description>
-    <value-attributes>
-      <empty-value-valid>true</empty-value-valid>
-    </value-attributes>
   </property>
 
   <property>
     <name>ranger.usersync.group.nameattribute</name>
     <display-name>Group Name Attribute</display-name>
-    <value> </value>
+    <value></value>
     <description>LDAP group name attribute</description>
-    <value-attributes>
-      <empty-value-valid>true</empty-value-valid>
-    </value-attributes>
   </property>
 
   <property>
     <name>ranger.usersync.group.memberattributename</name>
     <display-name>Group Member Attribute</display-name>
-    <value> </value>
+    <value></value>
     <description>LDAP group member attribute name</description>
-    <value-attributes>
-      <empty-value-valid>true</empty-value-valid>
-    </value-attributes>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
index 540c7f5..d19d5fc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
@@ -792,31 +792,143 @@
         },
         {
           "config": "ranger-env/ranger-hdfs-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col1"
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HDFS",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-yarn-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col1"
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "YARN",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-hive-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col1"
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HIVE",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-hbase-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col2"
+          "subsection-name": "section-ranger-plugin-row1-col2",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "HBASE",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-storm-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col2"
+          "subsection-name": "section-ranger-plugin-row1-col2",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "STORM",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-knox-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col3"
+          "subsection-name": "section-ranger-plugin-row1-col3",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "KNOX",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/ranger-kafka-plugin-enabled",
-          "subsection-name": "section-ranger-plugin-row1-col3"
+          "subsection-name": "section-ranger-plugin-row1-col3",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "KAFKA",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         }
       ]
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-web/app/mappers/configs/themes_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/themes_mapper.js b/ambari-web/app/mappers/configs/themes_mapper.js
index e23b691..2fc9641 100644
--- a/ambari-web/app/mappers/configs/themes_mapper.js
+++ b/ambari-web/app/mappers/configs/themes_mapper.js
@@ -225,12 +225,17 @@ App.themesMapper = App.QuickDataMapper.create({
       configCondition.id = configProperty.get('id') + '_' + index;
       configCondition.config_name =  configProperty.get('name');
       configCondition.file_name =  configProperty.get('filename');
-      configCondition.configs =  _configCondition.configs.map(function(item) {
-        var result = {};
-        result.fileName = item.split('/')[0] + '.xml';
-        result.configName = item.split('/')[1];
-        return result;
-      });
+      if (_configCondition.configs && _configCondition.configs.length) {
+        configCondition.configs = _configCondition.configs.map(function (item) {
+          var result = {};
+          result.fileName = item.split('/')[0] + '.xml';
+          result.configName = item.split('/')[1];
+          return result;
+        });
+      }
+
+      configCondition.resource = _configCondition.resource || 'config';
+
       configConditionsCopy.pushObject(configCondition);
     }, this);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-web/app/models/configs/config_condition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/config_condition.js b/ambari-web/app/models/configs/config_condition.js
index 26cf219..f978424 100644
--- a/ambari-web/app/models/configs/config_condition.js
+++ b/ambari-web/app/models/configs/config_condition.js
@@ -47,6 +47,11 @@ App.ConfigCondition = DS.Model.extend({
   configs: DS.attr('array', {defaultValue: []}),
 
   /**
+   * resource can be `config`, `service`
+   */
+  resource: DS.attr('string', {defaultValue: 'config'}),
+
+  /**
    * conditional String which can be evaluated to boolean result.
    * If evaluated result of this staring is true then use the statement provided by `then`
attribute.
    * Otherwise use the attribute provided by `else` attributes

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
index 5cce947..2f23f2d 100644
--- a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
+++ b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
@@ -119,9 +119,14 @@ App.ServiceConfigLayoutTabView = Em.View.extend(App.ConfigOverridable,
{
         stackConfigProperty: config
       };
 
+
       var configConditions = App.ConfigCondition.find().filter(function (_configCondition)
{
-        var conditionalConfigs = _configCondition.get('configs').filterProperty('fileName',
config.get('filename')).filterProperty('configName', config.get('name'));
-        return (conditionalConfigs && conditionalConfigs.length);
+        // Filter config condition depending on the value of another config
+        var conditionalConfigs = (_configCondition.get('configs')||[]).filterProperty('fileName',
config.get('filename')).filterProperty('configName', config.get('name'));
+        // Filter config condition depending on the service existence or service state
+        var serviceConfigCondition = ((_configCondition.get('configName') === config.get('name'))
&&  (_configCondition.get('fileName') === config.get('filename')) &&  (_configCondition.get('resource')
=== 'service'));
+        var conditions = conditionalConfigs.concat(serviceConfigCondition);
+        return ((conditions && conditions.length));
       }, this);
 
       if (configConditions && configConditions.length) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb307635/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 5fa6430..f1c0b93 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -379,7 +379,10 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
     var configConditions = this.get('config.configConditions');
     if (configConditions && configConditions.length) {
       this.configValueObserver();
-      this.addObserver('config.value', this, this.configValueObserver);
+      var isConditionConfigDependent =  configConditions.filterProperty('resource', 'config').length;
+      if (isConditionConfigDependent) {
+        this.addObserver('config.value', this, this.configValueObserver);
+      }
     }
   },
 
@@ -393,42 +396,69 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs,
App.WidgetPo
     var configConditions = this.get('config.configConditions');
     var serviceName = this.get('config.serviceName');
     var serviceConfigs = this.get('controller.stepConfigs').findProperty('serviceName',serviceName).get('configs');
+    var isConditionTrue;
     configConditions.forEach(function(configCondition){
       var ifStatement =  configCondition.get("if");
-      var splitIfCondition = ifStatement.split('===');
-      var ifCondition =  splitIfCondition[0];
-      var result = splitIfCondition[1] || "true";
-      var conditionalConfigName = configCondition.get("configName");
-      var conditionalConfigFileName = configCondition.get("fileName");
-      var parseIfConditionVal = ifCondition;
-      var regex = /\$\{.*?\}/g;
-      var configStrings = ifCondition.match(regex);
-      configStrings.forEach(function(_configString){
-        var configObject = _configString.substring(2, _configString.length-1).split("/");
-        var config = serviceConfigs.filterProperty('filename',configObject[0] + '.xml').findProperty('name',
configObject[1]);
-        if (config) {
-          var configValue = config.get('value');
-          parseIfConditionVal = parseIfConditionVal.replace(_configString, configValue);
-        }
-      }, this);
-
-      var isConditionTrue =  window.eval(JSON.stringify(parseIfConditionVal.trim())) ===
result.trim();
-      var action = isConditionTrue ? configCondition.get("then") : configCondition.get("else");
-      var valueAttributes = action.property_value_attributes;
-      for (var key in valueAttributes) {
-        if (valueAttributes.hasOwnProperty(key)) {
-          var valueAttribute = App.StackConfigValAttributesMap[key] || key;
-          var conditionalConfig = serviceConfigs.filterProperty('filename',conditionalConfigFileName).findProperty('name',
conditionalConfigName);
-          if (conditionalConfig) {
-            conditionalConfig.set(valueAttribute, valueAttributes[key]);
+      if (configCondition.get("resource") === 'config') {
+        var splitIfCondition = ifStatement.split('===');
+        var ifCondition =  splitIfCondition[0];
+        var result = splitIfCondition[1] || "true";
+        var parseIfConditionVal = ifCondition;
+        var regex = /\$\{.*?\}/g;
+        var configStrings = ifCondition.match(regex);
+        configStrings.forEach(function(_configString){
+          var configObject = _configString.substring(2, _configString.length-1).split("/");
+          var config = serviceConfigs.filterProperty('filename',configObject[0] + '.xml').findProperty('name',
configObject[1]);
+          if (config) {
+            var configValue = config.get('value');
+            parseIfConditionVal = parseIfConditionVal.replace(_configString, configValue);
           }
+        }, this);
+
+        isConditionTrue =  window.eval(JSON.stringify(parseIfConditionVal.trim())) === result.trim();
+        this.changeConfigAttribute(configCondition, isConditionTrue);
+      } else if (configCondition.get("resource") === 'service') {
+        var service = App.Service.find().findProperty('serviceName', ifStatement);
+        var serviceName;
+        if (service) {
+          isConditionTrue = true;
+        } else if (!service && this.get('controller.allSelectedServiceNames') &&
this.get('controller.allSelectedServiceNames').length) {
+          isConditionTrue = this.get('controller.allSelectedServiceNames').contains(ifStatement);
+        } else {
+          isConditionTrue = false;
         }
+        this.changeConfigAttribute(configCondition, isConditionTrue);
       }
     }, this);
   },
 
 
   /**
+   *
+   * @param configCondition {App.ConfigCondition}
+   * @param isConditionTrue {boolean}
+   */
+  changeConfigAttribute: function(configCondition, isConditionTrue) {
+    var conditionalConfigName = configCondition.get("configName");
+    var conditionalConfigFileName = configCondition.get("fileName");
+    var serviceName = this.get('config.serviceName');
+    var serviceConfigs = this.get('controller.stepConfigs').findProperty('serviceName',serviceName).get('configs');
+    var action = isConditionTrue ? configCondition.get("then") : configCondition.get("else");
+    var valueAttributes = action.property_value_attributes;
+    for (var key in valueAttributes) {
+      if (valueAttributes.hasOwnProperty(key)) {
+        var valueAttribute = App.StackConfigValAttributesMap[key] || key;
+        var conditionalConfig = serviceConfigs.filterProperty('filename',conditionalConfigFileName).findProperty('name',
conditionalConfigName);
+        if (conditionalConfig) {
+          conditionalConfig.set(valueAttribute, valueAttributes[key]);
+        }
+      }
+    }
+  },
+
+
+
+  /**
    * set widget value same as config value
    * useful for widgets that work with intermediate config value, not original
    * for now used in slider widget


Mime
View raw message