ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From me...@apache.org
Subject ranger git commit: RANGER-1682: Clicking on export service after session timeout gets stuck indefinitely.
Date Mon, 18 Sep 2017 12:39:10 GMT
Repository: ranger
Updated Branches:
  refs/heads/ranger-0.7 3bf2d33b3 -> 106a1f45f


RANGER-1682: Clicking on export service after session timeout gets stuck indefinitely.


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

Branch: refs/heads/ranger-0.7
Commit: 106a1f45f0de7b3bc2c4dfa6ad0520e79f287208
Parents: 3bf2d33
Author: Nitin Galave <nitin.galave@gmail.com>
Authored: Thu Sep 14 17:45:59 2017 +0530
Committer: Mehul Parikh <mehul@apache.org>
Committed: Mon Sep 18 18:08:42 2017 +0530

----------------------------------------------------------------------
 security-admin/src/main/webapp/login.jsp                |  5 +++++
 .../src/main/webapp/scripts/models/RangerServiceDef.js  |  8 ++++++++
 .../src/main/webapp/scripts/models/XABaseModel.js       |  4 ++--
 security-admin/src/main/webapp/scripts/utils/XAUtils.js |  6 ++++--
 .../main/webapp/scripts/views/DownloadServicePolicy.js  |  4 ++++
 .../main/webapp/scripts/views/UploadServicePolicy.js    | 12 ++++++++----
 .../src/main/webapp/scripts/views/kms/KMSTableLayout.js |  9 +++++++++
 .../scripts/views/permissions/ModulePermissionForm.js   |  3 ++-
 .../webapp/scripts/views/policies/PermissionList.js     |  8 ++++++++
 .../webapp/scripts/views/policies/RangerPolicyRO.js     |  9 ++++++++-
 .../webapp/scripts/views/policymanager/ServiceLayout.js |  2 +-
 .../main/webapp/scripts/views/reports/AuditLayout.js    |  9 ++++++++-
 .../main/webapp/scripts/views/service/ServiceCreate.js  |  3 +++
 .../src/main/webapp/scripts/views/user/UserProfile.js   |  8 +++++++-
 14 files changed, 77 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/login.jsp
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/login.jsp b/security-admin/src/main/webapp/login.jsp
index 39fb327..b8f4cb9 100644
--- a/security-admin/src/main/webapp/login.jsp
+++ b/security-admin/src/main/webapp/login.jsp
@@ -44,6 +44,11 @@
 					});
 				};
 				$(window).resize(updateBoxPosition);
+				var queryParams = JSON.parse('{"' + decodeURI((location.href.split('?')[1] || 'g=0').replace(/=/g,
"\":\"")) + '"}');
+              	if(queryParams.sessionTimeout){
+                	window.alert('Session Timeout');
+                	location.replace("login.jsp");
+               	}
 				setTimeout(updateBoxPosition, 50);
 			});
 		</script>

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
index 704f378..73e19a1 100644
--- a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
+++ b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
@@ -107,6 +107,14 @@ define(function(require){
 							return {results : results};
 						}
 						return {results : results};
+					},
+					transport : function (options) {
+						$.ajax(options).error(function(respones) {
+							XAUtils.defaultErrorHandler('error',respones);
+							this.success({
+								resultSize : 0
+							});
+						});
 					}
 				},	
 				formatResult : function(result){

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/models/XABaseModel.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/XABaseModel.js b/security-admin/src/main/webapp/scripts/models/XABaseModel.js
index 6083210..cb0691c 100644
--- a/security-admin/src/main/webapp/scripts/models/XABaseModel.js
+++ b/security-admin/src/main/webapp/scripts/models/XABaseModel.js
@@ -41,9 +41,9 @@ define(function(require){
 		},
 		bindErrorEvents :function(){
 			//Moved require inside fuctn expression due to ie issue
-                        this.bind("error", function(e){
+			this.bind("error", function(e, error){
 				var XAUtils = require('utils/XAUtils');
-                                XAUtils.defaultErrorHandler(undefined, e);
+				XAUtils.defaultErrorHandler(undefined, error, e);
 			});
 		},
 		/**

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/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 1a86177..a7a6285 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -609,7 +609,9 @@ define(function(require) {
 	XAUtils.defaultErrorHandler = function(model, error) {
 		var App = require('App');
 		var vError = require('views/common/ErrorView');
-		if(!_.isUndefined(model) && !_.isUndefined(model.modelName) &&  model.modelName
== XAEnums.ClassTypes.CLASS_TYPE_XA_ACCESS_AUDIT.modelName){
+		if(!_.isUndefined(model) && !_.isUndefined(model.modelName) 
+				&&  model.modelName == XAEnums.ClassTypes.CLASS_TYPE_XA_ACCESS_AUDIT.modelName
+				&& error.status !== 419){
 			return;
 		}
 		if (error.status == 404) {
@@ -621,7 +623,7 @@ define(function(require) {
 				status : error.status
 			}));
 		} else if (error.status == 419) {
-			window.location = 'login.jsp'
+			window.location = 'login.jsp?sessionTimeout=true';
 		}
 	};
 	XAUtils.select2Focus = function(event) {

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js b/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
index fb10562..1b1a4aa 100644
--- a/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
+++ b/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
@@ -80,6 +80,10 @@ define(function(require){
 		        	}
 		        	
 		        },
+                        error : function(data,status,response){
+				XAUtil.blockUI('unblock');
+				XAUtil.defaultErrorHandler(status,data);
+                        },
 		    });
         },
 	 	onRender: function() {

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js b/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
index 338fffb..62a1fcf 100644
--- a/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
+++ b/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
@@ -207,11 +207,15 @@ define(function(require){
 		   	      error : function(response,model){
 		   	    	XAUtil.blockUI('unblock');
 		   	 	if ( response && response.responseJSON && response.responseJSON.msgDesc){
-					XAUtil.notifyError('Error', response.responseJSON.msgDesc);
-			        } else {
+					if(response.status == '419'){
+						XAUtil.defaultErrorHandler(model,response);
+					}else{
+						XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+					}
+				} else {
 			       	XAUtil.notifyError('Error', 'File import failed.');
-		     	    }
-				  }
+				}
+			      }
 		    });
 	    },
 	    onAddClick : function(){

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
index fbbee46..2749cea 100755
--- a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
@@ -266,6 +266,7 @@ define(function(require){
 			this.ui.selectServiceName.select2({
 				maximumSelectionSize : 1,
 				closeOnSelect : true,
+                                allowClear: true,
 				width :'220px',
 				placeholder : 'Please select KMS service',
 				initSelection : function (element, callback) {
@@ -284,6 +285,14 @@ define(function(require){
 							return { results : results };
 						}
 						return { results : results };
+                                        },
+                                        transport: function (options) {
+                                                $.ajax(options).error(function(respones)
{
+                                                        XAUtil.defaultErrorHandler('error',respones);
+                                                        this.success({
+                                                                resultSize : 0
+                                                        });
+                                                });
 					}
 				},	
 				formatResult : function(result){

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
index aa4c332..d9c522c 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
@@ -178,8 +178,9 @@ define(function(require) {
 							return { results : results};
 						},
 						transport: function (options) {
-							$.ajax(options).error(function() {
+                                                        $.ajax(options).error(function(respones)
{
 								console.log("ajax failed");
+                                                                XAUtil.defaultErrorHandler('error',respones);
 								this.success({
 									resultSize : 0
 								});

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/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 bb64984..0803945 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
@@ -223,6 +223,14 @@ define(function(require) {
 							return {results : results};
 						}
 						return {results : results};
+                                        },
+                                        transport: function (options) {
+                                                $.ajax(options).error(function(respones)
{
+                                                        XAUtil.defaultErrorHandler('error',respones);
+                                                        this.success({
+                                                                resultSize : 0
+                                                        });
+                                                });
 					}
 				},	
 				formatResult : function(result){

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
----------------------------------------------------------------------
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 b084473..d0a8683 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
@@ -83,7 +83,14 @@ define(function(require) {
 			this.policy.fetchByEventTime({
 				async: false,
 				cache: false,
-				data : data
+                                data : data,
+                                error : function(error , response){
+                                        if (response && response.status === 419 )
{
+                                                XAUtils.defaultErrorHandler(error , response);
+                                        } else {
+                                                XAUtils.showErrorMsg(response.responseJSON.msgDesc);
+                                        }
+                                }
 			});
 		},
 

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
index c551887..ab42b5c 100644
--- a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
@@ -231,7 +231,7 @@ define(function(require){
 							},
 							error :function(model, response) {
 								XAUtil.blockUI('unblock');
-								if(!_.isUndefined(response) && !_.isUndefined(response.responseJSON) &&
!_.isUndefined(response.responseJSON.msgDesc)){
+                                                                if(!_.isUndefined(response)
&& !_.isUndefined(response.responseJSON) && !_.isUndefined(response.responseJSON.msgDesc
&& response.status !='419')){
 									XAUtil.notifyError('Error', response.responseJSON.msgDesc);
 								}
 							}

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/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 f2c8448..e9d3675 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -619,7 +619,14 @@ define(function(require) {
 					
 					var fullTrxLogListForTrxId = new VXTrxLogList();
 					fullTrxLogListForTrxId.getFullTrxLogListForTrxId(this.model.get('transactionId'),{
-						cache : false
+                                                cache : false,
+                                                error : function(response , error){
+                                                        if (response && response.status
=== 419 ) {
+                                                                XAUtils.defaultErrorHandler(error
, response);
+                                                        } else {
+                                                                XAUtils.showErrorMsg(response.responseJSON.msgDesc);
+                                                        }
+                                                }
 					}).done(function(coll,mm){
 						XAUtils.blockUI('unblock');
 						fullTrxLogListForTrxId = new VXTrxLogList(coll.vXTrxLogs);

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js b/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
index c2b78ab..54444fb 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
@@ -238,6 +238,9 @@ define(function(require){
 						}
 					},
 					error: function (msResponse, options) {
+                                                if(msResponse.status === 419){
+                                                        XAUtil.defaultErrorHandler(options
, msResponse);
+                                                }
 						bootbox.alert("Connection Failed.");
 					}	
 				});

http://git-wip-us.apache.org/repos/asf/ranger/blob/106a1f45/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/user/UserProfile.js b/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
index cac80a8..8e60b53 100644
--- a/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
+++ b/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
@@ -140,7 +140,11 @@ define(function(require){
 						that.form.fields.name.setError(response.responseJSON.msgDesc);
 						XAUtil.notifyError('Error', response.responseJSON.msgDesc);
 					}else {
-						XAUtil.notifyError('Error', 'Error occurred while updating user profile!!');
+                                                if(model.status == 419){
+                                                        XAUtil.defaultErrorHandler(response
, model);
+                                                }else{
+                                                        XAUtil.notifyError('Error', 'Error
occurred while updating user profile!!');
+                                                }
 					}
 				}
 			});
@@ -168,6 +172,8 @@ define(function(require){
 						that.form.fields.reEnterPassword.setError(localization.tt('validationMessages.newPasswordError'));
 					}else if((msResponse.responseJSON.msgDesc) == "serverMsg.userMgrOldPassword"){
 						that.form.fields.oldPassword.setError(localization.tt('validationMessages.oldPasswordRepeatError'));
+                                        }else if(msResponse.status == 419){
+                                                XAUtil.defaultErrorHandler(options , msResponse);
 					} else {
 						that.form.fields.oldPassword.setError(localization.tt('validationMessages.oldPasswordError'));
 					}


Mime
View raw message