Repository: ranger
Updated Branches:
  refs/heads/master 58aa1bc29 -> 35a33288d


RANGER-2067:Supply the function of viewing policy history version.

Signed-off-by: peng.jianhua <peng.jian...@zte.com.cn>


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

Branch: refs/heads/master
Commit: 35a33288d566cc8b5ffd6218dd0e7ed13598cc70
Parents: 58aa1bc
Author: zhangqiang2 <zhangqia...@zte.com.cn>
Authored: Mon Apr 16 09:44:22 2018 +0800
Committer: peng.jianhua <peng.jian...@zte.com.cn>
Committed: Mon Apr 16 09:53:22 2018 +0800

----------------------------------------------------------------------
 .../scripts/views/policies/RangerPolicyTableLayout.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/35a33288/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
----------------------------------------------------------------------
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 25e1a8d..2e925a9 100644
--- 
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ 
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -180,9 +180,11 @@ define(function(require){
                        rangerPolicy.fetch({
                                cache : false,
                        }).done(function(){
-                                var view = new RangerPolicyRO({
+                               var policyVersionList = 
rangerPolicy.fetchVersions();
+                               var view = new RangerPolicyRO({
                                        model : rangerPolicy,
-                                        rangerService: 
that.rangerServiceDefModel
+                                       policyVersionList : policyVersionList,
+                                       rangerService: 
that.rangerServiceDefModel
                                });
                                var modal = new Backbone.BootstrapModal({
                                        animate : true,
@@ -192,6 +194,14 @@ define(function(require){
                                        allowCancel : true,
                                        escape  : true
                                }).open();
+                               var policyVerEl = 
modal.$el.find('.modal-footer').prepend('<div class="policyVer 
pull-left"></div>').find('.policyVer');
+                               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());
+                               policyVerEl.append('<i id="nextVer" 
class="icon-chevron-right ' + 
(!_.isUndefined(policyVersionList[++policyVerIndexAt]) ? 'active' : '') + 
'"></i>').find('#nextVer').click(function(e) {
+                                       view.nextVer(e);
+                               });
                                modal.$el.find('.cancel').hide();
                        });
                },

Reply via email to