[Lada-commits] [PATCH] Make the error dialog look better

Wald Commits scm-commit at wald.intevation.org
Thu Aug 29 10:30:33 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1377764938 -7200
# Node ID 91193c49c2bb39689b4352efe8207df8a54022e6
# Parent  9bc080ecdbc9d82998c1c2002c844f1c71156feb
Make the error dialog look better.

diff -r 9bc080ecdbc9 -r 91193c49c2bb app/controller/Proben.js
--- a/app/controller/Proben.js	Tue Aug 27 10:40:14 2013 +0200
+++ b/app/controller/Proben.js	Thu Aug 29 10:28:58 2013 +0200
@@ -13,7 +13,14 @@
         if (errors) {
             out.push("<ol>");
             for (var key in errors) {
-                out.push("<li>"+key+"</li>");
+                out.push("<li>"+key)
+                var msgs = errors[key];
+                out.push("<ol>");
+                for (var i = msgs.length - 1; i >= 0; i--){
+                    out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>")
+                };
+                out.push("</ol>");
+                out.push("</li>");
             }
             out.push("</ol>");
         } else {
@@ -25,7 +32,14 @@
         if (warnings) {
             out.push("<ol>");
             for (var key in warnings) {
-                out.push("<li>"+key+"</li>");
+                out.push("<li>"+key)
+                var msgs = warnings[key];
+                out.push("<ol>");
+                for (var i = msgs.length - 1; i >= 0; i--){
+                    out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>")
+                };
+                out.push("</ol>");
+                out.push("</li>");
             }
             out.push("</ol>");
         } else {
@@ -120,11 +134,11 @@
                     win.close();
                 },
                 failure: function(fp, resp) {
-                    var errors = resp.result.data[0];
-                    var warnings = resp.result.data[1];
-                    var filename = resp.result.data[2].filename;
-                    var message = resp.message;
-                    var dialogbody = buildImportReport(filename, message, errors.parser, warnings)
+                    var errors = resp.result.data.errors;
+                    var warnings = resp.result.data.warnings;
+                    var filename = resp.result.data.filename;
+                    var message = resp.result.message;
+                    var dialogbody = buildImportReport(filename, message, errors, warnings)
                     Ext.Msg.alert('Fehler', dialogbody);
                     win.close();
                 }


More information about the Lada-commits mailing list