← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17471: DV dimension/item feedback improved.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17471 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-11-14 14:02:46 +0100
message:
  DV dimension/item feedback improved.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/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-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2014-11-13 15:47:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2014-11-14 13:00:32 +0000
@@ -2204,6 +2204,8 @@
 					config = ns.app.optionsWindow.getOptions(),
 					dx = dimConf.data.dimensionName,
 					co = dimConf.category.dimensionName,
+                    pe = dimConf.period.dimensionName,
+                    ou = dimConf.organisationUnit.dimensionName,
 					nameDimArrayMap = {};
 
                 config.type = ns.app.viewport.chartType.getChartType();
@@ -2228,6 +2230,9 @@
 					nameDimArrayMap[dimConf.dataSet.objectName] || []
 				));
 
+                nameDimArrayMap[pe] = nameDimArrayMap[pe] || [];
+                nameDimArrayMap[ou] = nameDimArrayMap[ou] || [];
+
 				// columns, rows, filters
 				for (var i = 0, nameArrays = [columnDimNames, rowDimNames, filterDimNames], axes = [config.columns, config.rows, config.filters], dimNames; i < nameArrays.length; i++) {
 					dimNames = nameArrays[i];
@@ -2247,16 +2252,24 @@
 							}
 						}
 						else if (nameDimArrayMap.hasOwnProperty(dimName) && nameDimArrayMap[dimName]) {
-							for (var k = 0; k < nameDimArrayMap[dimName].length; k++) {
-								axes[i].push(Ext.clone(nameDimArrayMap[dimName][k]));
-							}
+                            if (nameDimArrayMap[dimName].length) {
+                                for (var k = 0; k < nameDimArrayMap[dimName].length; k++) {
+                                    axes[i].push(Ext.clone(nameDimArrayMap[dimName][k]));
+                                }
+                            }
+                            else {
+                                axes[i].push({
+                                    dimension: dimName,
+                                    items: []
+                                });
+                            }
 						}
 					}
 				}
 
                 config.columns = columnDimNames.length ? config.columns : null;
-                config.rows = rowDimNames ? config.rows : null;
-                config.filters = filterDimNames ? config.filters : null;
+                config.rows = rowDimNames.length ? config.rows : null;
+                config.filters = filterDimNames.length ? config.filters : null;
 
 				return config;
             };

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2014-11-13 15:47:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js	2014-11-14 13:00:32 +0000
@@ -541,7 +541,9 @@
 
                 return function() {
                     var objectNames = [],
-						dimConf = conf.finals.dimension;
+						dimConf = conf.finals.dimension,
+                        columnName,
+                        rowName;
 
 					// config must be an object
 					if (!(config && Ext.isObject(config))) {
@@ -551,27 +553,30 @@
 
 					// check dimensions: null means no dimension in layout
 					if (!config.columns) {
-						alert('No series dimension selected. Please go to Layout and add a dimension to the Series area.');
+						alert('No series dimension selected.\n\nPlease go to Layout and add a dimension to the Series area.\n\nTo make more dimensions available in Layout please select dimension items in the left menu.');
 						return;
 					}
 
 					if (!config.rows) {
-						alert('No category dimension selected. Please go to Layout and add a dimension to the Category area.');
+						alert('No category dimension selected.\n\nPlease go to Layout and add a dimension to the Category area.\n\nTo make more dimensions available in Layout please select dimension items in the left menu.');
 						return;
 					}
 
+                    columnName = config.columns.length ? dimConf.objectNameMap[config.columns[0].dimension].name : null;
+                    rowName = config.rows.length ? dimConf.objectNameMap[config.rows[0].dimension].name : null;
+
                     config.columns = getValidatedDimensionArray(config.columns);
                     config.rows = getValidatedDimensionArray(config.rows);
                     config.filters = getValidatedDimensionArray(config.filters);
 
 					// at least one dimension specified as column and row
 					if (!config.columns) {
-						alert('No series items selected');
+						alert('No series items selected.\n\nPlease select at least one item in the left menu' + (columnName ? ' (' + columnName + ').' : '.'));
 						return;
 					}
 
 					if (!config.rows) {
-						alert('No category items selected');
+						alert('No category items selected.\n\nPlease select at least one item in the left menu' + (rowName ? ' (' + rowName + ').' : '.'));
 						return;
 					}