← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21052: PT noext.

 

------------------------------------------------------------
revno: 21052
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-13 21:25:47 +0100
message:
  PT noext.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app2.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.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-apps/src/main/webapp/dhis-web-pivot/scripts/app2.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app2.js	2015-11-13 20:00:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app2.js	2015-11-13 20:25:47 +0000
@@ -95,7 +95,7 @@
                     'paging=false'
                 ],
                 success: function(r) {
-                    appManager.rootNodes = r.organisationUnits;
+                    appManager.addRootNodes(r.organisationUnits);
                     requestManager.ok(this);
                 }
             }));
@@ -108,7 +108,7 @@
                     'paging=false'
                 ],
                 success: function(r) {
-                    appManager.organisationUnitLevels = r.organisationUnitLevels;
+                    appManager.addOrganisationUnitLevels(r.organisationUnitLevels);
 
                     if (!r.organisationUnitLevels.length) {
                         alert('No organisation unit levels found');
@@ -126,7 +126,7 @@
                     'paging=false'
                 ],
                 success: function(r) {
-                    appManager.legendSets = r.legendSets;
+                    appManager.addLegendSets(r.legendSets);
                     requestManager.ok(this);
                 }
             }));
@@ -139,7 +139,7 @@
                     'paging=false'
                 ],
                 success: function(r) {
-                    appManager.dimensions = r.dimensions;
+                    appManager.addDimensions(r.dimensions);
                     requestManager.ok(this);
                 }
             }));
@@ -149,11 +149,11 @@
                 baseUrl: path + '/api/dataApprovalLevels.json',
                 params: [
                     'order=level:asc',
-                    'fields=id,' + displayProperty,
+                    'fields=id,' + displayProperty + ',level',
                     'paging=false'
                 ],
                 success: function(r) {
-                    appManager.dataApprovalLevels = r.dataApprovalLevels;
+                    appManager.addDataApprovalLevels(r.dataApprovalLevels);
                     requestManager.ok(this);
                 }
             }));

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-13 20:09:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-13 20:25:47 +0000
@@ -512,6 +512,32 @@
                 node.expanded = true;
                 node.path = '/' + t.rootId + '/' + node.id;
             });
+
+            t.rootNodes = N.arrayClean(t.rootNodes.concat(nodes));
+        };
+
+        AppManager.prototype.addOrganisationUnitLevels = function(param) {
+            this.organisationUnitLevels = N.arrayClean(this.organisationUnitLevels.concat(N.arrayFrom(param)));
+
+            N.arraySort(this.organisationUnitLevels, 'ASC', 'level');
+        };
+
+        AppManager.prototype.addLegendSets = function(param) {
+            this.legendSets = N.arrayClean(this.legendSets.concat(N.arrayFrom(param)));
+
+            N.arraySort(this.legendSets, 'ASC', 'name');
+        };
+
+        AppManager.prototype.addDimensions = function(param) {
+            this.dimensions = N.arrayClean(this.dimensions.concat(N.arrayFrom(param)));
+
+            N.arraySort(this.dimensions, 'ASC', 'name');
+        };
+
+        AppManager.prototype.addDataApprovalLevels = function(param) {
+            this.dataApprovalLevels = N.arrayClean(this.dataApprovalLevels.concat(N.arrayFrom(param)));
+
+            N.arraySort(this.dataApprovalLevels, 'ASC', 'level');
         };
 
         // dep 1