dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28615
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14301: PT, startup requests optimized.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 14301 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-19 18:58:59 +0100
message:
PT, startup requests optimized.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
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/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-02-27 11:37:20 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-03-19 17:54:19 +0000
@@ -2558,10 +2558,10 @@
fields: ['id', 'name', 'index'],
proxy: {
type: 'ajax',
- url: ns.core.init.contextPath + '/api/indicatorGroups.json?paging=false&links=false',
+ url: ns.core.init.contextPath + '/api/indicatorGroups/filtered.json?include=id,name&paging=false',
reader: {
type: 'json',
- root: 'indicatorGroups'
+ root: 'objects'
}
},
listeners: {
@@ -5771,29 +5771,33 @@
// organisation unit levels
requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?paging=false&links=false',
+ url: init.contextPath + '/api/organisationUnitLevels/filtered.json?include=id,name,level&paging=false',
success: function(r) {
- init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
+ 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');
@@ -5805,9 +5809,9 @@
// legend sets
requests.push({
- url: init.contextPath + '/api/mapLegendSets.json?viewClass=detailed&links=false&paging=false',
+ url: init.contextPath + '/api/mapLegendSets/filtered.json?include=id,name,mapLegends[id,name,startValue,endValue,color]&paging=false',
success: function(r) {
- init.legendSets = Ext.decode(r.responseText).mapLegendSets || [];
+ init.legendSets = Ext.decode(r.responseText).objects || [];
fn();
}
});
=== 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 2014-03-06 11:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2014-03-19 17:54:19 +0000
@@ -1115,10 +1115,14 @@
userOugc;
if (init.user && isUserOrgunit) {
- userOu = [{
- id: init.user.ou,
- name: service.layout.getItemName(xLayout, response, init.user.ou, false)
- }];
+ userOu = [];
+
+ for (var j = 0; j < init.user.ou.length; j++) {
+ userOu.push({
+ id: init.user.ou[j],
+ name: service.layout.getItemName(xLayout, response, init.user.ou[j], false)
+ });
+ }
}
if (init.user && init.user.ouc && isUserOrgunitChildren) {
userOuc = [];