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

Permite filtrado por texto en Atlas

Adapta Filter y componentes asociados para que no consulten
directamente, sino que se recoja el filtro resultante para su uso (y que
sea otro quien haga la consulta).
parent 07a1b2d3
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -34,11 +34,14 @@ define([
				atlasSuggestFields = ['title', 'alias', 'keywords'];

			this.textSearchConfig = this._merge([{
				target: this._atlasDataTarget,
				highlightField: atlasSearchFields,
				suggestFields: atlasSuggestFields,
				searchFields: atlasSearchFields
			}, this.textSearchConfig || {}]);

			this.filterConfig = this._merge([{
				serializeOnQueryUpdate: false
			}, this.filterConfig || {}]);
		},

		_initializeMain: function() {
@@ -53,7 +56,12 @@ define([

		_requestAtlasDataOnRefresh: function() {

			this._publish(this._atlasData.getChannel('REQUEST_TO_TARGETS'));
			this._requestAtlasData();
		},

		_requestAtlasData: function(queryObj) {

			this._publish(this._atlasData.getChannel('REQUEST_TO_TARGETS'), queryObj || {});
		},

		postCreate: function() {
@@ -61,6 +69,14 @@ define([
			this.inherited(arguments);

			this._emitEvt('REFRESH');
		},

		_handleFilterParams: function(filterParams) {

			this._requestAtlasData({
				target: this.target,
				queryParams: filterParams
			});
		}
	});
});
+23 −8
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ define([
	, Filter
	, _FilterItfc
) {

	return declare(_FilterItfc, {
		//	summary:
		//
@@ -32,7 +33,6 @@ define([
			aspect.before(this, "_afterSetConfigurations", lang.hitch(this, this._setFilterConfigurations));
			aspect.before(this, "_beforeInitialize", lang.hitch(this, this._initializeFilter));
			aspect.after(this, "_defineSubscriptions", lang.hitch(this, this._defineFilterSubscriptions));
			aspect.after(this, "_definePublications", lang.hitch(this, this._defineDefaultFilterPublications));
			aspect.after(this, "_definePublications", lang.hitch(this, this._defineFilterPublications));
		},

@@ -48,12 +48,20 @@ define([
		_setFilterConfigurations: function() {

			this.filterConfig = this._merge([{
				target: this.target,
				parentChannel: this.getChannel()
				parentChannel: this.getChannel(),
				target: this.target
			}, this.filterConfig || {}]);
		},

		_defineDefaultFilterPublications: function() {
		_defineFilterSubscriptions: function() {

			this.subscriptionsConfig.push({
				channel: this.filter.getChannel('SERIALIZED'),
				callback: '_subFilterSerialized'
			});
		},

		_defineFilterPublications: function() {

			this.publicationsConfig.push({
				event: 'ADD_TO_QUERY',
@@ -75,7 +83,13 @@ define([
			this._setQueryChannelInModules();
		},

		_subFilterSerialized: function(res) {

			this._handleFilterParams(res.data);
		},

		_subUpdateTarget: function(obj) {
			// TODO no estoy seguro de la necesidad de pisar este método, ademas puede que se repitan acciones

			this.inherited(arguments);

@@ -83,6 +97,7 @@ define([
		},

		_updateTarget: function(obj) {
			// TODO no estoy seguro de la necesidad de pisar este método, ademas puede que se repitan acciones

			this.inherited(arguments);

+2 −3
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@ define([
		_getMethodsToImplement: function() {

			return lang.mixin(this.inherited(arguments), {
				"_defineFilterSubscriptions": {},
				"_defineFilterPublications": {},
				"_setQueryChannelInModules": {}
				"_setQueryChannelInModules": {},
				"_handleFilterParams": {}
			});
		}
	});
+3 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ define([
		constructor: function(args) {

			this.config = {
				ownChannel: "filter",
				events: {
					ADD_TO_QUERY: "addToQuery",
					AVAILABLE_FACETS: "availableFacets",
@@ -51,7 +52,7 @@ define([
				_pendingAddToQuery: null,
				target: null,
				refreshToInit: false,
				ownChannel: "filter"
				serializeOnQueryUpdate: true
			};

			lang.mixin(this, this.config, args);
@@ -311,7 +312,7 @@ define([

			this._lastRequest = this._getRequestObj(req.data);

			this._emitEvt('REQUEST', this._lastRequest);
			this.serializeOnQueryUpdate && this._emitEvt('REQUEST', this._lastRequest);
		},

		_subRefresh: function(req) {
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ define([
				parentChannel: this.getChannel(),
				browserExts: [_HierarchicalSelect],
				selectionTarget: this.selectionTarget,
				target: this.target,
				perms: this.perms,
				buttonsInTopZone: true,
				buttons: {
Loading