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

Incluye bloqueos de carga a login, logout y app.

parent d2f2b802
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ define([
	, lang
	, _appItfc
) {

	return declare([_Module, _Show, _appItfc], {
		//	Summary:
		//		Módulo App para gestionar la aplicación
@@ -68,7 +69,7 @@ define([
			});
		},

		_onModuleShown: function(moduleKey, res) {
		_onModuleShown: function(moduleKey) {

			this._emitEvt('MODULE_SHOWN', {
				key: moduleKey
+14 −3
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ define([

		_setInnerAppOwnCallbacksForEvents: function() {

			this._onEvt('MODULE_SHOWN', lang.hitch(this, this._updateActiveSidebarItem));
			this._onEvt('MODULE_SHOWN', lang.hitch(this, this._onAppModuleShown));
			this._onEvt('RESIZE', lang.hitch(this, this._onAppResize));
		},

@@ -114,6 +114,10 @@ define([

		postCreate: function() {

			this._emitEvt('LOADING', {
				global: true
			});

			this.inherited(arguments);

			this._publish(this.topbar.getChannel('SHOW'), {
@@ -127,7 +131,7 @@ define([
			this._evaluateAppSize();
		},

		_subToggleSidebar: function(req) {
		_subToggleSidebar: function() {

			domClass.toggle(this.ownerDocumentBody, this.uncollapsedSidebarClass);

@@ -151,6 +155,13 @@ define([
			}
		},

		_onAppModuleShown: function(evt) {

			this._updateActiveSidebarItem(evt);

			this._emitEvt('LOADED');
		},

		_updateActiveSidebarItem: function(evt) {
			//	summary:
			//		Manda a actualizar el item activo del sidebar
@@ -237,7 +248,7 @@ define([
			return this._contentContainer;
		},

		_onAppResize: function(evt) {
		_onAppResize: function() {

			this._appClickHandler.pause();

+32 −8
Original line number Diff line number Diff line
@@ -76,7 +76,17 @@ define([
			});
		},

		_onSignIn: function(self, /*Event*/ evt) {
		_startLoading: function() {

			this._emitEvt('LOADING');
		},

		_endLoading: function() {

			this._emitEvt('LOADED');
		},

		_onSignIn: function(self) {
			//	Summary:
			//		Llamado cuando se pulsa el botón para acceder a la plataforma.
			//		Se realiza una validación del formulario y luego se realiza
@@ -89,14 +99,21 @@ define([

			self._trackLoginButton('login');

			if (this.loginFormNode.validate() && (values = this.loginFormNode.get("value"))) {
				this.password.set("value", "");
			if (this.loginFormNode.validate()) {
				var values = this.loginFormNode.get('value');
				if (!values) {
					return;
				}

				self._startLoading();
				this.password.set('value', '');
				self._getAccessToken(values);
			}
		},

		_onGuestAccess: function(evt) {
		_onGuestAccess: function() {

			this._startLoading();
			this._trackLoginButton('guest');
		},

@@ -141,13 +158,15 @@ define([
			});
		},

		_dataAvailable: function(res, resWrapper) {
		_dataAvailable: function(res) {

			this._startLoading();

			var accessToken = res.data.access_token;
			Credentials.set('accessToken', accessToken);
		},

		_errorAvailable: function(error, status, resWrapper) {
		_errorAvailable: function(error, _status, resWrapper) {

			var res = resWrapper.res,
				errorRes = JSON.parse(res.text),
@@ -160,6 +179,11 @@ define([
			}

			alertify.error(errorMsg);
		},

		_beforeHide: function() {

			this._endLoading();
		}
	});
});
+17 −6
Original line number Diff line number Diff line
@@ -223,8 +223,17 @@ define([
			return Credentials.get('userRole') !== 'ROLE_GUEST';
		},

		_startLoading: function() {

			this._emitEvt('LOADING', {
				global: true
			});
		},

		_logout: function () {

			this._startLoading();

			if (!Credentials.get('accessToken')) {
				this._removeUserData();
				return;
@@ -242,7 +251,7 @@ define([
			});
		},

		_errorAvailable: function(err, status, resWrapper) {
		_errorAvailable: function(_err, _status, resWrapper) {

			var target = resWrapper.target;

@@ -259,6 +268,7 @@ define([
				}
			});

			this._startLoading();
			this._removeUserData();
		},

@@ -272,6 +282,7 @@ define([
			var target = resWrapper.target;

			if (target === this._logoutTarget) {
				this._startLoading();
				this._removeUserData();
				return;
			}
@@ -282,11 +293,6 @@ define([
				data = data[0];
			}

			// TODO impide a instancias antiguas romper la ejecución, revisar
			if (!this.domNode) {
				return;
			}

			this._updateUserAreaButton(data);
			this._showMenu();
		},
@@ -303,6 +309,11 @@ define([
			} else {
				this.iconNode = put(this.domNode, 'i.fa.fa-user');
			}
		},

		_beforeHide: function() {

			this._emitEvt('LOADED');
		}
	});
});
+1 −1

File changed.

Contains only whitespace changes.