[Lada-commits] [PATCH] Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Wald Commits
scm-commit at wald.intevation.org
Tue Dec 6 14:04:12 CET 2016
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1481029437 -3600
# Node ID 52ecf67e9e80f32f2f404ed09cb071f42c074fa4
# Parent d19170280a23389035191ae439b5298feae9639a
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
diff -r d19170280a23 -r 52ecf67e9e80 app/controller/grid/ProbeList.js
--- a/app/controller/grid/ProbeList.js Thu Dec 01 14:55:31 2016 +0100
+++ b/app/controller/grid/ProbeList.js Tue Dec 06 14:03:57 2016 +0100
@@ -179,17 +179,52 @@
// ensure data and prep are equal, not sure
// if json.parse changes order of things
console.log(data);
+
+ emptyMessstelle = {
+ "id": null,
+ "amtskennung": null,
+ "beschreibung": null,
+ "messStelle": null,
+ "mstTyp": null,
+ "netzbetreiberId":null
+ };
+
+ emptyDeskriptor = {
+ "s0": null,
+ "s1": null,
+ "s2": null,
+ "s3": null,
+ "s4": null,
+ "s5": null,
+ "s6": null,
+ "s7": null,
+ "s8": null,
+ "s9": null,
+ "s10": null,
+ "s11": null
+ };
+
for (i in data) {
probe = data[i];
- console.log(probe);
deskriptoren = probe.deskriptoren;
messstelle = probe.messstelle;
- console.log(deskriptoren);
- console.log(messstelle);
- prep[i].messstelle = [];
- prep[i].messstelle[0] = messstelle;
- prep[i].deskriptoren = [];
- prep[i].deskriptoren[0] = deskriptoren;
+ if (messstelle != null) {
+ prep[i].messstelle = [];
+ prep[i].messstelle[0] = messstelle;
+ }
+ else {
+ prep[i].messstelle = [];
+ prep[i].messstelle[0] = emptyMessstelle;
+ }
+
+ if (deskriptoren != null) {
+ prep[i].deskriptoren = [];
+ prep[i].deskriptoren[0] = deskriptoren;
+ }
+ else {
+ prep[i].deskriptoren = [];
+ prep[i].deskriptoren[0] = emptyDeskriptor;
+ }
}
return JSON.stringify(prep);
},
@@ -252,16 +287,15 @@
},
/**
- * Returns a Json-Object whcih contains the data which has
+ * Returns a Json-Object which contains the data which has
* to be printed.
* The parameter printFunctionCallback will be called once the ajax-request
* starting the json-export was evaluated
**/
createSheetData: function(button, printFunctionCallback, cbscope){
//disable Button and setLoading...
- // TODO ACTIVATE!
- //button.disable();
- //button.setLoading(true);
+ button.disable();
+ button.setLoading(true);
// get Selected Items.
@@ -292,21 +326,14 @@
console.log(response.responseText)
button.enable();
button.setLoading(false);
- // This is "copy & waste-code" from downloadFile
- // FIXME
- /*
- SSO will send a 302 if the Client is not authenticated
- unfortunately this seems to be filtered by the browser.
- We assume that a 302 was send when the follwing statement
- is true.
- */
- if (response.status == 0 && response.responseText === "") {
- Ext.MessageBox.confirm(Lada.getApplication().bundle.getMsg('err.msg.sso.expired.title'),
- Lada.getApplication().bundle.getMsg('err.msg.sso.expired.body'),
- this.reload);
+ if (response.responseText) {
+ try {
+ var json = Ext.JSON.decode(response.responseText);
+ }
+ catch(e){
+ console.log(e);
+ }
}
- // further error handling
- var json = Ext.JSON.decode(response.responseText);
if (json) {
if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
formPanel.setMessages(json.errors, json.warnings);
@@ -317,20 +344,19 @@
Lada.getApplication().bundle.getMsg(json.message));
} else {
Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
- i18n.getMsg('err.msg.print.failed'));
+ i18n.getMsg('err.msg.response.body'));
}
} else {
Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
- i18n.getMsg('err.msg.print.failed'));
+ i18n.getMsg('err.msg.response.body'));
}
-
return null;
}
});
},
/**
- * Returns a Json-Object whcih contains the data which has
+ * Returns a Json-Object which contains the data which has
* to be printed.
**/
createExtractData: function(button){
More information about the Lada-commits
mailing list