Mercurial > lada > lada-client
diff app/view/window/ImportResponse.js @ 1222:4e62bc6e7250
Fixed parsing of empty data and require the import response window.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 27 Oct 2016 16:26:07 +0200 |
parents | 746915a63a11 |
children | 4c443efd5587 |
line wrap: on
line diff
--- a/app/view/window/ImportResponse.js Wed Oct 26 16:50:07 2016 +0200 +++ b/app/view/window/ImportResponse.js Thu Oct 27 16:26:07 2016 +0200 @@ -22,6 +22,10 @@ if (me.data && me.message) { html = me.parseShortResponse(me.message, me.data); } + else { + html = 'Der Import der Datei ' + this.fileName + + ' war nicht erfolgreich.'; + } this.bodyStyle = {background: '#fff'}; me.items = [{ xtype: 'panel', @@ -45,7 +49,9 @@ } }]; this.callParent(arguments); - download = me.parseResponse(me.message, me.data); + if (me.data && me.message) { + download = me.parseResponse(me.message, me.data); + } }, /** @@ -54,7 +60,7 @@ * @param data */ parseShortResponse: function(msg, data) { - data = Ext.JSON.decode(data); + data = Ext.JSON.decode(data, true); var errors = data.data.errors; var warnings = data.data.warnings; var out = []; @@ -110,8 +116,7 @@ * @param data the payload of the response */ parseResponse: function(msg, data) { - console.log(Ext.JSON.decode(data)); - data = Ext.JSON.decode(data); + data = Ext.JSON.decode(data, true); var errors = data.data.errors; var warnings = data.data.warnings; var out = []; @@ -207,7 +212,6 @@ this.down('button[name=download]').enable(); } } - console.log(out.join('')); return out.join(''); } });