dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34046
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17462: DV dimension/items issue, work in progress.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17462 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-11-13 16:48:18 +0100
message:
DV dimension/items issue, work in progress.
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-06 15:44:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2014-11-13 15:47:17 +0000
@@ -415,7 +415,7 @@
dimensionStore.removeAll();
if (!isAll) {
- colStore.add({id: dimConf.data.dimensionName, name: dimConf.data.name});
+ //colStore.add({id: dimConf.data.dimensionName, name: dimConf.data.name});
rowStore.add({id: dimConf.period.dimensionName, name: dimConf.period.name});
filterStore.add({id: dimConf.organisationUnit.dimensionName, name: dimConf.organisationUnit.name});
dimensionStore.add({id: dimConf.category.dimensionName, name: dimConf.category.name});
@@ -2254,6 +2254,10 @@
}
}
+ config.columns = columnDimNames.length ? config.columns : null;
+ config.rows = rowDimNames ? config.rows : null;
+ config.filters = filterDimNames ? config.filters : null;
+
return config;
};
@@ -2453,6 +2457,7 @@
organisationUnitGroupStore,
isScrolled,
+ onDataSelect,
indicatorLabel,
indicatorSearch,
indicatorFilter,
@@ -2780,7 +2785,18 @@
indicatorSelectedStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
- data: []
+ data: [],
+ listeners: {
+ add: function() {
+ onDataSelect();
+ },
+ remove: function() {
+ onDataSelect();
+ },
+ clear: function() {
+ onDataSelect();
+ }
+ }
});
ns.app.stores.indicatorSelected = indicatorSelectedStore;
@@ -2958,7 +2974,18 @@
dataElementSelectedStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
- data: []
+ data: [],
+ listeners: {
+ add: function() {
+ onDataSelect();
+ },
+ remove: function() {
+ onDataSelect();
+ },
+ clear: function() {
+ onDataSelect();
+ }
+ }
});
ns.app.stores.dataElementSelected = dataElementSelectedStore;
@@ -3065,7 +3092,18 @@
dataSetSelectedStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
- data: []
+ data: [],
+ listeners: {
+ add: function() {
+ onDataSelect();
+ },
+ remove: function() {
+ onDataSelect();
+ },
+ clear: function() {
+ onDataSelect();
+ }
+ }
});
ns.app.stores.dataSetSelected = dataSetSelectedStore;
@@ -3171,6 +3209,30 @@
return scrollBottom / el.scrollHeight > 0.9;
};
+ onDataSelect = function() {
+ var win = ns.app.layoutWindow,
+ stores = [indicatorSelectedStore, dataElementSelectedStore, dataSetSelectedStore],
+ dimension = dimConf.data,
+ hasItems;
+
+ hasItems = function(storeArray) {
+ for (var i = 0; i < storeArray.length; i++) {
+ if (storeArray[i].getRange().length) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ if (hasItems(stores)) {
+ win.addDimension({id: dimension.dimensionName, name: dimension.name});
+ }
+ else if (!hasItems(stores) && win.hasDimension(dimension.dimensionName)) {
+ win.removeDimension(dimension.dimensionName);
+ }
+ };
+
indicatorLabel = Ext.create('Ext.form.Label', {
text: NS.i18n.available,
cls: 'ns-toolbar-multiselect-left-label',
=== 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-10-29 14:29:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js 2014-11-13 15:47:17 +0000
@@ -549,6 +549,17 @@
return;
}
+ // 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.');
+ return;
+ }
+
+ if (!config.rows) {
+ alert('No category dimension selected. Please go to Layout and add a dimension to the Category area.');
+ return;
+ }
+
config.columns = getValidatedDimensionArray(config.columns);
config.rows = getValidatedDimensionArray(config.rows);
config.filters = getValidatedDimensionArray(config.filters);
@@ -2365,7 +2376,7 @@
legend = this.legend,
legendCenterX,
titleX;
-
+
if (this.legend.position === 'top') {
legendCenterX = legend.x + (legend.width / 2);
titleX = titleWidth ? legendCenterX - (titleWidth / 2) : titleXFallback;