Forráskód Böngészése

HUE-6312 [useradmin] Add error notifications on Hue 4 for edit user

Enrico Berti 8 éve
szülő
commit
53f021c

+ 23 - 2
apps/useradmin/src/useradmin/templates/edit_user.mako

@@ -140,12 +140,31 @@ $(document).ready(function(){
 
   % if is_embeddable:
   $editUserComponents.find('#editForm').attr('action', window.location.pathname.substr(4).replace(/\/$/, ''));
+
+  function renderErrors(errors) {
+    $('.control-group').removeClass('error');
+    $('.errorlist').remove();
+    if (errors && errors.length > 0){
+      errors.forEach(function(e){
+        var $el = $('#' + e.id);
+        $el.closest('.control-group').addClass('error');
+        var html = '<span class="help-inline"><ul class="errorlist">';
+        e.message.forEach(function(message){
+          html += '<li>' + message + '</li>';
+        });
+        html += '</ul></span>';
+        $el.after(html);
+      });
+    }
+  }
+
   $editUserComponents.find('#editForm').ajaxForm({
     dataType:  'json',
     success: function(data) {
       if (data && data.status == -1) {
-        $.jHueNotify.info("${ _('Errors: ') }" + data.errors);
-      } else if (data && data.url) {
+        renderErrors(data.errors);
+      }
+      else if (data && data.url) {
         huePubSub.publish('open.link', data.url);
         $.jHueNotify.info("${ _('User information updated correctly') }");
       }
@@ -224,12 +243,14 @@ $(document).ready(function(){
     $(this).parent().find(".help-inline").remove();
   });
 
+  % if not is_embeddable:
   $editUserComponents.find("#editForm").on("submit", function(){
     if (validateStep("step1") && validateStep("step2")) {
       return true;
     }
     return false;
   })
+  % endif
 });
 </script>
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue.css


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue3-extra.css


+ 0 - 12
desktop/core/src/desktop/static/desktop/css/hue3.css

@@ -67,18 +67,6 @@ code {
   color: #B94A48;
 }
 
-ul.errorlist {
-  list-style: none outside none;
-  margin: 0;
-}
-
-ul.errorlist li {
-  color: #B94A48;
-  padding: 2px;
-  font-weight: bold;
-  font-style: italic;
-}
-
 .hueWell {
   padding-bottom: 0;
 }

+ 11 - 0
desktop/core/src/desktop/static/desktop/less/hue-cross-version.less

@@ -363,3 +363,14 @@ input[type='password']::-ms-reveal {
     margin-top: 10px;
   }
 }
+
+ul.errorlist {
+  list-style: none outside none;
+  margin: 0;
+  li {
+    color: @cui-red-700;
+    padding: 2px;
+    font-weight: bold;
+    font-style: italic;
+  }
+}

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott