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 2017/04/27 17:22:36 UTC
ranger git commit: RANGER-1471 : Remember filters on all tabs of
Ranger Audits page
Repository: ranger
Updated Branches:
refs/heads/master faf5bf177 -> c77848761
RANGER-1471 : Remember filters on all tabs of Ranger Audits page
Signed-off-by: Gautam Borad <ga...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/c7784876
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/c7784876
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/c7784876
Branch: refs/heads/master
Commit: c7784876173bc9eafd1c47def7f45bad3b5010ac
Parents: faf5bf1
Author: Bhavik Patel <bh...@gmail.com>
Authored: Wed Apr 26 10:02:56 2017 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Thu Apr 27 22:52:03 2017 +0530
----------------------------------------------------------------------
.../org/apache/ranger/common/SearchUtil.java | 2 +-
.../java/org/apache/ranger/rest/AssetREST.java | 14 +-
.../java/org/apache/ranger/rest/XUserREST.java | 7 +-
.../java/org/apache/ranger/solr/SolrUtil.java | 4 +-
.../scripts/modules/globalize/message/en.js | 5 +-
.../src/main/webapp/scripts/utils/XAUtils.js | 35 +--
.../webapp/scripts/views/reports/AuditLayout.js | 249 ++++++++++---------
.../scripts/views/reports/LoginSessionDetail.js | 9 +-
security-admin/src/main/webapp/styles/xa.css | 7 +
.../common/ServiceManagerLayout_tmpl.html | 6 +-
.../templates/reports/AuditLayout_tmpl.html | 2 +-
.../reports/LoginSessionDetail_tmpl.html | 2 +-
.../org/apache/ranger/rest/TestXUserREST.java | 8 +-
13 files changed, 191 insertions(+), 159 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/java/org/apache/ranger/common/SearchUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/common/SearchUtil.java b/security-admin/src/main/java/org/apache/ranger/common/SearchUtil.java
index fe253ef..ad30733 100644
--- a/security-admin/src/main/java/org/apache/ranger/common/SearchUtil.java
+++ b/security-admin/src/main/java/org/apache/ranger/common/SearchUtil.java
@@ -224,7 +224,7 @@ public class SearchUtil {
dateFormat = defaultDateFormat;
}
value = restErrorUtil.parseDate(request.getParameter(paramName),
- "Invalid value for" + userFriendlyParamName,
+ "Invalid value for " + userFriendlyParamName,
MessageEnums.INVALID_INPUT_DATA, null, paramName, dateFormat);
if (value != null) {
searchCriteria.getParamList().put(paramName, value);
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java b/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java
index ed34525..54226d9 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/AssetREST.java
@@ -579,9 +579,9 @@ public class AssetREST {
searchUtil.extractInt(request, searchCriteria, "httpRetCode",
"HTTP response code for exported policy.");
searchUtil.extractDate(request, searchCriteria, "startDate",
- "Start date for search", null);
+ "Start Date", null);
searchUtil.extractDate(request, searchCriteria, "endDate",
- "End date for search", null);
+ "End Date", null);
searchUtil.extractString(request, searchCriteria, "cluster",
"Cluster Name", StringUtil.VALIDATION_TEXT);
return assetMgr.searchXPolicyExportAudits(searchCriteria);
@@ -595,7 +595,7 @@ public class AssetREST {
SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(
request, xTrxLogService.sortFields);
- searchUtil.extractInt(request, searchCriteria, "objectClassType", "Class type for report.");
+ searchUtil.extractInt(request, searchCriteria, "objectClassType", "audit type.");
searchUtil.extractString(request, searchCriteria, "attributeName",
"Attribute Name", StringUtil.VALIDATION_TEXT);
searchUtil.extractString(request, searchCriteria, "action",
@@ -647,14 +647,14 @@ public class AssetREST {
"Resource Type", StringUtil.VALIDATION_TEXT);
searchUtil.extractInt(request, searchCriteria, "auditType", "Audit Type");
- searchUtil.extractInt(request, searchCriteria, "accessResult", "Audit Type");
+ searchUtil.extractInt(request, searchCriteria, "accessResult", "Result");
searchUtil.extractInt(request, searchCriteria, "assetId", "Audit Type");
searchUtil.extractLong(request, searchCriteria, "policyId", "Audit Type");
- searchUtil.extractInt(request, searchCriteria, "repoType", "Audit Type");
+ searchUtil.extractInt(request, searchCriteria, "repoType", "Service Type");
searchUtil.extractDate(request, searchCriteria, "startDate",
- "startDate", "MM/dd/yyyy");
- searchUtil.extractDate(request, searchCriteria, "endDate", "endDate",
+ "Start Date", "MM/dd/yyyy");
+ searchUtil.extractDate(request, searchCriteria, "endDate", "End Date",
"MM/dd/yyyy");
searchUtil.extractString(request, searchCriteria, "tags", "tags", null);
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java b/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
index 0776021..6e9161e 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
@@ -239,6 +239,7 @@ public class XUserREST {
searchUtil.extractString(request, searchCriteria, "name", "group name", null);
searchUtil.extractInt(request, searchCriteria, "isVisible", "Group Visibility");
searchUtil.extractString(request, searchCriteria, "groupSource", "group source", null);
+// searchUtil.extractInt(request, searchCriteria, "groupSource", "group source");
return xUserMgr.searchXGroups(searchCriteria);
}
@@ -761,15 +762,15 @@ public class XUserREST {
searchUtil.extractLong(request, searchCriteria, "id", "Auth Session Id");
searchUtil.extractLong(request, searchCriteria, "userId", "User Id");
searchUtil.extractInt(request, searchCriteria, "authStatus", "Auth Status");
- searchUtil.extractInt(request, searchCriteria, "authType", "Auth Type");
+ searchUtil.extractInt(request, searchCriteria, "authType", "Login Type");
searchUtil.extractInt(request, searchCriteria, "deviceType", "Device Type");
searchUtil.extractString(request, searchCriteria, "firstName", "User First Name", StringUtil.VALIDATION_NAME);
searchUtil.extractString(request, searchCriteria, "lastName", "User Last Name", StringUtil.VALIDATION_NAME);
searchUtil.extractString(request, searchCriteria, "requestUserAgent", "User Agent", StringUtil.VALIDATION_TEXT);
searchUtil.extractString(request, searchCriteria, "requestIP", "Request IP Address", StringUtil.VALIDATION_IP_ADDRESS);
searchUtil.extractString(request, searchCriteria, "loginId", "Login ID", StringUtil.VALIDATION_TEXT);
- searchUtil.extractDate(request, searchCriteria, "startDate", "Start date for search", null);
- searchUtil.extractDate(request, searchCriteria, "endDate", "End date for search", null);
+ searchUtil.extractDate(request, searchCriteria, "startDate", "Start Date", null);
+ searchUtil.extractDate(request, searchCriteria, "endDate", "End Date", null);
return sessionMgr.searchAuthSessions(searchCriteria);
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java b/security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java
index 0a30cf6..fbb50ae 100644
--- a/security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java
+++ b/security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java
@@ -156,9 +156,9 @@ public class SolrUtil {
QueryResponse response = runQuery(solrClient, query);
if (response == null || response.getStatus() != 0) {
- logger.error("Error running solr query. query=" + query
+ logger.error("Unable to connect to Audit store!! Error running query. query=" + query
+ ", response=" + response);
- throw restErrorUtil.createRESTException("Error running solr query",
+ throw restErrorUtil.createRESTException("Unable to connect to Audit store !!",
MessageEnums.ERROR_SYSTEM);
}
return response;
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/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 4a153bf..49d0323 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
@@ -329,7 +329,7 @@ define(function(require) {
type :'Policy for all type.',
udf :'Hive udf.',
pluginStatus :'Plugin Status',
- clusterName :'Name of ambari cluster'
+ clusterName :'Name of ambari cluster'
},
msg : {
deletePolicyValidationMsg : 'Policy does not have any settings for the specific resource. Policy will be deleted. Press [Ok] to continue. Press [Cancel] to edit the policy.',
@@ -364,7 +364,7 @@ define(function(require) {
userUpdatedSucc : 'User updated successfully',
grpUpdatedSucc : 'Group updated successfully',
grpCreatedSucc : 'Group created successfully',
- errorLoadingAuditLogs : 'Unable to connect to Audit store !!',
+ errorLoadingAuditLogs : 'Error loading audit logs!!',
enterCustomMask : 'Please enter custom masked value or expression !!',
policyNameMsg :'Enter name of policy.',
policyTypeMsg :'Select Type of policy eg. access, masking, row level filter policies.' ,
@@ -394,6 +394,7 @@ define(function(require) {
noDeleteGroupRow :'Please select group first to delete.',
plsSelectUserToSetVisibility :' Please select user to set visibility or selected user is already visible/hidden.',
plsSelectGroupToSetVisibility:' Please select group to set visibility or selected group is already visible/hidden.',
+ activationTimeDelayMsg :'Policy activation time delayed by more than 1hr from last update time.',
},
plcHldr : {
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index 480c515..49d3741 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -778,14 +778,12 @@ define(function(require) {
cache : false,
error : function(coll, response, options) {
that.blockUI('unblock');
- var errorMsg;
- if(!_.isUndefined(response) && !_.isUndefined(response.responseJSON) && !_.isUndefined(response.responseJSON.msgDesc)){
- errorMsg = response.responseJSON.msgDesc;
+ if(response && response.responseJSON && response.responseJSON.msgDesc){
+ that.notifyError('Error', response.responseJSON.msgDesc);
+ }else{
+ that.notifyError('Error', localization.tt('msg.errorLoadingAuditLogs'));
}
- else {
- errorMsg = localization.tt('msg.errorLoadingAuditLogs');
- }
- that.notifyError('Error', errorMsg);
+
}
});
};
@@ -796,6 +794,11 @@ define(function(require) {
search(searchCollection, serverAttrName, searchOpt, collection);
},
clearSearch : function(callback) {
+ //Remove search history when click on clear search
+ if(!_.isUndefined(pluginAttr.type)){
+ var App = require('App');
+ App.vsHistory[pluginAttr.type] = [];
+ }
_.each(serverAttrName, function(attr) {
delete collection.queryParams[attr.label];
});
@@ -825,10 +828,6 @@ define(function(require) {
if (!_.isUndefined(removedFacetSeverName)) {
delete collection.queryParams[removedFacetSeverName.label];
collection.state.currentPage = collection.state.firstPage;
- collection.fetch({
- reset : true,
- cache : false
- });
}
// TODO Added for Demo to remove datapicker popups
if (!_.isUndefined(visualSearch.searchBox.$el))
@@ -851,12 +850,15 @@ define(function(require) {
};
XAUtils.displayDatepicker = function($el, facet, $date, callback) {
- var input = $el
- .find('.search_facet.is_editing input.search_facet_input');
+ var input = $el.find('.search_facet.is_editing input.search_facet_input');
+ //disabling user enter value in date
+ input.keypress(function(event) {
+ event.preventDefault();
+ });
$el.parents('body').find('.datepicker').hide();
input.datepicker({
autoclose : true,
- dateFormat : 'yy-mm-dd'
+ dateFormat : 'yy-mm-dd',
}).on('changeDate', function(ev) {
callback(ev.date);
input.datepicker("hide");
@@ -1279,5 +1281,10 @@ define(function(require) {
return !_.isUndefined(obj['resources']) && !_.isEmpty(obj['resources'])
&& !_.isNull(obj['resources']) ? false : true;
};
+ XAUtils.removeEmptySearchValue = function(arr) {
+ return _.reject(arr,function(m){
+ return (m.get('value')=="");
+ });
+ };
return XAUtils;
});
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/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 1277334..b98e2cc 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -111,19 +111,17 @@ define(function(require) {
var date = new Date().toString();
this.timezone = date.replace(/^.*GMT.*\(/, "").replace(/\)$/, "");
this.initializeServiceDefColl();
+ if(_.isUndefined(App.vsHistory)){
+ var startDateModel = new Backbone.Model({'category':'Start Date', value:Globalize.format(new Date(),"MM/dd/yyyy")});
+ App.vsHistory = {'bigData':[startDateModel], 'admin':[], 'loginSession':[], 'plugin':[],'pluginStatus':[]};
+ }
},
/** all events binding here */
bindEvents : function() {
- /*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/
//this.listenTo(this.collection, "change:foo", this.render, this);
},
- initializeCollection : function(){
- this.collection.fetch({
- reset : true,
- cache : false
- });
- },
+
initializeServiceDefColl : function() {
this.serviceDefList = new RangerServiceDefList();
this.serviceDefList.fetch({
@@ -135,7 +133,6 @@ define(function(require) {
},
/** on render callback */
onRender : function() {
- this.initializePlugins();
if(this.currentTab != '#bigData'){
this.onTabChange();
this.ui.tab.find('li[class="active"]').removeClass();
@@ -145,26 +142,7 @@ define(function(require) {
this.addSearchForBigDataTab();
this.modifyTableForSubcolumns();
}
- this.addSearchForBigDataTab();
- XAUtils.searchInfoPopover(this.searchInfoArr , this.ui.iconSearchInfo , 'bottom');
- },
- displayDatepicker : function ($el, callback) {
- var input = $el.find('.search_facet.is_editing input.search_facet_input');
-
- input.datepicker({
- autoclose : true,
- dateFormat: 'yy-mm-dd'
- }).on('changeDate', function(ev){
- callback(ev.date);
- input.datepicker("hide");
- var e = jQuery.Event("keydown");
- e.which = 13; // Enter
- $(this).trigger(e);
- }).on('hide',function(){
- input.datepicker("destroy");
- });
- input.datepicker('show');
},
modifyTableForSubcolumns : function(){
this.$el.find('[data-id="r_tableList"] table thead').prepend('<tr>\
@@ -188,29 +166,11 @@ define(function(require) {
<th class="renderable ruser"></th>\
<th class="renderable ruser"></th>\
<th class="renderable ruser"></th>\
- <th class="renderable cip" colspan="3">Policy ( Time )</th>\
- <th class="renderable cip" colspan="3">Tag ( Time )</th>\
+ <th class="renderable cip" colspan="3">Policy ( Time )</th>\
+ <th class="renderable cip" colspan="3">Tag ( Time )</th>\
</tr>');
},
- renderDateFields : function(){
- var that = this;
- this.ui.startDate.datepicker({
- autoclose : true
- }).on('changeDate', function(ev) {
- that.ui.endDate.datepicker('setStartDate', ev.date);
- }).on('keydown',function(){
- return false;
- });
-
- this.ui.endDate.datepicker({
- autoclose : true
- }).on('changeDate', function(ev) {
- that.ui.startDate.datepicker('setEndDate', ev.date);
- }).on('keydown',function(){
- return false;
- });
- },
onTabChange : function(e){
var that = this, tab;
tab = !_.isUndefined(e) ? $(e.currentTarget).attr('href') : this.currentTab;
@@ -218,6 +178,8 @@ define(function(require) {
switch (tab) {
case "#bigData":
this.currentTab = '#bigData';
+ //Remove empty search values on tab changes for visual search.
+ App.vsHistory.bigData = XAUtils.removeEmptySearchValue(App.vsHistory.bigData);
this.ui.visualSearch.show();
this.ui.visualSearch.parents('.well').show();
this.renderBigDataTable();
@@ -228,49 +190,57 @@ define(function(require) {
break;
case "#admin":
this.currentTab = '#admin';
+ App.vsHistory.admin = XAUtils.removeEmptySearchValue(App.vsHistory.admin);
this.trxLogList = new VXTrxLogList();
this.renderAdminTable();
- if(_.isUndefined(App.sessionId)){
+ if(_.isEmpty(App.vsHistory.admin) && _.isUndefined(App.sessionId)){
this.trxLogList.fetch({
cache : false
});
}
this.addSearchForAdminTab();
this.listenTo(this.trxLogList, "request", that.updateLastRefresh)
- this.ui.iconSearchInfo.hide();
- $('.popover').remove();
+ this.ui.iconSearchInfo.hide();
+ $('.popover').remove();
break;
case "#loginSession":
this.currentTab = '#loginSession';
+ App.vsHistory.loginSession = XAUtils.removeEmptySearchValue(App.vsHistory.loginSession);
this.authSessionList = new VXAuthSession();
this.renderLoginSessionTable();
//Setting SortBy as id and sortType as desc = 1
this.authSessionList.setSorting('id',1);
- this.authSessionList.fetch({
- cache:false,
- });
+ if(_.isEmpty(App.vsHistory.loginSession)){
+ this.authSessionList.fetch({
+ cache:false,
+ });
+ }
this.addSearchForLoginSessionTab();
this.listenTo(this.authSessionList, "request", that.updateLastRefresh)
- this.ui.iconSearchInfo.hide();
- $('.popover').remove();
+ this.ui.iconSearchInfo.hide();
+ $('.popover').remove();
break;
case "#agent":
this.currentTab = '#agent';
+ App.vsHistory.plugin = XAUtils.removeEmptySearchValue(App.vsHistory.plugin);
this.policyExportAuditList = new VXPolicyExportAuditList();
var params = { priAcctId : 1 };
that.renderAgentTable();
this.policyExportAuditList.setSorting('createDate',1);
- this.policyExportAuditList.fetch({
- cache : false,
- data :params
- });
+ if(_.isEmpty(App.vsHistory.plugin)){
+ this.policyExportAuditList.fetch({
+ cache : false,
+ data :params
+ });
+ }
this.addSearchForAgentTab();
this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh)
- this.ui.iconSearchInfo.hide();
- $('.popover').remove();
+ this.ui.iconSearchInfo.hide();
+ $('.popover').remove();
break;
case "#pluginStatus":
this.currentTab = '#pluginStatus';
+ App.vsHistory.pluginStatus = XAUtils.removeEmptySearchValue(App.vsHistory.pluginStatus);
this.ui.visualSearch.show();
this.pluginInfoList = new VXPolicyExportAuditList();
this.renderPluginInfoTable();
@@ -278,17 +248,19 @@ define(function(require) {
//To use existing collection
this.pluginInfoList.url = 'service/plugins/plugins/info';
this.pluginInfoList.modelAttrName = 'pluginInfoList';
- this.pluginInfoList.fetch({cache : false});
+ if(_.isEmpty(App.vsHistory.pluginStatus)){
+ this.pluginInfoList.fetch({cache : false});
+ }
this.addSearchForPluginStatusTab();
this.ui.iconSearchInfo.hide();
- $('.popover').remove();
+ $('.popover').remove();
break;
}
var lastUpdateTime = Globalize.format(new Date(), "MM/dd/yyyy hh:mm:ss tt");
that.ui.lastUpdateTimeLabel.html(lastUpdateTime);
},
addSearchForBigDataTab :function(){
- var that = this;
+ var that = this , query = '';
var serverListForRepoType = this.serviceDefList.map(function(serviceDef){ return {'label' : serviceDef.get('name').toUpperCase(), 'value' : serviceDef.get('id')}; })
var serverAttrName = [{text : 'Start Date',label :'startDate'},{text : 'End Date',label :'endDate'},
{text : 'User',label :'requestUser'},{text : 'Resource Name',label :'resourcePath'},
@@ -299,26 +271,34 @@ define(function(require) {
{text : 'Client IP',label :'clientIP'},{text : 'Tags',label :'tags'},
{text : 'Resource Type',label : 'resourceType'},{text : 'Cluster Name',label : 'cluster'}];
var searchOpt = ['Resource Type','Start Date','End Date','User','Service Name','Service Type','Resource Name','Access Type','Result','Access Enforcer','Client IP','Tags','Cluster Name'];//,'Policy ID'
- this.clearVisualSearch(this.accessAuditList, serverAttrName);
- this.searchInfoArr =[{text :'Access Enforcer', info :localization.tt('msg.accessEnforcer')},
- {text :'Access Type' , info :localization.tt('msg.accessTypeMsg')},
- {text :'Client IP' , info :localization.tt('msg.clientIP')},
- {text : 'Cluster Name' , info :localization.tt('h.clusterName')},
- {text :'End Date' , info :localization.tt('h.endDate')},
- {text :'Resource Name' , info :localization.tt('msg.resourceName')},
- {text :'Resource Type' , info :localization.tt('msg.resourceTypeMsg')},
- {text :'Result' , info :localization.tt('msg.resultMsg')},
- {text :'Service Name' , info :localization.tt('h.serviceNameMsg')},
- {text :'Service Type' , info :localization.tt('h.serviceTypeMsg')},
- {text :'Start Date' , info :localization.tt('h.startDate')},
- {text :'User' , info :localization.tt('h.userMsg')},
- {text :'Tags' , info :localization.tt('h.tagsMsg')} ];
-
- var query = '"Start Date": "'+Globalize.format(new Date(),"MM/dd/yyyy")+'"';
+ this.clearVisualSearch(this.accessAuditList, serverAttrName);
+ this.searchInfoArr =[{text :'Access Enforcer', info :localization.tt('msg.accessEnforcer')},
+ {text :'Access Type' , info :localization.tt('msg.accessTypeMsg')},
+ {text :'Client IP' , info :localization.tt('msg.clientIP')},
+ {text : 'Cluster Name' , info :localization.tt('h.clusterName')},
+ {text :'End Date' , info :localization.tt('h.endDate')},
+ {text :'Resource Name' , info :localization.tt('msg.resourceName')},
+ {text :'Resource Type' , info :localization.tt('msg.resourceTypeMsg')},
+ {text :'Result' , info :localization.tt('msg.resultMsg')},
+ {text :'Service Name' , info :localization.tt('h.serviceNameMsg')},
+ {text :'Service Type' , info :localization.tt('h.serviceTypeMsg')},
+ {text :'Start Date' , info :localization.tt('h.startDate')},
+ {text :'User' , info :localization.tt('h.userMsg')},
+ {text :'Tags' , info :localization.tt('h.tagsMsg')} ];
+ //initilize info popover
+ XAUtils.searchInfoPopover(this.searchInfoArr , this.ui.iconSearchInfo , 'bottom');
+ //Set query(search filter values in query)
+ if(_.isEmpty(App.vsHistory.bigData)){
+ query = '"Start Date": "'+Globalize.format(new Date(),"MM/dd/yyyy")+'"';
+ App.vsHistory.bigData.push(new Backbone.Model({'category':'Start Date', value:Globalize.format(new Date(),"MM/dd/yyyy")}));
+ }else{
+ _.map(App.vsHistory.bigData, function(a){ query += '"'+a.get('category')+'":"'+a.get('value')+'"'; });
+ }
var pluginAttr = {
placeholder :localization.tt('h.searchForYourAccessAudit'),
container : this.ui.visualSearch,
query : query,
+ type : 'bigData',
callbacks : {
valueMatches : function(facet, searchTerm, callback) {
var auditList = [];
@@ -363,15 +343,12 @@ define(function(require) {
}
XAUtils.displayDatepicker(that.ui.visualSearch, facet, startDate, callback);
break;
- case 'Today' :
- var today = Globalize.format(new Date(),"yyyy/mm/dd");
- callback([today]);
- break;
- }
+ }
}
}
};
this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.accessAuditList, pluginAttr);
+ this.setEventsToFacets(this.visualSearch, App.vsHistory.bigData);
},
addSearchForAdminTab : function(){
var that = this;
@@ -392,13 +369,18 @@ define(function(require) {
auditList.push({label :obj.label, value :obj.label+''});
});
if(!_.isUndefined(App.sessionId)){
+ App.vsHistory.admin = [] ;
query = '"Session Id": "'+App.sessionId+'"';
+ App.vsHistory.admin.push(new Backbone.Model({'category':'Session Id', value:App.sessionId}));
delete App.sessionId;
+ }else{
+ _.map(App.vsHistory.admin, function(a){ query += '"'+a.get('category')+'":"'+a.get('value')+'"'; });
}
var pluginAttr = {
placeholder :localization.tt('h.searchForYourAccessLog'),
container : this.ui.visualSearch,
query : query,
+ type : 'admin',
callbacks : {
valueMatches :function(facet, searchTerm, callback) {
switch (facet) {
@@ -424,11 +406,6 @@ define(function(require) {
}
XAUtils.displayDatepicker(that.ui.visualSearch, facet, startDate, callback);
break;
- case 'Today' :
- var today = Globalize.format(new Date(),"yyyy/mm/dd");
- callback([today]);
- break;
-
}
}
@@ -436,9 +413,10 @@ define(function(require) {
};
this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.trxLogList,pluginAttr);
+ this.setEventsToFacets(this.visualSearch, App.vsHistory.admin);
},
addSearchForLoginSessionTab : function(){
- var that = this;
+ var that = this , query = '' ;
var searchOpt = ["Session Id", "Login Id", "Result", "Login Type", "IP", "User Agent", "Start Date","End Date"];
var serverAttrName = [{text : "Session Id", label :"id"}, {text : "Login Id", label :"loginId"},
{text : "Result", label :"authStatus",'multiple' : true, 'optionsArr' : XAUtils.enumToSelectLabelValuePairs(XAEnums.AuthStatus)},
@@ -446,10 +424,12 @@ define(function(require) {
{text : "IP", label :"requestIP"},{text :"User Agent", label :"requestUserAgent"},
{text : 'Start Date',label :'startDate'},{text : 'End Date',label :'endDate'} ];
+ _.map(App.vsHistory.loginSession, function(m){ query += '"'+m.get('category')+'":"'+m.get('value')+'"'; });
var pluginAttr = {
placeholder :localization.tt('h.searchForYourLoginSession'),
container : this.ui.visualSearch,
- query : '',
+ query : query,
+ type : 'loginSession',
callbacks : {
valueMatches :function(facet, searchTerm, callback) {
switch (facet) {
@@ -483,29 +463,28 @@ define(function(require) {
}
XAUtils.displayDatepicker(that.ui.visualSearch, facet, startDate, callback);
break;
- case 'Today' :
- var today = Globalize.format(new Date(),"yyyy/mm/dd");
- callback([today]);
- break;
- }
+ }
}
}
};
this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.authSessionList,pluginAttr);
+ this.setEventsToFacets(this.visualSearch, App.vsHistory.loginSession);
},
addSearchForAgentTab : function(){
- var that = this;
- var searchOpt = ["Service Name", "Plugin Id", "Plugin IP", "Http Response Code", "Start Date","End Date", "Cluster Name"];
- var serverAttrName = [{text : "Plugin Id", label :"agentId"}, {text : "Plugin IP", label :"clientIP"},
+ var that = this , query = '';
+ var searchOpt = ["Service Name", "Plugin ID", "Plugin IP", "Http Response Code", "Start Date","End Date", "Cluster Name"];
+ var serverAttrName = [{text : "Plugin ID", label :"agentId"}, {text : "Plugin IP", label :"clientIP"},
{text : "Service Name", label :"repositoryName"},{text : "Http Response Code", label :"httpRetCode"},
{text : "Export Date", label :"createDate"},
{text : 'Start Date',label :'startDate'},{text : 'End Date',label :'endDate'},
{text : 'Cluster Name',label :'cluster'}];
+ _.map(App.vsHistory.plugin, function(m){ query += '"'+m.get('category')+'":"'+m.get('value')+'"'; });
var pluginAttr = {
placeholder :localization.tt('h.searchForYourAgent'),
container : this.ui.visualSearch,
- query : '',
+ query : query,
+ type : 'plugin',
callbacks : {
valueMatches :function(facet, searchTerm, callback) {
switch (facet) {
@@ -535,27 +514,26 @@ define(function(require) {
}
XAUtils.displayDatepicker(that.ui.visualSearch, facet, startDate, callback);
break;
- case 'Today' :
- var today = Globalize.format(new Date(),"yyyy/mm/dd");
- callback([today]);
- break;
}
}
}
};
this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.policyExportAuditList, pluginAttr);
+ this.setEventsToFacets(this.visualSearch, App.vsHistory.plugin);
},
addSearchForPluginStatusTab : function(){
- var that = this;
+ var that = this , query = '';
var searchOpt = [localization.tt("lbl.serviceName"), localization.tt("lbl.serviceType"),
localization.tt("lbl.agentIp"), localization.tt("lbl.hostName")];
var serverAttrName = [{text : localization.tt("lbl.serviceName"), label :"serviceName"},{text : localization.tt("lbl.serviceType"), label :"pluginAppType"},
{text : localization.tt("lbl.agentIp"), label :"pluginIpAddress"}, {text : localization.tt("lbl.hostName"), label :"pluginHostName"}];
+ _.map(App.vsHistory.pluginStatus, function(m){ query += '"'+m.get('category')+'":"'+m.get('value')+'"'; });
var pluginAttr = {
placeholder : localization.tt('msg.searchForPluginStatus'),
container : this.ui.visualSearch,
- query : '',
+ query : query,
+ type : 'pluginStatus',
callbacks : {
valueMatches :function(facet, searchTerm, callback) {
switch (facet) {
@@ -572,6 +550,24 @@ define(function(require) {
}
}
this.visualSearch = XAUtils.addVisualSearch(searchOpt, serverAttrName, this.pluginInfoList, pluginAttr);
+ this.setEventsToFacets(this.visualSearch, App.vsHistory.pluginStatus);
+ },
+ //preserve, remove and change search filter values in App.vsHistory
+ setEventsToFacets : function(vs, value){
+ vs.searchQuery.bind('add', function(model){
+ value.push(model) ;
+ });
+ vs.searchQuery.bind('remove', function(model){
+ value = _.filter(value, function(m){ return m.get('category') != model.get('category');})
+ App.vsHistory[vs.options.type] = value;
+ });
+ vs.searchQuery.bind('change', function(model){
+ _.each(App.vsHistory[vs.options.type],function(m){
+ if(m.get('category') == model.get('category')){
+ m.attributes.value = model.get('value');
+ }
+ })
+ });
},
renderAdminTable : function(){
var that = this , self = this;
@@ -1199,11 +1195,17 @@ define(function(require) {
},
agentId : {
- cell : 'string',
+ cell : 'html',
label :localization.tt('lbl.agentId'),
editable:false,
- sortable:false
- },
+ sortable:false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function (rawValue, model) {
+ rawValue = _.escape(rawValue);
+ return '<span title="'+rawValue+'">'+rawValue+'</span>';
+ }
+ }),
+ },
clientIP : {
cell : 'string',
label : localization.tt('lbl.agentIp'),
@@ -1263,16 +1265,28 @@ define(function(require) {
getPluginInfoColums : function(){
var that = this, cols ={
serviceName : {
- cell : 'string',
+ cell : 'html',
label : localization.tt("lbl.serviceName"),
editable:false,
- sortable:false
+ sortable:false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function (rawValue, model) {
+ rawValue = _.escape(rawValue);
+ return '<span title="'+rawValue+'">'+rawValue+'</span>';
+ }
+ }),
},
appType : {
- cell : 'string',
+ cell : 'html',
label : localization.tt("lbl.serviceType"),
editable:false,
- sortable:false
+ sortable:false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function (rawValue, model) {
+ rawValue = _.escape(rawValue);
+ return '<span title="'+rawValue+'">'+rawValue+'</span>';
+ }
+ }),
},
hostName : {
cell : 'html',
@@ -1307,7 +1321,7 @@ define(function(require) {
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>'
+ return '<i class="icon-exclamation-sign activePolicyAlert" title="'+localization.tt("msg.activationTimeDelayMsg")+'"></i>'
+ Globalize.format(activeDate, "MM/dd/yyyy hh:mm:ss tt");
}
}
@@ -1363,7 +1377,7 @@ define(function(require) {
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>'
+ return '<i class="icon-exclamation-sign activePolicyAlert" title="'+localization.tt("msg.activationTimeDelayMsg")+'"></i>'
+ Globalize.format(activeDate, "MM/dd/yyyy hh:mm:ss tt");
}
}
@@ -1489,9 +1503,6 @@ define(function(require) {
});
},
- /** all post render plugin initialization */
- initializePlugins : function() {
- },
updateLastRefresh : function(){
this.ui.lastUpdateTimeLabel.html(Globalize.format(new Date(), "MM/dd/yyyy hh:mm:ss tt"));
},
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js b/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
index 6f1069d..e92929a 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
@@ -38,13 +38,15 @@ define(function(require){
},
/** ui selector cache */
ui: {
- loginTime : '[data-id="loginTime"]'
+ loginTime : '[data-id="loginTime"]',
+ showAction : '[data-id="showAction"]'
},
/** ui events hash */
events: function() {
var events = {};
//events['change ' + this.ui.input] = 'onInputChange';
+ events['click ' + this.ui.showAction] = 'showAction';
return events;
},
@@ -68,7 +70,6 @@ define(function(require){
/** on render callback */
onRender: function() {
this.initializePlugins();
- App.sessionId = this.model.get('id');
var date = new Date(this.model.get('authTime')).toString();
var timezone = date.replace(/^.*GMT.*\(/, "").replace(/\)$/, "");
this.ui.loginTime.html(Globalize.format(new Date(this.model.get('authTime')), "MM/dd/yyyy hh:mm:ss tt")+' '+timezone);
@@ -76,6 +77,10 @@ define(function(require){
/** all post render plugin initialization */
initializePlugins: function(){
},
+ /* on show action button*/
+ showAction : function(){
+ App.sessionId = this.model.get('id');
+ },
/** on close */
onClose: function(){
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/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 7a5ec2e..6cda421 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2141,3 +2141,10 @@ td.subgrid-custom-cell{
.capitalize {
text-transform: capitalize;
}
+.importbtn{
+ margin-right: 5px ;
+ margin-top:-2px;
+}
+.text-decoration:hover{
+ text-decoration: none;
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html b/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
index ea2f198..44f96ef 100644
--- a/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
@@ -39,15 +39,15 @@
{{./this.attributes.name}}
{{#if ../operation}}
- <a href="javascript:void(0)" title="Export" type="button" class="download pull-right " data-id="downloadBtnOnService" data-servicetype="{{./this.attributes.name}}" style="margin-right: 5px;" >
+ <a href="javascript:void(0)" title="Export" type="button" class="download pull-right text-decoration" data-id="downloadBtnOnService" data-servicetype="{{./this.attributes.name}}" style="margin-right: 5px;" >
<i class="icon-external-link-sign"> </i>
</a>
- <a href="javascript:void(0)" title="Import" data-id="uploadBtnOnServices" data-servicetype="{{./this.attributes.name}}" class=" btn-right" style="margin-right: 5px ; margin-top:-2px;">
+ <a href="javascript:void(0)" title="Import" data-id="uploadBtnOnServices" data-servicetype="{{./this.attributes.name}}" class=" btn-right importbtn text-decoration">
<i class="icon-rotate-180 icon-external-link-sign"> </i>
</a>
- <a href="#!/service/{{./this.id}}/create"class="pull-right" title="Add New Service" style="margin-right: 2px;"> <i class="icon-plus"></i></a> <!-- -->
+ <a href="#!/service/{{./this.id}}/create"class="pull-right text-decoration" title="Add New Service" style="margin-right: 2px;"> <i class="icon-plus"></i></a>
{{/if}}
</span>
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
index 028fdbf..bee65db 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
@@ -34,7 +34,7 @@
<div class="wrap non-collapsible " style="margin-top:-6px;">
<div class="wrap well">
<div class="row-fluid">
- <div class="span9">
+ <div class="span11">
<div class="visual_search"></div>
</div>
<div>
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/main/webapp/templates/reports/LoginSessionDetail_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/LoginSessionDetail_tmpl.html b/security-admin/src/main/webapp/templates/reports/LoginSessionDetail_tmpl.html
index ddd6e3d..b11fa83 100644
--- a/security-admin/src/main/webapp/templates/reports/LoginSessionDetail_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/LoginSessionDetail_tmpl.html
@@ -46,7 +46,7 @@
</tbody>
</table>
</div>
- <a href="#!/reports/audit/admin" class="link-tag">Show Actions</a>
+ <a href="#!/reports/audit/admin" class="link-tag" data-id="showAction">Show Actions</a>
</div>
http://git-wip-us.apache.org/repos/asf/ranger/blob/c7784876/security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java
----------------------------------------------------------------------
diff --git a/security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java b/security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java
index c544832..5068fdc 100644
--- a/security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java
+++ b/security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java
@@ -1332,15 +1332,15 @@ public class TestXUserREST {
Mockito.verify(searchUtil).extractLong(request, testSearchCriteria, "id", "Auth Session Id");
Mockito.verify(searchUtil).extractLong(request, testSearchCriteria, "userId", "User Id");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "authStatus", "Auth Status");
- Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "authType", "Auth Type");
+ Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "authType", "Login Type");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "deviceType", "Device Type");
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "firstName", "User First Name", StringUtil.VALIDATION_NAME);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "lastName", "User Last Name", StringUtil.VALIDATION_NAME);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "requestUserAgent", "User Agent", StringUtil.VALIDATION_TEXT);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "requestIP", "Request IP Address", StringUtil.VALIDATION_IP_ADDRESS);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "loginId", "Login ID", StringUtil.VALIDATION_TEXT);
- Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "startDate", "Start date for search", null);
- Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "endDate", "End date for search", null);
+ Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "startDate", "Start Date", null);
+ Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "endDate", "End Date", null);
assertNotNull(outputvXGroupList);
assertEquals(outputvXGroupList.getStartIndex(),testVXAuthSessionList.getStartIndex());
assertEquals(outputvXGroupList.getTotalCount(), testVXAuthSessionList.getTotalCount());
@@ -2235,4 +2235,4 @@ public class TestXUserREST {
testVXStringList.setTotalCount(1);
return testVXStringList;
}
-}
\ No newline at end of file
+}