[Lada-commits] [PATCH 9 of 9] Added some todos, Enhanced Proge-Generation Success Msg

Wald Commits scm-commit at wald.intevation.org
Fri May 22 16:14:43 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1432304054 -7200
# Node ID 3bc19188fc3a264684b8fd10128b760a7e6746e5
# Parent  c135201940ee4eadd213042bdd600ed1965fd37c
Added some todos, Enhanced Proge-Generation Success Msg.

diff -r c135201940ee -r 3bc19188fc3a app.js
--- a/app.js	Fri May 22 15:59:40 2015 +0200
+++ b/app.js	Fri May 22 16:14:14 2015 +0200
@@ -107,7 +107,6 @@
     },
 
     onLoginSuccess: function(response) {
-        Lada.serverversion = this.getServerVersion();
 
         if (!Ext.isIE9m) {
           /* Strip out the openid query params to look nicers. */
@@ -123,6 +122,8 @@
         Lada.userroles = json.data.roles;
         Lada.logintime = json.data.servertime;
         Lada.mst = json.data.mst; //Store Messstellen this user may select
+        //Lada.serverVersion
+        this.getServerVersion();
 
         Ext.create('Lada.store.Datenbasis', {
             storeId: 'datenbasis'
diff -r c135201940ee -r 3bc19188fc3a app/controller/FilterResult.js
--- a/app/controller/FilterResult.js	Fri May 22 15:59:40 2015 +0200
+++ b/app/controller/FilterResult.js	Fri May 22 16:14:14 2015 +0200
@@ -133,6 +133,7 @@
                 saveAs(blob, 'export.laf');
             },
             failure: function() {
+                // TODO handle Errors correctly, especially AuthenticationTimeouts
                 Ext.Msg.create(i18n.getMsg('err.msg.generic.title'),
                     i18n.getMsg('err.msg.laf.filecreatefailed'));
             }
diff -r c135201940ee -r 3bc19188fc3a app/view/window/FileUpload.js
--- a/app/view/window/FileUpload.js	Fri May 22 15:59:40 2015 +0200
+++ b/app/view/window/FileUpload.js	Fri May 22 16:14:14 2015 +0200
@@ -59,6 +59,7 @@
     },
 
     uploadFile: function(button) {
+        // TODO Error handling ?
         var win = button.up('window');
         var uploader = Ext.create('Ext.ux.upload.uploader.ExtJsUploader', {
             extraHeaders: {
@@ -86,6 +87,7 @@
     },
 
     uploadFailure: function(file, response) {
+        // TODO handle Errors correctly, especially AuthenticationTimeouts
         this.close();
         var win = Ext.create('Lada.view.window.ImportResponse', {
             data: response.response.responseText,
diff -r c135201940ee -r 3bc19188fc3a app/view/window/GenProbenFromMessprogramm.js
--- a/app/view/window/GenProbenFromMessprogramm.js	Fri May 22 15:59:40 2015 +0200
+++ b/app/view/window/GenProbenFromMessprogramm.js	Fri May 22 16:14:14 2015 +0200
@@ -48,11 +48,36 @@
                         'X-OPENID-PARAMS': Lada.openIDParams
                     },
                     jsonData: jsondata,
-                    success: function(form, action) {
-                        Ext.Msg.alert('Success', action.result.msg);
+                    success: function(response) {
+                        var json = Ext.JSON.decode(response.responseText);
+                        console.log(json);
+                        Ext.Msg.show({
+                            title: i18n.getMsg('success'),
+                            autoScroll: true,
+                            msg: me.evalResponse(json),
+                            buttons: Ext.Msg.OK,
+                        });
                     },
-                    failure: function(form, action) {
-                        Ext.Msg.alert('Failed', action.result.msg);
+                    failure: function(response) {
+                    // TODO handle Errors correctly, especially AuthenticationTimeouts
+                        var json = Ext.JSON.decode(response.responseText);
+                        if (json) {
+                            if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
+                                formPanel.setMessages(json.errors, json.warnings);
+                            }
+
+                            if(json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
@@ -120,4 +145,22 @@
         var i18n = Lada.getApplication().bundle;
         me = this;
     },
+
+    /**
+     * Parse ServerResponse when Proben have been generated
+     */
+    evalResponse: function(response) {
+        var i18n = Lada.getApplication().bundle;
+        var r = '';
+            r += response.totalCount;
+            r += ' ' + i18n.getMsg('probecreated');
+            r += '<br/>';
+            r += i18n.getMsg('probeids');
+        var i;
+            for (i in response.data){
+                r += '<br/>';
+                r += response.data[i].probeIdAlt
+            }
+        return r;
+    }
 });
diff -r c135201940ee -r 3bc19188fc3a resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties	Fri May 22 15:59:40 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri May 22 16:14:14 2015 +0200
@@ -117,6 +117,7 @@
 ##
 # Msg:
 ##
+success:Erfolg
 err.msg.save.title:Fehler beim Speichern
 err.msg.delete.title:Fehler beim Löschen
 err.msg.generic.title:Fehler
@@ -126,7 +127,8 @@
 err.msg.novalidmessprogramm:Es wurd kein valides Messprogramm ausgewählt
 
 err.msg.deskriptorvalidation:Die Deskriptoren haben das falsche Format.<br />Richtig wäre: D: 99 99 99 99 99 99 99 99 99 99 99 99'
-
+probecreated:Probe(n) wurde(n) erzeugt.
+probeids:Die ID(s) der Probe(n) ist/sind:
 
 ##
 # Probenintervalle:


More information about the Lada-commits mailing list