This is an automated email from the ASF dual-hosted git repository.

vel pushed a commit to branch ranger-2.2
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.2 by this push:
     new b9aed23  RANGER-3177 : Toggle switch not render after change in 
resources drop down value.
b9aed23 is described below

commit b9aed233726ed75cf2b7b2dabe36b9244d71f529
Author: Nitin Galave <ni3gal...@apache.org>
AuthorDate: Thu Feb 11 00:01:27 2021 +0530

    RANGER-3177 : Toggle switch not render after change in resources drop down 
value.
    
    Signed-off-by: Velmurugan Periasamy <v...@apache.org>
---
 security-admin/src/main/webapp/scripts/modules/XAOverrides.js     | 8 +++++---
 .../src/main/webapp/scripts/views/policies/RangerPolicyForm.js    | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js 
b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
index d99f646..a7904eb 100644
--- a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
+++ b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
@@ -532,7 +532,10 @@
                           var Vent = require('modules/Vent');
                          if(!_.isNull(this.value) && !_.isEmpty(this.value)){
                                this.value.values = _.map(this.value.values, 
function(val){ return _.escape(val); });
-                               this.$resource.val(this.value.values.toString())
+                                       // Set initial value for resources.
+                                       if (_.isUndefined(def)) {
+                                               
this.$resource.val(this.value.values.toString());
+                                       }
                                //to preserve resources values to text field
                                if(!_.isUndefined(this.value.resourceType)){
                                        
this.preserveResourceValues[this.value.resourceType] = 
this.value.values.toString();    
@@ -636,8 +639,7 @@
                                                        
that.$resource.select2('val', val)
                                                }else{
                                                        
that.$resource.select2('val', "");
-                                                       that.value=[];
-                                               }
+                                               }
                                                //reset values
                                                that.value.isExcludes = false;
                                                that.value.isRecursive = false;
diff --git 
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js 
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
index fd1cae8..b52579a 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
@@ -597,6 +597,9 @@ define(function(require){
                 this.model.set('zoneName', App.vZone.vZoneName);
             }
                        this.model.set('resources',resources);
+                       if(this.model.get('none')) {
+                               this.model.unset('none');
+                       }
                        this.model.unset('path');
                        
                        //Set UserGroups Permission

Reply via email to