You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ga...@apache.org on 2016/12/21 13:32:35 UTC

incubator-ranger git commit: RANGER-1230 : Policy versions in use for each Ranger plugin - Part 2

Repository: incubator-ranger
Updated Branches:
  refs/heads/master 510697aef -> 263bf4353


RANGER-1230 : Policy versions in use for each Ranger plugin - Part 2


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

Branch: refs/heads/master
Commit: 263bf4353e6aceceac5d2e522e90eb09392514f1
Parents: 510697a
Author: Gautam Borad <ga...@apache.org>
Authored: Mon Dec 19 18:16:22 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Wed Dec 21 19:00:40 2016 +0530

----------------------------------------------------------------------
 .../scripts/modules/globalize/message/en.js     |   3 +
 .../scripts/views/policies/PermissionList.js    |   5 +-
 .../webapp/scripts/views/reports/AuditLayout.js | 101 ++++++++++++++-----
 security-admin/src/main/webapp/styles/xa.css    |  16 ++-
 4 files changed, 92 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/263bf435/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
index 866844c..37821fe 100644
--- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
+++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
@@ -240,6 +240,9 @@ define(function(require) {
                 hostName						: 'Host Name',
                 selectAndAddUser                : 'Select and Add User',
                 selectAndAddGroup               : 'Select and Add Group',
+                download                        : 'Download',
+                lastUpdate                      : 'Last Update',
+
 			},
 			btn : {
 				add							: 'Add',

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/263bf435/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
index 80ff1f3..8a7faec 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
@@ -472,10 +472,11 @@ define(function(require) {
 									val = 	pcond['evaluatorOptions']['engineName'] + ' Condition'
 								}
 								i++;
-								return '<span class="'+label+' white-space-normal" >'+name+' : '+ val + '</span>';
+                                                                return '<span class="'+label+' white-space-normal" >'+name+' : '+ _.escape(val) + '</span>';
 							});
 							var cond = _.map(value, function(val, name) {
-								return {'type' : name, 'values' : !_.isArray(val) ?  val.split(', ') : val};
+                                                                val = _.escape(val);
+                                                                return {'type' : name, 'values' : !_.isArray(val) ?  val.split(',') : val};
 							});
 							
 							that.model.set('conditions', cond);

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/263bf435/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
----------------------------------------------------------------------
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 1e1f0f7..0cfbf77 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -186,10 +186,8 @@ define(function(require) {
 					<th class="renderable ruser"></th>\
 					<th class="renderable ruser"></th>\
 					<th class="renderable ruser"></th>\
-					<th class="renderable cip">Policy Active</th>\
-					<th class="renderable name">Policy Download</th>\
-					<th class="renderable cip">Tag Active</th>\
-					<th class="renderable cip">Tag Download</th>\
+                                        <th class="renderable cip" colspan="3">Policy ( Time )</th>\
+                                        <th class="renderable cip" colspan="3">Tag ( Time )</th>\
 			 	</tr>');
 		},
 		renderDateFields : function(){
@@ -273,7 +271,7 @@ define(function(require) {
 					 this.currentTab = '#pluginStatus';
 					 this.ui.visualSearch.show();
 					 this.pluginInfoList = new VXPolicyExportAuditList();
-					 this.renderPluginInfotable();
+                                         this.renderPluginInfoTable();
 					 this.modifyPluginStatusTableSubcolumns();
 					 //To use existing collection
 					 this.pluginInfoList.url = 'service/plugins/plugins/info';
@@ -1164,7 +1162,7 @@ define(function(require) {
 			};
 			return this.policyExportAuditList.constructor.getTableCols(cols, this.policyExportAuditList);
 		},
-		renderPluginInfotable : function(){
+                renderPluginInfoTable : function(){
 			this.ui.tableList.removeClass("clickable");
 			this.rTableList.show(new XATableLayout({
 				columns: this.getPluginInfoColums(),
@@ -1211,16 +1209,24 @@ define(function(require) {
 				},
 				policyActive: {
 					cell 	: 'html',
-					label	: localization.tt("lbl.versionTime"),
+                                        label	: localization.tt("lbl.active"),
 					editable:false,
 					sortable:false,
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
-							if(_.isUndefined(model.get('info').policyActiveVersion)
-									|| _.isNull(model.get('info').policyActiveVersion)){
+                                                        if(_.isUndefined(model.get('info').policyActivationTime)
+                                                                        || _.isNull(model.get('info').policyActivationTime)){
 								return '<center>--</center>';
-							}	
-							return that.getPluginInfoCell(model,'policyActiveVersion','policyActivationTime','label-success');
+                                                        }
+                                                        var activeDate = new Date(parseInt(model.get('info')['policyActivationTime']));
+                                                        if(!_.isUndefined(model.get('info')['lastPolicyUpdateTime'])){
+                                                                var lastUpdateDate = new Date(parseInt(model.get('info')['lastPolicyUpdateTime']));
+                                                                if(that.isDateDifferenceMoreThanHr(activeDate, lastUpdateDate)){
+                                                                        return '<i class="icon-exclamation-sign activePolicyAlert"></i>'
+                                                                        + Globalize.format(activeDate,  "MM/dd/yyyy hh:mm:ss tt");
+                                                                }
+                                                        }
+                                                        return Globalize.format(activeDate,  "MM/dd/yyyy hh:mm:ss tt");
 							       
 						}
 					})
@@ -1228,48 +1234,88 @@ define(function(require) {
 									
 				policyDownloaded : {
 					cell 	: 'html',
-					label	: localization.tt("lbl.versionTime"),
+                                        label	: localization.tt("lbl.download"),
 					editable:false,
 					sortable:false,
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
-							if(_.isUndefined(model.get('info').policyDownloadedVersion)
-									|| _.isNull(model.get('info').policyDownloadedVersion)){
+                                                        if(_.isUndefined(model.get('info').policyDownloadTime)
+                                                                        || _.isNull(model.get('info').policyDownloadTime)){
 								return '<center>--</center>';
 							}
-							return that.getPluginInfoCell(model,'policyDownloadedVersion','policyDownloadTime','label-inverse');
+                                                        return Globalize.format(new Date(parseInt(model.get('info')['policyDownloadTime'])),  "MM/dd/yyyy hh:mm:ss tt")
+                                                }
+                                        })
+                                },
+                                lastPolicyUpdateTime : {
+                                        cell 	: 'html',
+                                        label	: localization.tt("lbl.lastUpdate"),
+                                        editable:false,
+                                        sortable:false,
+                                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                                                fromRaw: function (rawValue, model) {
+                                                        if(_.isUndefined(model.get('info').lastPolicyUpdateTime)
+                                                                        || _.isNull(model.get('info').lastPolicyUpdateTime)){
+                                                                return '<center>--</center>';
+                                                        }
+                                                        return Globalize.format(new Date(parseInt(model.get('info')['lastPolicyUpdateTime'])),  "MM/dd/yyyy hh:mm:ss tt")
+
 						}
 					})
 				},
-				
 				tagActive : {
 					cell 	: 'html',
-					label	: localization.tt("lbl.versionTime"),
+                                        label	: localization.tt("lbl.active"),
 					editable:false,
 					sortable:false,
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
-							if(_.isUndefined(model.get('info').tagActiveVersion)
-									|| _.isNull(model.get('info').tagActiveVersion)){
+                                                        if(_.isUndefined(model.get('info').tagActivationTime)
+                                                                        || _.isNull(model.get('info').tagActivationTime)){
 								return '<center>--</center>';
 							}
-							return that.getPluginInfoCell(model,'tagActiveVersion','tagActivationTime','label-success');
+                                                        var activeDate = new Date(parseInt(model.get('info')['tagActivationTime']));
+                                                        if(!_.isUndefined(model.get('info')['lastTagUpdateTime'])){
+                                                                var lastUpdateDate = new Date(parseInt(model.get('info')['lastTagUpdateTime']));
+                                                                if(that.isDateDifferenceMoreThanHr(activeDate, lastUpdateDate)){
+                                                                        return '<i class="icon-exclamation-sign activePolicyAlert"></i>'
+                                                                        + Globalize.format(activeDate,  "MM/dd/yyyy hh:mm:ss tt");
+                                                                }
+                                                        }
+                                                        return Globalize.format(activeDate,  "MM/dd/yyyy hh:mm:ss tt");
 						}
 					})
 				}, 
 				
 				tagDownloaded : {
 					cell 	: 'html',
-					label	:localization.tt("lbl.versionTime"),
+                                        label	:localization.tt("lbl.download"),
+                                        editable:false,
+                                        sortable:false,
+                                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                                                fromRaw: function (rawValue, model) {
+                                                        if(_.isUndefined(model.get('info').tagDownloadTime)
+                                                                        || _.isNull(model.get('info').tagDownloadTime)){
+                                                                return '<center>--</center>';
+                                                        }
+                                                        return Globalize.format(new Date(parseInt(model.get('info')['tagDownloadTime'])),  "MM/dd/yyyy hh:mm:ss tt")
+
+                                                }
+                                        })
+                                },
+                                lastTagUpdateTime : {
+                                        cell 	: 'html',
+                                        label	:localization.tt("lbl.lastUpdate"),
 					editable:false,
 					sortable:false,
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
-							if(_.isUndefined(model.get('info').tagDownloadedVersion)
-									|| _.isNull(model.get('info').tagDownloadedVersion)){
+                                                        if(_.isUndefined(model.get('info').lastTagUpdateTime)
+                                                                        || _.isNull(model.get('info').lastTagUpdateTime)){
 								return '<center>--</center>';
 							}
-							return that.getPluginInfoCell(model,'tagDownloadedVersion','tagDownloadTime','label-inverse');
+                                                        return Globalize.format(new Date(parseInt(model.get('info')['lastTagUpdateTime'])),  "MM/dd/yyyy hh:mm:ss tt")
+
 						}
 					})
 				},
@@ -1277,10 +1323,9 @@ define(function(require) {
 			return this.pluginInfoList.constructor.getTableCols(cols, this.pluginInfoList);
 	
 		},
-		getPluginInfoCell : function(model, versionAttr, timeAttr, klass){
-			return '<center><div><label class="label '+klass+'">'+model.get('info')[versionAttr]+
-			'</label></div>\  <div " style="border-top: 1px solid #ddd;">'
-			+Globalize.format(new Date(parseInt(model.get('info')[timeAttr])),  "MM/dd/yyyy hh:mm:ss tt")+'</div></center>'
+                isDateDifferenceMoreThanHr : function(date1, date2){
+                        var diff = Math.abs(date1 - date2) / 36e5;
+                        return parseInt(diff) >= 1 ? true : false;
 		},
 		onRefresh : function(){
 			var that =this, coll,params = {};

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/263bf435/security-admin/src/main/webapp/styles/xa.css
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index 154b588..2b533e2 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -1581,7 +1581,7 @@ background-color: #dc6343;
   display: inline-block;
   margin-right: 3px;
 }
-table.table.backgrid thead th.repoName, .policyActive, .policyDownloaded, .tagActive, .tagDownloaded { 
+table.table.backgrid thead th.repoName, .policyActive, .policyDownloaded, .lastPolicyUpdateTime, .tagActive, .tagDownloaded, .lastTagUpdateTime {
  border-top: 1px solid #ddd !important;
 }
 table.table.backgrid thead th.resourceType {
@@ -2057,7 +2057,8 @@ td.subgrid-custom-cell{
 }
 .padding-right-10{
         padding-right: 10px;
-}.selected-widget {
+}
+.selected-widget {
     padding: 3px 5px 3px 4px;
     border-radius: 3px;
     border: 1px solid #aaaaaa;
@@ -2070,11 +2071,20 @@ td.subgrid-custom-cell{
     max-height: 270px;
     overflow: auto;
 }
-
 .inline {
     display: inline;
 }
 .vertAlignInitial{
         vertical-align: initial !important;
         text-align: left;
+}
+.activePolicyAlert {
+    color: #ec7337;
+    margin-right: 5px;
+}
+.padding-right-10{
+    padding-right: 10px;
+}
+.selected-widget .remove{
+    cursor:pointer;
 }
\ No newline at end of file