Commit 91f1e157 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Refactoriza y corrige manejo de config

Mejora la gestión de configuración externa, aprovechando el ciclo de
vida sin sobrecargar con aspect.

Retoca consumidores de config externa para respetar la herencia del
ciclo de vida.

Corrige carga de capas wms en SpeciesDistribution y carga de sitio
externo en RasterCatalog.
parent e0eb6abd
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
define([
	'src/redmicConfig'
	, 'dojo/_base/declare'
	'dojo/_base/declare'
	, 'src/app/component/request/_RestManagerItfc'
	, 'src/component/base/_Module'
], function(
	redmicConfig
	, declare
	declare
	, _RestManagerItfc
	, _Module
) {
+8 −6
Original line number Diff line number Diff line
@@ -2,12 +2,10 @@ define([
	'app/designs/embeddedContent/Controller'
	, 'app/designs/embeddedContent/Layout'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
], function(
	EmbeddedContentController
	, EmbeddedContentLayout
	, declare
	, lang
) {

	return declare([EmbeddedContentLayout, EmbeddedContentController], {
@@ -16,19 +14,23 @@ define([
		//	description:
		//		Permite integrar la herramienta externa STAC Browser como contenido incrustado.

		constructor: function(args) {
		postMixInProperties: function() {

			this.config = {
			const defaultConfig = {
				embeddedContentUrl: null,
				embeddedContentUrlPropertyName: 'rasterCatalogViewEmbeddedContentUrl'
			};

			lang.mixin(this, this.config, args);
			this._mergeOwnAttributes(defaultConfig);

			this.inherited(arguments);
		},

		_setOwnCallbacksForEvents: function() {

			this._onEvt('GOT_EXTERNAL_CONFIG', lang.hitch(this._onGotExternalConfig));
			this.inherited(arguments);

			this._onEvt('GOT_EXTERNAL_CONFIG', evt => this._onGotExternalConfig(evt));
		},

		postCreate: function() {
+18 −33
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'RWidgets/Utilities'
], function(
	declare
	, lang
	, aspect
	, Utilities
) {

@@ -14,52 +10,39 @@ define([
		// summary:
		//   Permite a los módulos obtener configuraciones externas.

		constructor: function(args) {
		postMixInProperties: function() {

			this.config = {
				externalConfigEvents: {
			const defaultConfig = {
				events: {
					GET_EXTERNAL_CONFIG: 'getExternalConfig',
					GOT_EXTERNAL_CONFIG: 'gotExternalConfig'
				},

				externalConfigActions: {
				actions: {
					GOT_EXTERNAL_CONFIG: 'gotExternalConfig',
					REQUEST_FAILED: 'requestFailed'
				}
			};

			lang.mixin(this, this.config, args);

			aspect.after(this, '_mixEventsAndActions', lang.hitch(this, this._mixExternalConfigEventsAndActions));
			aspect.after(this, '_defineSubscriptions',
				lang.hitch(this, this._defineExternalConfigSubscriptions));
			this._mergeOwnAttributes(defaultConfig);

			aspect.after(this, '_definePublications',
				lang.hitch(this, this._defineExternalConfigPublications));

			aspect.before(this, '_setOwnCallbacksForEvents',
				lang.hitch(this, this._setExternalConfigOwnCallbacksForEvents));
			this.inherited(arguments);
		},

		_mixExternalConfigEventsAndActions: function() {
		_defineSubscriptions: function() {

			lang.mixin(this.events, this.externalConfigEvents);
			lang.mixin(this.actions, this.externalConfigActions);
			delete this.externalConfigEvents;
			delete this.externalConfigActions;
		},

		_defineExternalConfigSubscriptions: function() {
			this.inherited(arguments);

			this.subscriptionsConfig.push({
				channel: this._buildChannel(this.externalConfigChannel, this.actions.REQUEST_FAILED),
				channel: this._buildChannel(this.externalConfigChannel, 'REQUEST_FAILED'),
				callback: '_subExternalConfigRequestFailed'
			});

			this._deleteDuplicatedChannels(this.subscriptionsConfig);
		},

		_defineExternalConfigPublications: function() {
		_definePublications: function() {

			this.inherited(arguments);

			this.publicationsConfig.push({
				event: 'GOT_EXTERNAL_CONFIG',
@@ -69,9 +52,11 @@ define([
			this._deleteDuplicatedChannels(this.publicationsConfig);
		},

		_setExternalConfigOwnCallbacksForEvents: function() {
		_setOwnCallbacksForEvents: function() {

			this.inherited(arguments);

			this._onEvt('GET_EXTERNAL_CONFIG', lang.hitch(this, this._onGetExternalConfigEvt));
			this._onEvt('GET_EXTERNAL_CONFIG', evt => this._onGetExternalConfigEvt(evt));
		},

		_onGetExternalConfigEvt: function(evt) {
+6 −0
Original line number Diff line number Diff line
@@ -36,11 +36,15 @@ define([

		_setOwnCallbacksForEvents: function() {

			this.inherited(arguments);

			this._onEvt('GOT_EXTERNAL_CONFIG', lang.hitch(this._onGotExternalConfig));
		},

		_defineSubscriptions: function() {

			this.inherited(arguments);

			this.subscriptionsConfig.push({
				channel : this.getChannel('GET_WIDGETS_CONFIG'),
				callback: '_subGetWidgetsConfig'
@@ -49,6 +53,8 @@ define([

		_definePublications: function() {

			this.inherited(arguments);

			this.publicationsConfig.push({
				event: 'GOT_WIDGET_CONFIG',
				channel: this.getChannel('GOT_WIDGET_CONFIG')
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ define([

		_setOwnCallbacksForEvents: function() {

			this.inherited(arguments);

			this._onEvt('PAN', lang.hitch(this, function(evt) {

				if (!this._anyPopupOpened) {
Loading