Revert "RANGER-632 Added validation error msg on Ranger UI in service/policy 
create page and also added pause option in bootstrap-notify plugin."

This reverts commit ff1ec7b7f37927e96a4905efab73034c43861b3c.


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

Branch: refs/heads/HDP-2.3.2-groupid
Commit: c1304f958dcac0d27ef3c318cf85e5ae07f3bdf3
Parents: 4d04a09
Author: Alok Lal <[email protected]>
Authored: Tue Sep 15 22:58:20 2015 -0700
Committer: Alok Lal <[email protected]>
Committed: Tue Sep 15 22:58:20 2015 -0700

----------------------------------------------------------------------
 .../bootstrap-notify/js/bootstrap-notify.js     | 44 ++++----------------
 .../src/main/webapp/scripts/utils/XAUtils.js    | 26 +-----------
 .../views/policies/RangerPolicyCreate.js        | 12 ++----
 .../scripts/views/service/ServiceCreate.js      | 23 +++++++---
 security-admin/src/main/webapp/styles/xa.css    |  5 ---
 5 files changed, 30 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c1304f95/security-admin/src/main/webapp/libs/bower/bootstrap-notify/js/bootstrap-notify.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/libs/bower/bootstrap-notify/js/bootstrap-notify.js
 
b/security-admin/src/main/webapp/libs/bower/bootstrap-notify/js/bootstrap-notify.js
index ba309e2..e58c6c5 100644
--- 
a/security-admin/src/main/webapp/libs/bower/bootstrap-notify/js/bootstrap-notify.js
+++ 
b/security-admin/src/main/webapp/libs/bower/bootstrap-notify/js/bootstrap-notify.js
@@ -47,21 +47,13 @@
           this.$note.text(this.options.message.text);
       } else
         this.$note.html(this.options.message);
-    
-    var style = this.options.type == 'error' ? 'color:#a94442' : 
'color:#3c763d';  
-    
+
     if(this.options.closable) {
-      var link = $('<a class="close pull-right" style="'+style+';" 
href="#">&times;</a>');
+      var link = $('<a class="close pull-right" href="#">&times;</a>');
       $(link).on('click', $.proxy(onClose, this));
       this.$note.prepend(link);
     }
 
-    if(this.options.pausable) {
-       var pauseLink = $('<a class="pause pull-right pause-play-close" 
style="'+style+';" href="#"><i class="icon-pause"></i></a><a class="play 
pull-right pause-play-close" href="#" style="'+style+';display:none;"><i 
class="icon-play"></i></a>');
-       $(pauseLink).on('click', $.proxy(onPause, this));
-       this.$note.prepend(pauseLink);
-       
-    }
     return this;
   };
 
@@ -72,31 +64,10 @@
     return false;
   };
 
-  var onPause = function() {
-         if(this.$note.find('.pause').is(':visible')){
-                 clearInterval(this.clearNotifyInterval)
-                 this.$note.find('.pause').hide()
-                 this.$note.find('.play').show()
-         }else{
-                 setFadeOut(this)
-                 this.$note.find('.pause').show()
-                 this.$note.find('.play').hide()
-         }
-         return false;
-  };
-  var setFadeOut = function(self){
-         var that = self;
-         self.clearNotifyInterval = setTimeout(function() {
-                 that.$note.fadeOut('slow', $.proxy(that.onClose, that));    
-         }, self.options.fadeOut.delay || 7000);
-  };
-         
   Notification.prototype.show = function () {
-       var that = this;  
-    if(this.options.fadeOut.enabled){
-       setFadeOut(this)
-    }
-//  this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', 
$.proxy(onClose, this));
+    if(this.options.fadeOut.enabled)
+      this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', 
$.proxy(onClose, this));
+
     this.$element.append(this.$note);
     this.$note.alert();
   };
@@ -117,11 +88,10 @@
     transition: 'fade',
     fadeOut: {
       enabled: true,
-      delay: 7000
+      delay: 3000
     },
     message: null,
     onClose: function () {},
-    onClosed: function () {},
-    pausable: false
+    onClosed: function () {}
   }
 })(window.jQuery);

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c1304f95/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 3f52fb2..6d84d1c 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -194,8 +194,7 @@ define(function(require) {
                                        html : html,
                                        text : text
                                },
-                               type : 'info',
-                               pausable: true
+                               type : 'info'
                        };
                }
                $('.top-right').notify(options).show();
@@ -221,8 +220,7 @@ define(function(require) {
                                        html : html,
                                        text : text
                                },
-                               type : 'error',
-                               pausable: true
+                               type : 'error'
                        };
                }
                $('.top-right').notify(options).show();
@@ -248,7 +246,6 @@ define(function(require) {
                                        html : html
                                },
                                type : 'success',
-                               pausable: true
                        };
                }
                $('.top-right').notify(options).show();
@@ -1099,24 +1096,5 @@ define(function(require) {
                })
                return {'userRoleList' : userRoleList };
        };
-       XAUtils.showErrorMsg = function(respMsg){
-               var respArr = respMsg.split(/\([0-9]*\)/);
-               respArr.shift();
-               _.each(respArr, function(str){
-                       var validationMsg = str.split(','), erroCodeMsg = '';
-                       //get code from string 
-                       if(!_.isUndefined(validationMsg[0]) && 
validationMsg[0].indexOf("error code") != -1){
-                               var tmp = validationMsg[0].split('error code');
-                               var code = tmp[ tmp.length - 1 ];
-                               
-                               erroCodeMsg = 'Error Code : '+ 
code.match(/\d/g).join('');
-                               }
-                       var reason = str.lastIndexOf("reason") != -1 ? 
(str.substring(str.lastIndexOf("reason")+7, str.indexOf("field[")-2 ))
-                                       : str;
-                       var erroMsg = erroCodeMsg 
+"<br/>"+XAUtils.capitaliseFirstLetter(reason);
-                       return XAUtils.notifyError('Error', erroMsg);
-               });
-       };
-       
        return XAUtils;
 });

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c1304f95/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js 
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
index b07f9a2..7370ee8 100644
--- 
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
+++ 
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
@@ -207,14 +207,10 @@ define(function(require){
                                        
App.appRouter.navigate("#!/service/"+that.rangerService.id+"/policies",{trigger:
 true});
                                        console.log("success");
                                },
-                               error : function(model, response, options) {
-                                       XAUtil.blockUI('unblock');
-                                       var msg = that.editPolicy ? 'Error 
updating policy.': 'Error creating policy.';
-                                       if (response && response.responseJSON 
&& response.responseJSON.msgDesc) {
-                                               
XAUtil.showErrorMsg(response.responseJSON.msgDesc);
-                                       } else {
-                                               XAUtil.notifyError('Error', 
msg);
-                                       }
+                               error: function (model, response, options) {
+                                           XAUtil.blockUI('unblock');
+                                               XAUtil.notifyError('Error', 
'Error creating Policy!');
+                                           console.log("error");
                                }
                        });
                },

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c1304f95/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 239b61e..01141b6 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
@@ -164,12 +164,23 @@ define(function(require){
                                },
                                error: function (model, response, options) {
                                        XAUtil.blockUI('unblock');
-                                       var msg = that.editService ? 'Error 
updating Service.': 'Error creating Service.';
-                                       if (response && response.responseJSON 
&& response.responseJSON.msgDesc) {
-                                               
XAUtil.showErrorMsg(response.responseJSON.msgDesc);
-                                       } else {
-                                               XAUtil.notifyError('Error', 
msg);
-                                       }
+                                       if ( response && response.responseJSON 
&& response.responseJSON.msgDesc){
+                                               
if(response.responseJSON.msgDesc == "serverMsg.fsDefaultNameValidationError"){
+                                                       
that.form.fields.fsDefaultName.setError(localization.tt(response.responseJSON.msgDesc));
+                                                       
XAUtil.scrollToField(that.form.fields.fsDefaultName.$el);
+                                               }else 
if(response.responseJSON.msgDesc == "Repository Name already exists"){
+                                                       
response.responseJSON.msgDesc = "serverMsg.repositoryNameAlreadyExistsError";
+                                                       
that.form.fields.name.setError(localization.tt(response.responseJSON.msgDesc));
+                                                       
XAUtil.scrollToField(that.form.fields.name.$el);
+                                               }else 
if(response.responseJSON.msgDesc == "XUser already exists"){
+                                                       
response.responseJSON.msgDesc = "serverMsg.userAlreadyExistsError";
+                                                       
that.form.fields.userName.setError(localization.tt(response.responseJSON.msgDesc));
+                                                       
XAUtil.scrollToField(that.form.fields.userName.$el);
+                                               }else
+                                                       
XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+                                       }else
+                                               XAUtil.notifyError('Error', 
'Error creating Service!');
+                                       console.log("error");
                                }
                        });
                },

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/c1304f95/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 f0c7530..ceb1f53 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -1838,9 +1838,4 @@ td.select-row-cell {
 
 #r_topNav .dropdown-menu {
        margin:0;
-}
-.pause-play-close{
-       margin-left: -5px;
-    margin-top: -2px;
-    font-size: 11px;
 }
\ No newline at end of file

Reply via email to