Commit 312ad9aa authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Revisa logs en modo debug

Oculta avisos de método no implementado de modelos, por ser demasiado
numerosos y poco útiles por ahora.

Añade avisos para validación de modelos y de wizardSteps, para
facilitar la inspección de fallos de edición.
parent 407e7177
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -43,14 +43,15 @@ define([
		_onNotImplementedMethod: function(method, props) {

			if (redmicConfig.getEnvVariableValue('envDebug') === 'true') {
				this._showNotImplementedMethodWarning(method, props);
				// TODO demasiado ruido y no aporta casi nada, quitar si no se echa en falta
				//this._showNotImplementedMethodWarning(method, props);
			}
		},

		_showNotImplementedMethodWarning: function(method, props) {

			console.warn('Not implemented method "%s" at module "%s" with this definition: %O', method,
				this.getChannel(), props);
				this.getChannel(), JSON.parse(JSON.stringify(props)));
		}
	});
});
+18 −5
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	"app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "dojo/Deferred"
	, "redmic/modules/model/ModelImpl"
	, "./_WizardStepItfc"
], function(
	declare
	redmicConfig
	, declare
	, lang
	, aspect
	, Deferred
@@ -445,12 +447,23 @@ define([
		_evaluateValidationErrors: function(obj) {

			var errors = obj.errors || {},
				isValidProperty = this._isValidProperty;
				propErrors = errors[this.propertyName],
				oldIsValidProperty = this._isValidProperty;

			this._isValidProperty = !(errors[this.propertyName]);
			this._isValidProperty = !propErrors;

			if (isValidProperty !== this._isValidProperty)
			if (redmicConfig.getEnvVariableValue('envDebug') === 'true') {
				console.warn('Wizard step validation', {
					property: this.propertyName,
					isValid: this._isValidProperty,
					validation: JSON.parse(JSON.stringify(propErrors || {})),
					channel: this.getChannel()
				});
			}

			if (oldIsValidProperty !== this._isValidProperty) {
				this._emitEvt('REFRESH_STATUS');
			}
		},

		_pubNewStatus: function(channel, req) {
+15 −1
Original line number Diff line number Diff line
define([
	"app/base/models/_Model"
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/Deferred"
	, "./Model"
], function(
	_Model
	, redmicConfig
	, declare
	, lang
	, Deferred
@@ -57,10 +59,22 @@ define([

		_onValidationErrorsChanged: function(errors) {

			var isValid = this.modelInstance.get('isValid');

			if (redmicConfig.getEnvVariableValue('envDebug') === 'true') {
				console.warn('Model validation errors', {
					target: this.target,
					isValid: isValid,
					validation: JSON.parse(JSON.stringify(errors)),
					schema: this.modelInstance.get('schema'),
					channel: this.getChannel()
				});
			}

			this._lastValidationErrors = errors;
			this._emitEvt('VALIDATION_ERRORS_CHANGED', {
				errors: errors,
				isValid: this.modelInstance.get("isValid")
				isValid: isValid
			});

			this._getIsValidStatus();