dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28618
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14304: GIS, startup requests optimized.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 14304 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-19 19:42:40 +0100
message:
GIS, startup requests optimized.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.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-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-03-14 13:41:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-03-19 18:42:01 +0000
@@ -3043,11 +3043,14 @@
fields: ['id', 'name'],
proxy: {
type: 'ajax',
- url: gis.init.contextPath + gis.conf.finals.url.path_api + 'mapLegendSets.json?links=false&paging=false',
+ url: gis.init.contextPath + gis.conf.finals.url.path_api + 'mapLegendSets/filtered.json?include=id,name&paging=false',
reader: {
type: 'json',
- root: 'mapLegendSets'
- }
+ root: 'objects'
+ },
+ pageParam: false,
+ startParam: false,
+ limitParam: false
},
listeners: {
load: function(store, records) {
@@ -8580,19 +8583,35 @@
}
});
+ // organisation unit levels
+ requests.push({
+ url: init.contextPath + '/api/organisationUnitLevels/filtered.json?include=id,name,level&paging=false',
+ success: function(r) {
+ init.organisationUnitLevels = Ext.decode(r.responseText).objects || [];
+ fn();
+ }
+ });
+
// user orgunits and children
requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userOnly=true&viewClass=detailed&links=false',
+ url: init.contextPath + '/api/organisationUnits/filtered.json?userOnly=true&include=id,name,children[id,name]&paging=false',
success: function(r) {
- var organisationUnits = Ext.decode(r.responseText).organisationUnits || [];
+ var organisationUnits = Ext.decode(r.responseText).objects || [],
+ ou = [],
+ ouc = [];
if (organisationUnits.length) {
- var ou = organisationUnits[0];
-
- if (ou.id) {
- init.user.ou = ou.id;
- init.user.ouc = ou.children ? Ext.Array.pluck(ou.children, 'id') : null;
- };
+ for (var i = 0, org; i < organisationUnits.length; i++) {
+ org = organisationUnits[i];
+
+ ou.push(org.id);
+ ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
+ }
+
+ init.user = {
+ ou: ou,
+ ouc: ouc
+ }
}
else {
alert('User is not assigned to any organisation units');
@@ -8611,29 +8630,20 @@
}
});
- // organisation unit levels
- requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?paging=false&links=false',
- success: function(r) {
- init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
- fn();
- }
- });
-
// indicator groups
requests.push({
- url: init.contextPath + '/api/indicatorGroups.json?links=false&paging=false',
+ url: init.contextPath + '/api/indicatorGroups/filtered.json?include=id,name&paging=false',
success: function(r) {
- init.indicatorGroups = Ext.decode(r.responseText).indicatorGroups || [];
+ init.indicatorGroups = Ext.decode(r.responseText).objects || [];
fn();
}
});
// data element groups
requests.push({
- url: init.contextPath + '/api/dataElementGroups.json?links=false&paging=false',
+ url: init.contextPath + '/api/dataElementGroups/filtered.json?include=id,name&paging=false',
success: function(r) {
- init.dataElementGroups = Ext.decode(r.responseText).dataElementGroups || [];
+ init.dataElementGroups = Ext.decode(r.responseText).objects || [];
fn();
}
});