Commit 292dabd8 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Permite actualizar el canal de filtro de widgets

En lugar de retrasar la creación de los módulos que intervienen en la
búsqueda de inicio, se controla su actualización.
parent 6f0e61db
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -152,10 +152,14 @@ define([

		_showSearchResults: function(searchDefinition) {

			this._publish(this._widgets.searchFastFilter.getChannel('SET_PROPS'), {
			var obj = {
				target: searchDefinition.target,
				queryChannel: searchDefinition.queryChannel
			});
			};

			this._publish(this._widgets.searchResults.getChannel('SET_PROPS'), obj);
			this._publish(this._widgets.searchFastFilter.getChannel('SET_PROPS'), obj);
			this._publish(this._widgets.searchFilter.getChannel('SET_PROPS'), obj);

			this._showWidget('searchFastFilter');
			this._showWidget('searchResults');
+22 −12
Original line number Diff line number Diff line
define([
	'app/home/views/_DashboardItem'
	, 'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'put-selector/put'
@@ -10,7 +9,6 @@ define([
	, 'redmic/modules/search/FacetsImpl'
], function(
	_DashboardItem
	, redmicConfig
	, declare
	, lang
	, put
@@ -28,34 +26,30 @@ define([

			this.config = {
				ownChannel: 'searchFastFilterWidget',
				target: redmicConfig.services.activity,
				className: 'facets'
			};

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

		_createModules: function() {
		_initialize: function() {

			this.facetsSearchConfig = this._merge([{
				parentChannel: this.getChannel(),
				queryChannel: this.queryChannel,
				aggs: {
					"activityType": {
						"open": true,
						"terms": {
							"field": "activityType.name",
							"size": 100
							"field": "activityType.name"
						}
					},
					"territorialScope": {
						"terms": {
							"field": "scope.name",
							"size": 20
							"field": "scope.name"
						}
					}
				}
			}, this.compositeSearchConfig || {}]);
			}, this.facetsSearchConfig || {}]);

			this.facetsSearch = new FacetsImpl(this.facetsSearchConfig);
		},
@@ -66,13 +60,29 @@ define([
				return;
			}

			this._createModules();

			var facetsSearchNode = put(this.domNode, 'div.' + this.className);

			this._publish(this.facetsSearch.getChannel("SHOW"), {
				node: facetsSearchNode
			});
		},

		_onTargetPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_onQueryChannelPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_setPropToChildModules: function(prop, value) {

			this._publish(this.facetsSearch.getChannel('DESTROY'));

			this.facetsSearchConfig[prop] = value;
			this.facetsSearch = new FacetsImpl(this.facetsSearchConfig);
		}
	});
});
+20 −8
Original line number Diff line number Diff line
define([
	'app/home/views/_DashboardItem'
	, 'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'put-selector/put'
@@ -10,7 +9,6 @@ define([
	, 'redmic/modules/search/CompositeImpl'
], function(
	_DashboardItem
	, redmicConfig
	, declare
	, lang
	, put
@@ -28,18 +26,16 @@ define([

			this.config = {
				ownChannel: 'searchFilterWidget',
				target: redmicConfig.services.activity,
				className: 'composite'
			};

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

		_createModules: function() {
		_initialize: function() {

			this.compositeSearchConfig = this._merge([{
				parentChannel: this.getChannel(),
				filterChannel: this.queryChannel
				parentChannel: this.getChannel()
			}, this.compositeSearchConfig || {}]);

			this.compositeSearch = new CompositeImpl(this.compositeSearchConfig);
@@ -51,13 +47,29 @@ define([
				return;
			}

			this._createModules();

			var compositeSearchNode = put(this.domNode, 'div.' + this.className);

			this._publish(this.compositeSearch.getChannel("SHOW"), {
				node: compositeSearchNode
			});
		},

		_onTargetPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_onQueryChannelPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_setPropToChildModules: function(prop, value) {

			var obj = {};
			obj[prop] = value;

			this._publish(this.compositeSearch.getChannel('SET_PROPS'), obj);
		}
	});
});
+19 −3
Original line number Diff line number Diff line
@@ -42,12 +42,11 @@ define([
			lang.mixin(this, this.config, args);
		},

		_createModules: function() {
		_initialize: function() {

			this.browserConfig = this._merge([{
				parentChannel: this.getChannel(),
				target: this.target,
				queryChannel: this.queryChannel,
				template: ActivityList,
				bars: [{
					instance: Total
@@ -79,7 +78,6 @@ define([
		_afterShow: function() {

			if (!this._getPreviouslyShown()) {
				this._createModules();
				// TODO retocar contenedores de por encima, igual no extender de la base de ahora
				put(this.containerNode, '.flex');
				this._browserNode = put(this.containerNode, 'div.' + this.className);
@@ -90,6 +88,24 @@ define([
			});
		},

		_onTargetPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_onQueryChannelPropSet: function(evt) {

			this._setPropToChildModules(evt.prop, evt.value);
		},

		_setPropToChildModules: function(prop, value) {

			var obj = {};
			obj[prop] = value;

			this._publish(this.browser.getChannel('SET_PROPS'), obj);
		},

		_subClearData: function(req) {

			this._publish(this.browser.getChannel("CLEAR"));
+5 −0
Original line number Diff line number Diff line
@@ -138,6 +138,11 @@ define([
			this._connectToFilter(obj.value);
		},

		_onQueryChannelPropSet: function(evt) {

			this._onQueryChannelUpdated(evt);
		},

		_disconnectFromFilter: function(oldQueryChannel) {

			this._removeSubscriptions([
Loading