Commit 53a94178 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Elimina módulo QueryStore, actualmente obsoleto

El único uso que seguía teniendo eran la petición de seleccionar todo y
la de invertir la selección, acciones que se van a eliminar (son muy
costosas y no aportan mucho).

Controla bug en persistencia de selección: cada vez que se construye el
target de consulta se añade al array de targets, sin control.
parent 60ede0c7
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ define([
	, 'redmic/modules/base/Selector'
	, 'redmic/modules/components/Sidebar/MainSidebarImpl'
	, 'redmic/modules/store/RestManagerImpl'
	, 'redmic/modules/store/QueryStore'
	, 'redmic/modules/notification/Notification'
	, 'redmic/modules/socket/_IngestData'
	, 'redmic/modules/socket/_Report'
@@ -31,7 +30,6 @@ define([
	, Selector
	, MainSidebarImpl
	, RestManagerImpl
	, QueryStore
	, Notification
	, _IngestData
	, _Report
@@ -179,10 +177,6 @@ define([
			//	tags:
			//		private

			new QueryStore({
				parentChannel: this.ownChannel
			});

			new RestManagerImpl({
				parentChannel: this.ownChannel
			});
@@ -306,7 +300,6 @@ define([
			this._publish(this._buildChannel(this.storeChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.selectorChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.managerChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.queryStoreChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.taskChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.socketChannel, this.actions.DESTROY));
			this._publish(this._buildChannel(this.notificationChannel, this.actions.DESTROY));
+0 −4
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ define([
			CREDENTIALS: "credentials",
			ANALYTICS: "analytics",
			MODULE_STORE: "moduleStore",
			QUERY_STORE: "queryStore",
			TASK: "task",
			NOTIFICATION: "notification",
			SOCKET: "socket",
@@ -147,8 +146,6 @@ define([

		//	storeChannel: String
		//		Nombre del canal por donde se van a recibir los datos.
		//	queryStoreChannel: String
		//		Nombre del canal por donde se van a recibir las querys aplicadas
		//	selectorChannel: String
		//		Nombre del canal por donde se van a seleccionar los items.
		//	managerChannel: String
@@ -192,7 +189,6 @@ define([
				credentialsChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.CREDENTIALS),
				analyticsChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.ANALYTICS),
				moduleStoreChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.MODULE_STORE),
				queryStoreChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.QUERY_STORE),
				taskChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.TASK),
				socketChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.SOCKET),
				metaTagsChannel: this._buildChannel(this.rootChannel, this.globalOwnChannels.META_TAGS),
+7 −52
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/when"
	, "dojo/aspect"
	, "redmic/modules/base/_Persistence"
	, "redmic/modules/base/_Store"
	, "redmic/base/Credentials"
], function(
	declare
	, lang
	, when
	, aspect
	, _Persistence
	, _Store
	, Credentials
) {

	return declare([_Store, _Persistence], {
		//	summary:
		//		Todo lo necesario para hacer persistente en el servidor los seleccionados.
		//	description:
		//		Proporciona métodos manejar seleccionar / deseleccionar los items de la base de datos

		//	config: Object
		//		Opciones por defecto.

		selectorPersistenceEvents: {
			REQUEST_QUERY: "requestQuery"
		},
		// own actions
		selectorPersistenceActions: {
			REQUEST_QUERY: "requestQuery",
			AVAILABLE_QUERY: "availableQuery"
		},
		//		Lógica necesaria para hacer persistente la selección de elementos (usando un servicio remoto).

		currentAction: {},
		currentItems: {},
@@ -41,40 +24,9 @@ define([

		constructor: function(args) {

			aspect.after(this, "_mixEventsAndActions",
				lang.hitch(this, this._mixSelectorPersistenceEventsAndActions));
			aspect.before(this, "_defineSubscriptions",
				lang.hitch(this, this._defineSelectorPersistenceSubscriptions));
			aspect.before(this, "_definePublications",
				lang.hitch(this, this._defineSelectorPersistencePublications));

			this.notificationSuccess = false;
		},

		_mixSelectorPersistenceEventsAndActions: function () {

			lang.mixin(this.events, this.selectorPersistenceEvents);
			lang.mixin(this.actions, this.selectorPersistenceActions);
			delete this.selectorPersistenceEvents;
			delete this.selectorPersistenceActions;
		},

		_defineSelectorPersistenceSubscriptions: function () {

			this.subscriptionsConfig.push({
				channel : this._buildChannel(this.queryStoreChannel, this.actions.AVAILABLE_QUERY),
				callback: "_subAvailableQuery"
			});
		},

		_defineSelectorPersistencePublications: function() {

			this.publicationsConfig.push({
				event: 'REQUEST_QUERY',
				channel: this._buildChannel(this.queryStoreChannel, this.actions.REQUEST_QUERY)
			});
		},

		_groupSelected: function(req) {

			var target = req.selectionTarget,
@@ -223,7 +175,10 @@ define([
		_getTarget: function(target) {

			var currentTarget = target + this.selectionTargetSuffix;
			if (this.target.indexOf(currentTarget) === -1) {
				this.target.push(currentTarget);
			}

			return currentTarget;
		},

+0 −100
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/base/_Module"
], function(
	declare
	, lang
	, _Module
){
	return declare(_Module, {
		//	summary:
		//		Todo lo necesario para almacenar y hacer persistente las querys
		//	description:
		//		Proporciona métodos para almacenar las querys realizadas, indexadas
		//		por servicios
		//		TODO: hacer persistente en el servidor las querys realizadas

		//	config: Object
		//		Opciones por defecto.

		constructor: function(args) {

			this.config = {
				// own events
				events: {
					REQUEST_QUERY: "requestQuery"
				},
				// own actions
				actions: {
					REQUEST_QUERY: "requestQuery",
					AVAILABLE_QUERY: "availableQuery"
				},
				query: {},
				// mediator params
				ownChannel: "queryStore"
			};

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

		_defineSubscriptions: function () {

			var options = {
				predicate: lang.hitch(this, this._chkRequestHasTarget)
			};

			this.subscriptionsConfig.push({
				channel : this.getChannel("REQUEST_QUERY"),
				callback: "_subRequestQuery",
				options: options
			},{
				channel : this._buildChannel(this.storeChannel, this.actions.AVAILABLE_QUERY),
				callback: "_subAvailableQuery",
				options: options
			});
		},

		_definePublications: function() {

			this.publicationsConfig.push({
				event: 'REQUEST_QUERY',
				channel: this.getChannel("AVAILABLE_QUERY"),
				callback: "_pubAvailableQuery"
			});
		},

		_chkRequestHasTarget: function(request) {

			if (!request || !request.target) {
				return false;
			}

			return true;
		},

		_subAvailableQuery: function(request) {

			this.query[request.target] = request.query;

		},

		_subRequestQuery: function(request) {

			if (request.target) {
				this._emitEvt('REQUEST_QUERY', {
					success: true,
					query: this.query[request.target],
					target: request.target
				});
			} else {
				console.log("No target found");
			}
		},

		_pubAvailableQuery: function(channel, data) {

			this._publish(channel, data);
		}
	});
});