This commit is contained in:
@@ -15,7 +15,7 @@ TODO CLIENT STUFF
|
|||||||
TODO NEXT
|
TODO NEXT
|
||||||
|
|
||||||
IMMEDIATE ISSUES:
|
IMMEDIATE ISSUES:
|
||||||
Now clearing server error box thanks to some last minute changes, but those chagnes need to be looked at and start with **THIS** in gzvalidate and move on
|
How and where to display form errors that are unhandled on form and not related to notification, i.e. ErrorServerUnresponsive when attempting to use a form that was already open
|
||||||
|
|
||||||
See server project widget validation code which will now give server errors on certain values so can proceed with work.
|
See server project widget validation code which will now give server errors on certain values so can proceed with work.
|
||||||
Current issue is where to put notifications, code is to help test,
|
Current issue is where to put notifications, code is to help test,
|
||||||
@@ -25,8 +25,9 @@ Issues:
|
|||||||
ISSUE: need to display multiple types of messages, best way to do that??
|
ISSUE: need to display multiple types of messages, best way to do that??
|
||||||
- DONE: Local validation errors - this works and is done
|
- DONE: Local validation errors - this works and is done
|
||||||
- DONE: Server errors - This works and is done
|
- DONE: Server errors - This works and is done
|
||||||
- Important transient application messages, equivalent of dialog boxes that popup in apps, i.e. "This object has broken rules, fix them to be able to save" or "Insufficient rights" or whatever
|
- Application errors
|
||||||
- Dialogs suck in web ui, so this should be right on the page itself in an alert probably
|
- Make them show with the server error box, rejig it as a generic error box
|
||||||
|
- App errors don't need to survive page reload or api call, if they are that serious then they would be notifications instead
|
||||||
- Notifications, stuff that you want to know is there and can go and look at but isn't urgent enough to put in the users face
|
- Notifications, stuff that you want to know is there and can go and look at but isn't urgent enough to put in the users face
|
||||||
- Used for notification system, non-urgent system messages, direct messages from users etc, anything that isn't immediately important
|
- Used for notification system, non-urgent system messages, direct messages from users etc, anything that isn't immediately important
|
||||||
- This seems like an application wide thing so maybe a bell icon that takes to another area of the program, or opens a div at the top or bottom of the page??
|
- This seems like an application wide thing so maybe a bell icon that takes to another area of the program, or opens a div at the top or bottom of the page??
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
// GZVALIDATE
|
// GZVALIDATE
|
||||||
//
|
//
|
||||||
// provides form validation services
|
// provides form validation services
|
||||||
|
// and also general error display in forms
|
||||||
|
//probably should be broken up more
|
||||||
// All locale keys for validation *MUST* be fetched prior to this being used as it assumes all keys are fetched first
|
// All locale keys for validation *MUST* be fetched prior to this being used as it assumes all keys are fetched first
|
||||||
// Add any new keys used to the block in locale.js=>commonKeysEditForm
|
// Add any new keys used to the block in locale.js=>commonKeysEditForm
|
||||||
|
|
||||||
@@ -92,17 +94,29 @@ function getErrorsForField(v, ref) {
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// ERROR BOX ERRORS
|
// ERROR BOX ERRORS
|
||||||
// gathers any messages for error box on form which is the generic catch all for non field specific errors from server
|
// gathers any messages for error box on form which is the generic catch all for non field specific errors from server
|
||||||
|
// and application itself locally
|
||||||
function GetErrorBoxErrors(v, errs) {
|
function GetErrorBoxErrors(v, errs) {
|
||||||
if (errs.length < 1) {
|
var hasErrors = false;
|
||||||
return null;
|
var ret = "";
|
||||||
|
if (errs.length > 0) {
|
||||||
|
hasErrors = true;
|
||||||
|
//loop array and append each error to a return string
|
||||||
|
for (var i = 0; i < errs.length; i++) {
|
||||||
|
ret += errs[i] + "\r\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ret = "";
|
//any application errors?
|
||||||
//loop array and append each error to a return string
|
if (v.appError) {
|
||||||
for (var i = 0; i < errs.length; i++) {
|
hasErrors = true;
|
||||||
ret += errs[i] + "\r\n";
|
ret = v.appError + "\r\n----------\r\n" + ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasErrors) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -265,6 +279,11 @@ export default {
|
|||||||
throw "DEV ERROR gzvalidate::ServerErrors -> serverError seems to be missing from form's vue data object";
|
throw "DEV ERROR gzvalidate::ServerErrors -> serverError seems to be missing from form's vue data object";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//make sure appError is defined on data
|
||||||
|
if (!v.$_.has(v, "appError")) {
|
||||||
|
throw "DEV ERROR gzvalidate::ServerErrors -> appError seems to be missing from form's vue data object";
|
||||||
|
}
|
||||||
|
|
||||||
//make sure errorBoxMessage is defined on data
|
//make sure errorBoxMessage is defined on data
|
||||||
if (!v.$_.has(v, "errorBoxMessage")) {
|
if (!v.$_.has(v, "errorBoxMessage")) {
|
||||||
throw "DEV ERROR gzvalidate::ServerErrors -> errorBoxMessage seems to be missing from form's vue data object";
|
throw "DEV ERROR gzvalidate::ServerErrors -> errorBoxMessage seems to be missing from form's vue data object";
|
||||||
@@ -330,17 +349,19 @@ export default {
|
|||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// ClearServerErrors
|
// ClearServerErrors
|
||||||
// Clear all server errors and ensure error box doesn't show and validation is triggered
|
// Clear all server errors and app errors and ensure error box doesn't show
|
||||||
ClearServerErrors(v) {
|
DeleteAllErrorBoxErrors(v) {
|
||||||
//clear all keys from server error
|
//clear all keys from server error
|
||||||
v.$gzutil.RemoveAllPropertiesFromObject(v.serverError);
|
v.$gzutil.RemoveAllPropertiesFromObject(v.serverError);
|
||||||
|
//clear app errors
|
||||||
|
v.appError = null;
|
||||||
|
//clear out actual message box display
|
||||||
v.errorBoxMessage = null;
|
v.errorBoxMessage = null;
|
||||||
},
|
},
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// SetErrorBoxErrors
|
// SetErrorBoxErrors
|
||||||
// Gather server errors and set the appropriate keys
|
// Gather server errors and set the appropriate keys
|
||||||
SetErrorBoxErrors(v) {
|
SetErrorBoxErrors(v) {
|
||||||
//maybe just put all the code in here and don't call geterrorboxerrors at all as no one else will need to call it anyway
|
|
||||||
var errs = this.ServerErrors(v, "errorbox");
|
var errs = this.ServerErrors(v, "errorbox");
|
||||||
var ret = GetErrorBoxErrors(v, errs);
|
var ret = GetErrorBoxErrors(v, errs);
|
||||||
v.errorBoxMessage = ret;
|
v.errorBoxMessage = ret;
|
||||||
@@ -363,7 +384,8 @@ export default {
|
|||||||
//If there are no more errors in details then remove the whole thing as it's no longer required
|
//If there are no more errors in details then remove the whole thing as it's no longer required
|
||||||
if (v.serverError.details && v.serverError.details.length < 1) {
|
if (v.serverError.details && v.serverError.details.length < 1) {
|
||||||
if (v.serverError.code == "2200") {
|
if (v.serverError.code == "2200") {
|
||||||
this.ClearServerErrors(v);
|
//clear all keys from server error
|
||||||
|
v.$gzutil.RemoveAllPropertiesFromObject(v.serverError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export default {
|
|||||||
obj: {},
|
obj: {},
|
||||||
serverError: {},
|
serverError: {},
|
||||||
errorBoxMessage: null,
|
errorBoxMessage: null,
|
||||||
|
appError:null,
|
||||||
formReady: false
|
formReady: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -186,6 +187,7 @@ export default {
|
|||||||
getDataFromApi() {
|
getDataFromApi() {
|
||||||
var url = "Widget/" + this.$route.params.id;
|
var url = "Widget/" + this.$route.params.id;
|
||||||
var that = this;
|
var that = this;
|
||||||
|
this.$gzv.DeleteAllErrorBoxErrors(this);
|
||||||
this.$gzapi
|
this.$gzapi
|
||||||
.get(url)
|
.get(url)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -202,7 +204,7 @@ export default {
|
|||||||
var url = "Widget/" + this.$route.params.id;
|
var url = "Widget/" + this.$route.params.id;
|
||||||
|
|
||||||
//clear any errors that might be around from previous submit
|
//clear any errors that might be around from previous submit
|
||||||
this.$gzv.ClearServerErrors(this);
|
this.$gzv.DeleteAllErrorBoxErrors(this);
|
||||||
//this.$gzutil.RemoveAllPropertiesFromObject(this.serverError);
|
//this.$gzutil.RemoveAllPropertiesFromObject(this.serverError);
|
||||||
|
|
||||||
this.$gzapi
|
this.$gzapi
|
||||||
@@ -225,9 +227,6 @@ export default {
|
|||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
that.$gzHandleFormError(error, true);
|
that.$gzHandleFormError(error, true);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
//say something so the user knows there is an issue
|
|
||||||
alert("STUB: You can't do that, there are broken rules");
|
|
||||||
}
|
}
|
||||||
} //end of submit()
|
} //end of submit()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user