Commit 8cfd157e authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Permite un máximo de parámetros a graficar

Si el número de elementos en la selección es superior al máximo
permitido, se avisa al usuario y se usan los n primeros elementos.
parent 695c4d17
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -931,6 +931,7 @@ define({

	, "cannotShowDataWithEmptySelection": "Debe seleccionar al menos un elemento antes de mostrar sus datos asociados"
	, "canShowDataWithSelectionAvailable": "Ahora puede mostrar los datos asociados a los elementos seleccionados"
	, "cannotGetDataWithTooBigSelection": "Demasiados elementos seleccionados, mostrando sólo los primeros seleccionados"

	, "groupedBy": "Agrupado por"
	, "dataSelector": "Agrupación"
+1 −0
Original line number Diff line number Diff line
@@ -936,6 +936,7 @@ define({

		, "cannotShowDataWithEmptySelection": "You must select at least one item before displaying its associated data"
		, "canShowDataWithSelectionAvailable": "Now you can display data associated to selected items"
		, "cannotGetDataWithTooBigSelection": "Too many items selected, showing data only for the first selected"

		, "groupedBy": "Grouped by"
		, "dataSelector": "Group"
+31 −9
Original line number Diff line number Diff line
define([
	"app/viewers/views/_SeriesSelectionManagement"
	'alertify/alertify.min'
	, "app/viewers/views/_SeriesSelectionManagement"
	, "app/viewers/views/_TimeSeriesDataManagement"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "redmic/modules/base/_Selection"
], function(
	_SeriesSelectionManagement
	alertify
	, _SeriesSelectionManagement
	, _TimeSeriesDataManagement
	, declare
	, lang
@@ -24,15 +26,24 @@ define([
			this.config = {
				_selected: {},
				_insertedInTimeSeriesData: {},
				pathSeparator: "."
				pathSeparator: '.',
				maxParams: 10
			};

			lang.mixin(this, this.config);

			aspect.after(this, '_setOwnCallbacksForEvents', lang.hitch(this,
				this._setTimeSeriesSelectionManagementOwnCallbacksForEvents));

			aspect.before(this, "_select", lang.hitch(this, this._selectTimeSeriesSelectionManagement));
			aspect.before(this, "_deselect", lang.hitch(this, this._deselectTimeSeriesSelectionManagement));
		},

		_setTimeSeriesSelectionManagementOwnCallbacksForEvents: function() {

			this._onEvt('HIDE', lang.hitch(this, this._onTimeSeriesSelectionManagementHidden));
		},

		postCreate: function() {

			this.inherited(arguments);
@@ -43,21 +54,29 @@ define([
		_selectTimeSeriesSelectionManagement: function(path) {

			this._selected[path] = true;
			this._insertedInTimeSeriesData = {};
		},

		_deselectTimeSeriesSelectionManagement: function(path) {

			delete this._selected[path];
			this._insertedInTimeSeriesData = {};
			delete this._insertedInTimeSeriesData[path];
		},

		_generateTimeSeriesData: function() {

			this._clear();

			for (var path in this._selected) {
				if (path.split(".").length > 2) {
			var selectedKeys = Object.keys(this._selected),
				selectedCount = selectedKeys.length;

			if (selectedCount > this.maxParams) {
				this._selectionTooBigAlertify = alertify.message(this.i18n.cannotGetDataWithTooBigSelection, 0);
				selectedCount = this.maxParams;
			}

			for (var i = 0; i < selectedCount; i++) {
				var path = selectedKeys[i];
				if (path.split(this.pathSeparator).length > 2) {
					this._insertItemInDataChart(path);
				}
			}
@@ -66,7 +85,6 @@ define([
		_insertItemInDataChart: function(path) {

			if (this._indexDataList[path] !== undefined && !this._insertedInTimeSeriesData[path]) {

				this._updateDataChart = true;
				this._insertedInTimeSeriesData[path] = true;

@@ -92,7 +110,6 @@ define([
				dataDefinitions = item.dataDefinitions;

			for (var n = 0; n < dataDefinitions.length; n++) {

				if (!ids[dataDefinitions[n].z]) {
					ids[dataDefinitions[n].z] = [];
				}
@@ -121,6 +138,11 @@ define([
			this._insertedInTimeSeriesData = {};

			this.inherited(arguments);
		},

		_onTimeSeriesSelectionManagementHidden: function() {

			this._selectionTooBigAlertify && this._selectionTooBigAlertify.dismiss();
		}
	});
});