Commit 09301965 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Aplica queryParams iniciales de capas de mapa

Aunque un componente de capa tenga desconectado su canal de petición de
datos, ahora es capaz de añadir sus parámetros de consulta iniciales
(asignados en su construcción y/o por defecto) a través del componente
global RestManager, sin necesidad de realizar la petición.

Retoca configuraciones antiguas de speciesDistribution y corrige
sintaxis.
parent a8503691
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -18,14 +18,14 @@ define([

		// _requestParams: Object
		//   Contiene los parámetros recibidos para las URLs de consulta, indexados por channel y target.
		// _queryModelsByTarget: Object
		// _queryModels: Object
		//   Contiene las instancias de los modelos con esquema de paŕametros de consulta, indexados por target.

		postMixInProperties: function() {

			const defaultConfig = {
				_requestParams: {},
				_queryModelsByTarget: {}
				_queryModels: {}
			};

			this._mergeOwnAttributes(defaultConfig);
@@ -141,7 +141,7 @@ define([

		_getQueryModel: function(target, queryParams) {

			const modelInstance = this._queryModelsByTarget[target] ?? this._createQueryModel(target);
			const modelInstance = this._queryModels[target] ?? this._createQueryModel(target);

			this._publish(modelInstance.getChannel('DESERIALIZE'), {
				data: queryParams
@@ -160,7 +160,9 @@ define([
				}
			};

			return this._queryModelsByTarget[target] = new ModelImpl(this.modelConfig);
			this._queryModels[target] = new ModelImpl(this.modelConfig);

			return this._queryModels[target];
		}
	});
});
+8 −7
Original line number Diff line number Diff line
@@ -29,17 +29,18 @@ define([

		_addDefaultRequestParams: function() {

			const path = this._merge([{
			}, this.targetPathParams ?? {}]);

			const query = this._merge([{
				// TODO realmente se quiere evitar límites? puede causar fallos en el lado del servicio
				// preferible mostrar aviso si se llega al límite
			const query = {
				size: null
			};
			}, this.targetQueryParams ?? {}]);

			this._emitEvt('ADD_REQUEST_PARAMS', {
				target: this.target,
				params: {
					query
				}
				params: {path, query}
			});
		},

+4 −16
Original line number Diff line number Diff line
@@ -269,17 +269,8 @@ define([
			this.pruneClusterLayerConfig = this._merge([{
				parentChannel: this.getChannel(),
				target: redmicConfig.services.citationAll,
				filterConfig: {
					initQuery: {
						returnFields: ["geometry", "id", "uuid", "properties.collect.radius"]/*,
						terms: {
							precision: this.precision
						},
						z: {
							min: -5000,
							max: 5000
						}*/
					}
				targetQueryParams: {
					returnFields: ["geometry", "id", "uuid", "properties.collect.radius"]
				},
				categoryStyle: "bubbles",
				idProperty: "uuid",
@@ -688,13 +679,10 @@ define([
		_changePrecisionSlider: function(value) {

			const targetQueryParams = {
				/*terms: {
					selection: this.selection
				},*/
				precision: value
			};

			this._publish(this.pruneClusterLayer.getChannel('SET_PROPS'), {targetQueryParams});
			this._emitEvt('SET_MARKER_LAYER_PROPS', {targetQueryParams});
		},

		_changeZSlider: function(value) {
@@ -703,7 +691,7 @@ define([
				z: value
			};

			this._publish(this.pruneClusterLayer.getChannel('SET_PROPS'), {targetQueryParams});
			this._emitEvt('SET_MARKER_LAYER_PROPS', {targetQueryParams});
		},

		_hideInputForm: function(inputKey, hide) {