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

Merge branch 'dev' into 'master'

Dev

Closes #28

See merge request redmic-project/client/web!31
parents 20a7695d 2ea94ee7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
  "name": "REDMIC",
  "version": "0.13.0",
  "version": "0.14.0",
  "author": "REDMIC",
  "homepage": "https://gitlab.com/redmic-project/client/web/blob/master/README.md",
  "description": "Integrated marine data repository of Canary Islands - Client",
+15 −3
Original line number Diff line number Diff line
@@ -22,14 +22,26 @@ define([

		_cleanProp: function(item, prop) {

			var propSplitted = prop.split(".");
			var propSplitted = prop.split('.');

			if (propSplitted.length > 1) {
				this._cleanProp(item[propSplitted[0]], propSplitted[1]);
				var currentPropertyKey = propSplitted[0],
					nextPropertyKeys = propSplitted.slice(1).join('.');

				var currentPropertyValue;
				if (currentPropertyKey === '{i}') {
					for (var i = 0; i < item.length; i++) {
						currentPropertyValue = item[i];
						this._cleanProp(currentPropertyValue, nextPropertyKeys);
					}
				} else {
					currentPropertyValue = item[currentPropertyKey];
					this._cleanProp(currentPropertyValue, nextPropertyKeys);
				}
			} else {
				var cleanValue = null;

				if (typeof item[prop] === "object") {
				if (typeof item[prop] === "object" && item[prop] !== null) {
					if (item[prop] instanceof Array) {
						cleanValue = [];
					} else {
+6 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ define([

			aspect.after(this, "_initialize", lang.hitch(this, this._initializeGetActivityData));
			aspect.before(this, "_itemAvailable", lang.hitch(this, this._itemGetActivityDataAvailable));
			aspect.before(this, "_beforeShow", lang.hitch(this, this._beforeShowGetActivityData));
		},

		_initializeGetActivityData: function() {
@@ -40,8 +41,6 @@ define([
			} else {
				this.target = [this.activityTarget];
			}

			this._emitGetActivity();
		},

		_emitGetActivity: function() {
@@ -53,6 +52,11 @@ define([
			});
		},

		_beforeShowGetActivityData: function() {

			this._emitGetActivity();
		},

		_itemGetActivityDataAvailable: function(res) {

			var target = res.target,
+32 −31
Original line number Diff line number Diff line
@@ -148,23 +148,19 @@ define([

			// Recorremos las categorías y sus módulos para generar nuestro store de módulos
			for (var i = 0; i < categories.length; i++) {

				var category = categories[i];
				if (category.modules) {

				if (category.modules) {
					for (var j = 0; j < category.modules.length; j++) {

						var module = category.modules[j];
						if (module.perms/* > 0*/ && module.enable) {

							this._addModule(category.name + "/" + module.name, module.name, module.internPath,
								module.perms);
						var moduleItem = category.modules[j];
						if (moduleItem.perms && moduleItem.enable) {
							this._addModule(category.name + "/" + moduleItem.name, moduleItem.name,
								moduleItem.internPath, moduleItem.perms);
						}
					}
				}

				if (category.perms/* && category.perms > 0*/ && category.enable) {

				if (category.perms && category.enable) {
					this._addModule(category.name, category.name, category.internPath, category.perms);
				}
			}
@@ -278,37 +274,42 @@ define([
			//	returns:
			//		Promesa de la instancia del módulo

			var module = this._findModuleByPath(key);
			var moduleList = this._findModuleByPath(key);

			if (module.length < 1)
			if (!moduleList.length) {
				return;
			}

			moduleItem = moduleList[0];

			module = module[0];
			// Si aun no se ha creado la vista
			if (!module.instance)
				return this._createModule(module, query);	// return Object
			if (!moduleItem.instance) {
				return this._createModule(moduleItem, query);	// return Object
			}

			// Si ya se creó la vista anteriormente
			module.timeStamp = new Date().getTime();	// Actualizamos el módulo
			module.instance.pathVariableId = this.pathVariableId !== "$1" ? this.pathVariableId :null;
			moduleItem.timeStamp = new Date().getTime();
			this.moduleStore.put(moduleItem);

			//module.instance._query.set(query);
			this.moduleStore.put(module);
			this._publish(moduleItem.instance.getChannel("CONNECT"));

			this._publish(module.instance.getChannel("CONNECT"));
			this._publish(moduleItem.instance.getChannel('SET_PROPS'), {
				pathVariableId: this.pathVariableId !== "$1" ? this.pathVariableId : null,
				queryParameters: query
			});

			var dfd = new Deferred();
			dfd.resolve(module.instance);
			dfd.resolve(moduleItem.instance);

			return dfd;	// return Object
		},

		_createModule: function(/*Object*/ module, /*Object*/ query) {
		_createModule: function(/*Object*/ moduleItem, /*Object*/ query) {
			//	summary:
			//		Crea la instancia de un módulo de la aplicación.
			//	tags:
			//		private
			//	module:
			//	moduleItem:
			//		Módulo a crear
			//	query:
			//		Objeto de consulta
@@ -317,20 +318,20 @@ define([

			var dfd = new Deferred();

			require(["app" + module.internPath + "View"], lang.hitch(this, function(ModuleView) {
			require(["app" + moduleItem.internPath + "View"], lang.hitch(this, function(ModuleView) {
				// Creamos el módulo
				var moduleInstance = new ModuleView({
					perms: module.perms,
					query: query,
					perms: moduleItem.perms,
					parentChannel: this.parentChannel,
					ownChannel: this.viewSeparator+module.id,
					pathVariableId: this.pathVariableId !== "$1" ? this.pathVariableId :null
					ownChannel: this.viewSeparator + moduleItem.id,
					pathVariableId: this.pathVariableId !== "$1" ? this.pathVariableId : null,
					queryParameters: query
				});

				// Añadimos al store la instancia del módulo
				module.instance = moduleInstance;
				module.timeStamp = new Date().getTime();
				this.moduleStore.put(module);
				moduleItem.instance = moduleInstance;
				moduleItem.timeStamp = new Date().getTime();
				this.moduleStore.put(moduleItem);

				// Resolvemos para devolver la instancia creada
				dfd.resolve(moduleInstance);
+2 −6
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ define([

				// looking for all the links with 'ajax' class found
				if (target && target.nodeName === 'A' && domAttr.get(target, 'd-state-url')) {
					var url = /*'/'+kernel.locale+*/target.pathname;
					var url = target.pathname + target.search;
					if (mouse.isMiddle(event)) {
						globalContext.open(globalContext.location.protocol + '//' + globalContext.location.hostname +
							url, '_blank');
@@ -276,10 +276,8 @@ define([
				query = urlSplitted[1];

			if ((!route || (route === '') || (route === this.paths.ROOT)) && !this._userFound) {

				this._addHistory(this.paths.LOGIN);
				route = this.paths.LOGIN;

			} else if (!route || (route === '')  || (route === this.paths.ROOT) ||
				(route === this.paths.LOGIN && this._userFound)) {

@@ -385,9 +383,7 @@ define([

			this._emitEvt('GET_MODULE', {
				key: this._currModuleKey,
				query: {
					where: ioQuery.queryToObject(this.query)
				}
				query: ioQuery.queryToObject(this.query)
			});
		},

Loading