This is an automated email from the ASF dual-hosted git repository.
mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new f9926cd RANGER-2582 : Policy history details popup not getting
populated properly
f9926cd is described below
commit f9926cd6d4113e00e508496665cc36d092168323
Author: Nitin Galave <[email protected]>
AuthorDate: Fri Sep 20 20:01:45 2019 +0530
RANGER-2582 : Policy history details popup not getting populated properly
Signed-off-by: Mehul Parikh <[email protected]>
---
security-admin/src/main/webapp/scripts/models/RangerPolicy.js | 2 +-
.../src/main/webapp/scripts/views/policies/RangerPolicyRO.js | 8 +++++---
.../main/webapp/scripts/views/policies/RangerPolicyTableLayout.js | 2 +-
.../src/main/webapp/scripts/views/reports/AuditLayout.js | 2 +-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/security-admin/src/main/webapp/scripts/models/RangerPolicy.js
b/security-admin/src/main/webapp/scripts/models/RangerPolicy.js
index cd873b3..9f7b86f 100644
--- a/security-admin/src/main/webapp/scripts/models/RangerPolicy.js
+++ b/security-admin/src/main/webapp/scripts/models/RangerPolicy.js
@@ -137,7 +137,7 @@ define(function(require){
async : false,
dataType : 'JSON',
success : function(data){
- versionList = data.value.split(',');
+ versionList =
(data.value.split(',').map(Number)).sort(function(a, b) { return a - b });
},
});
return versionList;
diff --git
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
index af024e2..5811ccf 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
@@ -262,7 +262,8 @@ define(function(require) {
var $el = $(e.currentTarget);
if($el.hasClass('active')){
var curr = this.policy.get('version');
- this.getPolicyByVersion(++curr, e);
+ var nextVal =
this.policyVersionList[(_.indexOf(this.policyVersionList, curr)+1) %
this.policyVersionList.length];
+ this.getPolicyByVersion(nextVal, e);
}
},
@@ -270,7 +271,8 @@ define(function(require) {
var $el = $(e.currentTarget);
if($el.hasClass('active')){
var curr = this.policy.get('version');
- this.getPolicyByVersion(--curr, e);
+ var previousVal =
this.policyVersionList[(_.indexOf(this.policyVersionList, curr)-1) %
this.policyVersionList.length];
+ this.getPolicyByVersion(previousVal, e);
}
},
@@ -296,7 +298,7 @@ define(function(require) {
}else{
prevEl.removeClass('active');
}
- var policyVerIndexAt =
this.policyVersionList.indexOf(this.policy.get('version').toString());
+ var policyVerIndexAt =
this.policyVersionList.indexOf(this.policy.get('version'));
if(!_.isUndefined(this.policyVersionList[++policyVerIndexAt])){
nextEl.addClass('active');
reverEl.css('display','');
diff --git
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
index 31fc7c1..1209c6d 100644
---
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -211,7 +211,7 @@ define(function(require){
policyVerEl.append('<i id="preVer"
class="icon-chevron-left ' + ((rangerPolicy.get('version') > 1) ? 'active' :
'') + '"></i><text>Version ' + rangerPolicy.get('version') +
'</text>').find('#preVer').click(function(e) {
view.previousVer(e);
});
- var policyVerIndexAt =
policyVersionList.indexOf(rangerPolicy.get('version').toString());
+ var policyVerIndexAt =
policyVersionList.indexOf(rangerPolicy.get('version'));
policyVerEl.append('<i id="nextVer"
class="icon-chevron-right ' +
(!_.isUndefined(policyVersionList[++policyVerIndexAt]) ? 'active' : '') +
'"></i>').find('#nextVer').click(function(e) {
view.nextVer(e);
});
diff --git
a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
index 6a1c7c2..b0cb508 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -1088,7 +1088,7 @@ define(function(require) {
policyVerEl.append('<i id="preVer"
class="icon-chevron-left '+ ((policy.get('version')>1) ? 'active' : '')
+'"></i><text>Version '+ policy.get('version')
+'</text>').find('#preVer').click(function(e){
view.previousVer(e);
});
- var policyVerIndexAt =
policyVersionList.indexOf(policy.get('version').toString());
+ var policyVerIndexAt =
policyVersionList.indexOf(policy.get('version'));
policyVerEl.append('<i id="nextVer"
class="icon-chevron-right '+
(!_.isUndefined(policyVersionList[++policyVerIndexAt])? 'active' :
'')+'"></i>').find('#nextVer').click(function(e){
view.nextVer(e);
});