This commit is contained in:
2019-04-03 00:04:44 +00:00
parent e4837d44a4
commit c4a495bb9a
3 changed files with 67 additions and 14 deletions

View File

@@ -14,12 +14,63 @@ TODO CLIENT STUFF
TODO NEXT
Make the stuff happen to resolve the first open issue below
Issues:
won't show multiple lines in v-alert from my code but will if static element with <br/> at end of each line
Not sure this is the correct approach, it's needing to iterate the return error object multiple times which is a code smell
PENDING FIXED ISSUE: won't show multiple lines in v-alert from my code but will if static element with <br/> at end of each line
ISSUE: Not sure this is the correct approach, it's needing to iterate the return error object multiple times which is a code smell
- Once to see if there are errors and another time to build up the errors
- Maybe it should be called once only as a method after the server returns the results and the gzvalidate populates a key on the data object in the form which in turn drives the error box?
FIX:
Need to test with full features, so plow ahead getting to a normal cycle of errors and then go back and fix the things that don't work later
Scenarios:
- DONE: Local form validation errors display correctly and are cleared when edited
- Server form validation errors displayed correctly
- control ones under control where local form validation errors show
- whole object ones at top
- Server form validation errors cleared in individual inputs upon any change to them (but form overall ones stay until submitted)
- On submit:
- Doesn't happen if any local validation errors
- All server errors clear on submit
- Validation short circuits if form is loading and no data yet
- Validation short circuits if no server errors at all
DIRTY CHECKING to short circuit rule checks
direct control properties when control was changed / is dirty:
=-=-=-=-
hasColor: true
hasFocused: undefined
hasInput: true
hasMouseDown: undefined
initialValue: 8212
internalChange: true
isClearing: undefined
isFocused: true
isResetting: undefined
lazySelection: undefined
lazyValue: "82121"
Same properties when control was NOT changed:
=-=-=-
hasColor: undefined
hasFocused: undefined
hasInput: true
hasMouseDown: undefined
initialValue: null
internalChange: undefined
isClearing: undefined
isFocused: undefined
isResetting: undefined
lazySelection: undefined
lazyValue: undefined
LOADING CHECKING to short circuit rule checks when form is first loading
Vuetify Inputs have a loading property, can that be used to super short circuit rule checking?

View File

@@ -332,7 +332,7 @@ Here are all the API level error codes that can be returned by the API server:
//Keep top part if statement for gathering all overall errors, but then also run the field errors block and check for field errors where "target" is empty and add them in to the return as well
//GENERAL ERROR
if (ref == "errorbox") {
if (ref == "errorbox") {
//Add any general errors to ret
var err = v.$gzlocale.get("ErrorAPI" + apiErrorCode.toString());
if (v.serverError.message) {
@@ -347,7 +347,7 @@ Here are all the API level error codes that can be returned by the API server:
//See if this key is in the details array
var errorsForField = [];
if (ref == "errorbox") {
if (ref == "errorbox") {
errorsForField = v.$_.filter(v.serverError.details, function(o) {
return !o.target;
});
@@ -408,8 +408,11 @@ Here are all the API level error codes that can be returned by the API server:
// ERROR BOX ERRORS
// displays any messages for error box on form which is the generic catch all for non field specific errors from server
ErrorBoxErrors(v) {
console.log("gzvalidate::ErrorBoxErrors called...");
console.log(v);
var errs = this.ServerErrors(v, "errorbox");
if (errs.length < 1) {
console.log("gzvalidate::ErrorBoxErrors - RETURN NO ERRORS, short circuit return");
return null;
}
@@ -418,7 +421,8 @@ Here are all the API level error codes that can be returned by the API server:
for (var i = 0; i < errs.length; i++) {
ret += errs[i] + "\r\n";
}
ret=ret.replace("\r\n"," <br/> ");
// ret=ret.replace("\r\n"," <br/> ");
console.log("gzvalidate::ErrorBoxErrors - RETURN WITH ERRORS");
return ret;
}
};

View File

@@ -3,7 +3,7 @@
<v-flex>
<v-form ref="form">
<v-layout align-center justify-left row wrap>
<v-flex xs12 px-2>
<!-- <v-flex xs12 px-2>
<v-alert
color="warning"
icon="fa-exclamation-circle "
@@ -11,13 +11,10 @@
transition="scale-transition"
outline
>
line one<br/>
line two
<div style="word-wrap: break-word;">{{someerror}}</div>
</v-alert>
</v-flex>
<v-flex xs12 px-2>
</v-flex> -->
<v-flex xs12 mt-1 mb-2>
<v-alert
ref="errorbox"
v-show="this.$gzv.ErrorBoxErrors(this)"
@@ -26,7 +23,7 @@
value="true"
transition="scale-transition"
outline
>{{this.$gzv.ErrorBoxErrors(this)}}</v-alert>
><pre>{{this.$gzv.ErrorBoxErrors(this)}}</pre></v-alert>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field
@@ -176,7 +173,8 @@ export default {
return {
obj: {},
serverError: {},
formReady: false
formReady: false,
someerror: "blah blahv <br/> blah blah" + "\n test line 3" + "\r\n Test line 4"
};
},
methods: {