[Lada-commits] [PATCH 2 of 2] Audit-trail: Handle response with error message

Wald Commits scm-commit at wald.intevation.org
Wed Mar 22 15:02:12 CET 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1490191295 -3600
# Node ID d1f6aa80758f369f47a1539a190614b2efbfe00f
# Parent  24af0514618e4803580daf9777af19c2efc59702
Audit-trail: Handle response with error message.

diff -r 24af0514618e -r d1f6aa80758f app/view/window/AuditTrail.js
--- a/app/view/window/AuditTrail.js	Wed Mar 22 14:31:36 2017 +0100
+++ b/app/view/window/AuditTrail.js	Wed Mar 22 15:01:35 2017 +0100
@@ -75,14 +75,22 @@
     },
 
     loadSuccess: function(response) {
+        var i18n = Lada.getApplication().bundle;
         var json = Ext.decode(response.responseText);
         var container = this.down('panel[name=auditcontainer]');
-        if (this.type === 'probe') {
-            var html = this.createHtmlProbe(json);
+        if (!json.success) {
+            var html = '<p><strong>' + i18n.getMsg(json.message.toString())
+                + '</strong></p>';
             container.update(html);
         }
-        else if (this.type === 'messung') {
-            container.update(this.createHtmlMessung(json));
+        else {
+            if (this.type === 'probe') {
+                var html = this.createHtmlProbe(json);
+                container.update(html);
+            }
+            else if (this.type === 'messung') {
+                container.update(this.createHtmlMessung(json));
+            }
         }
     },
 


More information about the Lada-commits mailing list