diff app/view/window/AuditTrail.js @ 1406:d1f6aa80758f

Audit-trail: Handle response with error message.
author Tom Gottfried <tom@intevation.de>
date Wed, 22 Mar 2017 15:01:35 +0100
parents 7cf7a8dc7818
children 2195fd3946e4
line wrap: on
line diff
--- 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));
+            }
         }
     },
 

http://lada.wald.intevation.org