dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21422
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10138: (PT) Error handling for server requests.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 10138 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-03-11 16:27:49 +0100
message:
(PT) Error handling for server requests.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-03-11 15:05:14 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-03-11 15:27:07 +0000
@@ -965,7 +965,7 @@
validateUrl = function(url) {
if (!Ext.isString(url) || url.length > 2000) {
var percent = ((url.length - 2000) / url.length) * 100;
- alert('Too many parameters selected. Please reduce the number of parameters by minimum ' + percent.toFixed(0) + '%');
+ alert('Too many parameters selected. Please reduce the number of parameters by minimum ' + percent.toFixed(0) + '%.');
return;
}
@@ -1542,7 +1542,7 @@
xSettings = extendSettings(settings);
pt.paramString = getParamString(xSettings);
- url = pt.init.contextPath + '/api/analytics.jsonp' + pt.paramString;
+ url = pt.init.contextPath + '/api/analytics.json' + pt.paramString;
if (!validateUrl(url)) {
return;
@@ -1550,7 +1550,7 @@
pt.util.mask.showMask(pt.viewport);
- Ext.data.JsonP.request({
+ Ext.Ajax.request({
method: 'GET',
url: url,
callbackName: 'analytics',
@@ -1560,12 +1560,13 @@
'Accept': 'application/json'
},
disableCaching: false,
- failure: function() {
+ failure: function(r) {
pt.util.mask.hideMask();
- alert('Data request failed');
+ alert(r.responseText);
},
- success: function(response) {
- var html;
+ success: function(r) {
+ var html,
+ response = Ext.decode(r.responseText);
if (!validateResponse(response)) {
pt.util.mask.hideMask();
@@ -1611,11 +1612,16 @@
return;
}
- Ext.data.JsonP.request({
+ Ext.Ajax.request({
url: pt.baseUrl + '/api/reportTables/' + id + '.jsonp?links=false',
method: 'GET',
+ failure: function(r) {
+ pt.util.mask.hideMask();
+ alert(r.responseText);
+ },
success: function(r) {
- pt.viewport.setFavorite(r);
+ var response = Ext.decode(r.responseText);
+ pt.viewport.setFavorite(response);
}
});
}