You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ni...@apache.org on 2022/04/14 05:47:21 UTC

[ranger] 01/02: RANGER-3666 : Ranger UI improvement - Add warning popup if auto-complete for resource lookup is failing in Edit policy page

This is an automated email from the ASF dual-hosted git repository.

ni3galave pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit e39b96e47ab60927e697d65d9fb392c66588a4a1
Author: Dhaval.Rajpara <dh...@gmail.com>
AuthorDate: Wed Mar 23 18:24:26 2022 +0530

    RANGER-3666 : Ranger UI improvement - Add warning popup if auto-complete for resource lookup is failing in Edit policy page
    
    Signed-off-by: Nitin Galave <ni...@apache.org>
---
 .../main/webapp/scripts/modules/globalize/message/en.js   |  3 ++-
 .../webapp/scripts/views/policies/RangerPolicyForm.js     | 15 ++++++++++++---
 .../scripts/views/security_zone/ZoneResourceForm.js       | 15 ++++++++++++---
 .../scripts/views/service/ServiceAuditFilterResources.js  | 15 ++++++++++++---
 security-admin/src/main/webapp/styles/xa.css              |  4 ++++
 5 files changed, 42 insertions(+), 10 deletions(-)

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 d235ea7c9..0a332fc23 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
@@ -500,7 +500,8 @@ define(function(require) {
                 signOutIsNotComplete    : 'Authentication to this instance of Ranger is managed externally(for example,Apache Knox). \
                                         You can still open this instance of Ranger from the same web browser without re-authentication. \
                                         To prevent additional access to Ranger, <b>close all browser windows and exit the browser</b>.',
-                pageNotFound            : 'Sorry, this page isn\'t here or has moved.'
+                pageNotFound            : 'Sorry, this page isn\'t here or has moved.',
+                resourcesLookup         : 'Resouce lookup fail for current resource'
 
 
 			},
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
index d4452a8d2..a672648b4 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
@@ -712,7 +712,12 @@ define(function(require){
                             } else {
                                 response();
                             }
-                        }).fail(function(){
+                        }).fail(function(responses){
+                            if (responses && responses.responseJSON && responses.responseJSON.msgDesc) {
+                                XAUtil.notifyError('Error', responses.responseJSON.msgDesc);
+                            } else {
+                                XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+                            }
                             response();
                         });
                         setTimeout(function(){
@@ -821,8 +826,12 @@ define(function(require){
 							};
 						},
 						transport: function (options) {
-                                                        $.ajax(options).fail(function() {
-								console.log("ajax failed");
+							$.ajax(options).fail(function(response) {
+								if (response && response.responseJSON && response.responseJSON.msgDesc) {
+									XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+								} else {
+									XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+								}
 								this.success({
 									resultSize : 0
 								});
diff --git a/security-admin/src/main/webapp/scripts/views/security_zone/ZoneResourceForm.js b/security-admin/src/main/webapp/scripts/views/security_zone/ZoneResourceForm.js
index 7242d7bc2..900d9da6e 100644
--- a/security-admin/src/main/webapp/scripts/views/security_zone/ZoneResourceForm.js
+++ b/security-admin/src/main/webapp/scripts/views/security_zone/ZoneResourceForm.js
@@ -265,7 +265,12 @@ define(function(require) {
                                 } else {
                                     response();
                                 }
-                            }).fail(function() {
+                            }).fail(function(responses) {
+                                if (responses && responses.responseJSON && responses.responseJSON.msgDesc) {
+                                    XAUtil.notifyError('Error', responses.responseJSON.msgDesc);
+                                } else {
+                                    XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+                                }
                                 response();
                             });
                             setTimeout(function() {
@@ -403,8 +408,12 @@ define(function(require) {
                                 };
                             },
                             transport: function(options) {
-                                $.ajax(options).fail(function() {
-                                    console.log("ajax failed");
+                                $.ajax(options).fail(function(response) {
+                                    if (response && response.responseJSON && response.responseJSON.msgDesc) {
+                                        XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+                                    } else {
+                                        XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+                                    }
                                     this.success({
                                         resultSize: 0
                                     });
diff --git a/security-admin/src/main/webapp/scripts/views/service/ServiceAuditFilterResources.js b/security-admin/src/main/webapp/scripts/views/service/ServiceAuditFilterResources.js
index 115486efd..683fa4b18 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ServiceAuditFilterResources.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ServiceAuditFilterResources.js
@@ -259,7 +259,12 @@ define(function(require) {
                                 } else {
                                     response();
                                 }
-                            }).fail(function() {
+                            }).fail(function(responses) {
+                                if (responses && responses.responseJSON && responses.responseJSON.msgDesc) {
+                                    XAUtil.notifyError('Error', responses.responseJSON.msgDesc);
+                                } else {
+                                    XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+                                }
                                 response();
                             });
                             setTimeout(function() {
@@ -389,8 +394,12 @@ define(function(require) {
                                 };
                             },
                             transport: function(options) {
-                                $.ajax(options).fail(function() {
-                                    console.log("ajax failed");
+                                $.ajax(options).fail(function(response) {
+                                    if (response && response.responseJSON && response.responseJSON.msgDesc) {
+                                        XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+                                    } else {
+                                        XAUtil.notifyError('Error', localization.tt('msg.resourcesLookup'));
+                                    }
                                     this.success({
                                         resultSize: 0
                                     });
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index ff99fb195..2da2f29b7 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -1698,6 +1698,10 @@ background-color: #444444;
 	border:none;
 	word-break: break-all;
 }
+.alert-danger {
+  z-index: 1050 !important;
+}
+
 tr.disable-policy td {
 	background-color: #F0F0F0;
 }