dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42289
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21618: Analysis, aggregatable value types (wip).
------------------------------------------------------------
revno: 21618
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-01-06 14:15:57 +0100
message:
Analysis, aggregatable value types (wip).
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/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-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-12-29 16:07:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2016-01-06 13:15:57 +0000
@@ -4388,7 +4388,7 @@
}
else {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programStages[id,displayName|rename(name)],programIndicators[id,' + namePropertyUrl + '],programTrackedEntityAttributes[trackedEntityAttribute[id,' + namePropertyUrl + ',valueType,optionSet[id,displayName|rename(name)],legendSet[id,displayName|rename(name)]]]&paging=false',
+ url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programStages[id,displayName|rename(name)],programIndicators[id,' + namePropertyUrl + '],programTrackedEntityAttributes[trackedEntityAttribute[id,' + namePropertyUrl + ',valueType,confidential,optionSet[id,displayName|rename(name)],legendSet[id,displayName|rename(name)]]]&paging=false',
success: function(r) {
var program = Ext.decode(r.responseText).programs[0],
stages,
@@ -4404,10 +4404,11 @@
attributes = Ext.Array.pluck(program.programTrackedEntityAttributes, 'trackedEntityAttribute');
programIndicators = program.programIndicators;
- // mark as attribute
- for (var i = 0; i < attributes.length; i++) {
- attributes[i].isAttribute = true;
- }
+ // filter confidential, mark as attribute
+ attributes.filter(function(item) {
+ item.isAttribute = true;
+ return !item.confidential;
+ });
// attributes cache
if (Ext.isArray(attributes) && attributes.length) {
@@ -4415,9 +4416,9 @@
}
// mark as program indicator
- for (var i = 0; i < programIndicators.length; i++) {
- programIndicators[i].isProgramIndicator = true;
- }
+ programIndicators.forEach(function(item) {
+ item.isProgramIndicator = true;
+ });
// program indicator cache
if (Ext.isArray(programIndicators) && programIndicators.length) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-12-29 16:07:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2016-01-06 13:15:57 +0000
@@ -4045,7 +4045,7 @@
}
else {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programStages[id,displayName|rename(name)],programIndicators[id,' + namePropertyUrl + '],programTrackedEntityAttributes[trackedEntityAttribute[id,' + namePropertyUrl + ',valueType,optionSet[id,displayName|rename(name)],legendSet[id,displayName|rename(name)]]]&paging=false',
+ url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programStages[id,displayName|rename(name)],programIndicators[id,' + namePropertyUrl + '],programTrackedEntityAttributes[trackedEntityAttribute[id,' + namePropertyUrl + ',valueType,confidential,optionSet[id,displayName|rename(name)],legendSet[id,displayName|rename(name)]]]&paging=false',
success: function(r) {
var program = Ext.decode(r.responseText).programs[0],
stages,
@@ -4061,10 +4061,11 @@
attributes = Ext.Array.pluck(program.programTrackedEntityAttributes, 'trackedEntityAttribute');
programIndicators = program.programIndicators;
- // mark as attribute
- for (var i = 0; i < attributes.length; i++) {
- attributes[i].isAttribute = true;
- }
+ // filter confidential, mark as attribute
+ attributes.filter(function(item) {
+ item.isAttribute = true;
+ return !item.confidential;
+ });
// attributes cache
if (Ext.isArray(attributes) && attributes.length) {
@@ -4072,15 +4073,15 @@
}
// mark as program indicator
- for (var i = 0; i < programIndicators.length; i++) {
- programIndicators[i].isProgramIndicator = true;
- }
+ programIndicators.forEach(function(item) {
+ item.isProgramIndicator = true;
+ });
// program indicator cache
if (Ext.isArray(programIndicators) && programIndicators.length) {
programIndicatorStorage[programId] = programIndicators;
}
-
+
if (Ext.isArray(stages) && stages.length) {
// stages cache
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-12-29 16:07:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2016-01-06 13:15:57 +0000
@@ -3074,6 +3074,7 @@
loadTotalsPage: function(uid, filter, append, noPaging, fn) {
var store = this,
params = {},
+ types = ns.core.conf.valueType.aAggregateTypes.join(','),
path;
if (store.nextPage === store.lastPage) {
@@ -3081,10 +3082,10 @@
}
if (Ext.isString(uid)) {
- path = '/dataElements.json?fields=dimensionItem|rename(id),' + namePropertyUrl + '&filter=dataElementGroups.id:eq:' + uid + (filter ? '&filter=' + nameProperty + ':ilike:' + filter : '');
+ path = '/dataElements.json?fields=dimensionItem|rename(id),' + namePropertyUrl + '&filter=valueType:in:[' + types + ']&filter=dataElementGroups.id:eq:' + uid + (filter ? '&filter=' + nameProperty + ':ilike:' + filter : '');
}
else if (uid === 0) {
- path = '/dataElements.json?fields=dimensionItem|rename(id),' + namePropertyUrl + '&filter=domainType:eq:AGGREGATE' + '' + (filter ? '&filter=' + nameProperty + ':ilike:' + filter : '');
+ path = '/dataElements.json?fields=dimensionItem|rename(id),' + namePropertyUrl + '&filter=valueType:in:[' + types + ']&filter=domainType:eq:AGGREGATE' + '' + (filter ? '&filter=' + nameProperty + ':ilike:' + filter : '');
}
if (!path) {
@@ -4443,24 +4444,21 @@
onProgramIndicatorProgramSelect(programId, true);
}
+ var types = ns.core.conf.valueType.tAggregateTypes.join(',');
+
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/programDataElements.json?program=' + programId + '&fields=dimensionItem|rename(id),name,valueType&paging=false',
+ url: ns.core.init.contextPath + '/api/programDataElements.json?program=' + programId + '&filter=valueType:in:[' + types + ']&fields=dimensionItem|rename(id),name,valueType&paging=false',
disableCaching: false,
success: function(r) {
- var types = ns.core.conf.valueType.aggregateTypes,
- elements = Ext.decode(r.responseText).programDataElements.filter(function(item) {
- return Ext.Array.contains(types, (item || {}).valueType);
- }),
+ var elements = Ext.decode(r.responseText).programDataElements,
isA = Ext.isArray,
isO = Ext.isObject;
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&fields=programTrackedEntityAttributes[dimensionItem|rename(id),' + namePropertyUrl + '|rename(name),valueType]&paging=false',
+ url: ns.core.init.contextPath + '/api/programs.json?filter=id:eq:' + programId + '&filter=programTrackedEntityAttributes.valueType:in:[' + types + ']&fields=programTrackedEntityAttributes[dimensionItem|rename(id),' + namePropertyUrl + '|rename(name),valueType]&paging=false',
disableCaching: false,
success: function(r) {
- var attributes = ((Ext.decode(r.responseText).programs[0] || {}).programTrackedEntityAttributes || []).filter(function(item) {
- return Ext.Array.contains(types, (item || {}).valueType);
- }),
+ var attributes = (Ext.decode(r.responseText).programs[0] || {}).programTrackedEntityAttributes || [],
data = ns.core.support.prototype.array.sort(Ext.Array.clean([].concat(elements, attributes))) || [];
if (data) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-12-29 16:35:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2016-01-06 13:15:57 +0000
@@ -201,7 +201,9 @@
textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
booleanTypes: ['BOOLEAN','TRUE_ONLY'],
dateTypes: ['DATE','DATETIME'],
- aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ aAggregateTypes: ['BOOLEAN', 'TRUE_ONLY', 'TEXT', 'LONG_TEXT', 'LETTER', 'INTEGER', 'INTEGER_POSITIVE', 'INTEGER_NEGATIVE', 'INTEGER_ZERO_OR_POSITIVE', 'NUMBER', 'UNIT_INTERVAL', 'PERCENTAGE', 'COORDINATE'],
+ tAggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+
};
conf.layout = {