This commit is contained in:
2021-05-06 22:10:06 +00:00
parent 8ecb11f7d3
commit 863e666bdd
2 changed files with 34 additions and 15 deletions

View File

@@ -306,7 +306,8 @@ CURRENTLY DOING: woitem outstanding: custom fields, attachments, wiki
todo: Test hiding woitem custom wiki attach todo: Test hiding woitem custom wiki attach
test errors in them?? test errors in them??
test updating and displaying with also header ones test updating and displaying with also header ones
todo: test the shit out of failures to save and ensure errors occur and as much as can be saved is saved
OVERALL OVERALL

View File

@@ -4,6 +4,7 @@
<div v-if="formState.ready"> <div v-if="formState.ready">
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error> <gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<gz-alert :alert-message="obj.alertViz"></gz-alert> <gz-alert :alert-message="obj.alertViz"></gz-alert>
SERVERERROR:{{ formState.serverError }}
<v-form ref="form"> <v-form ref="form">
<GzWoHeader <GzWoHeader
v-model="obj" v-model="obj"
@@ -481,7 +482,10 @@ export default {
//handle errors //handle errors
if (this.saveResult.errors != null) { if (this.saveResult.errors != null) {
//# FAIL ROUTE //# FAIL ROUTE
vm.formState.serverError = formErrorFromSaveResult(this); //this is the bit that triggers field and row errors to display as they pickup from this setting console.log("WTF?", formErrorFromSaveResult(this));
const processedErrors = formErrorFromSaveResult(this);
console.log("ProcessedErrors is", processedErrors);
vm.formState.serverError = processedErrors; //this is the bit that triggers field and row errors to display as they pickup from this setting
window.$gz.form.setErrorBoxErrors(vm); //set generalerror errors in error box at top, not related to form field errors which happen alternatively based on formState.serverError which is confusing window.$gz.form.setErrorBoxErrors(vm); //set generalerror errors in error box at top, not related to form field errors which happen alternatively based on formState.serverError which is confusing
} else { } else {
//# SUCCESS ROUTE //# SUCCESS ROUTE
@@ -614,9 +618,12 @@ async function saveHeader(vm) {
let res = await window.$gz.api.upsert(`${API_BASE_URL}`, headerOnly); let res = await window.$gz.api.upsert(`${API_BASE_URL}`, headerOnly);
if (res.error) { if (res.error) {
if (isPost) { //if (isPost) { //NO IDEA WHY THIS WAS HERE< NEEDS REVISIT PROBABLY
handleSaveError(vm, { fatal: true, error: res.error }); handleSaveError(vm, { fatal: true, error: res.error });
} // }else
//{
//}
} else { } else {
//update any server changed fields //update any server changed fields
vm.obj.concurrency = res.data.concurrency; vm.obj.concurrency = res.data.concurrency;
@@ -871,19 +878,30 @@ function formErrorFromSaveResult(vm) {
details: [], details: [],
message: "ErrorAPI2200" message: "ErrorAPI2200"
}; };
console.log("formErrorFromSaveResult - input is:", vm.saveResult.errors);
vm.saveResult.errors.forEach(z => { vm.saveResult.errors.forEach(z => {
z.error.details.forEach(x => { //console.log("z", z);
let target = errorTargetFromSaveResult(vm, z, x.target); //{error:{code:xx,message:xx,target:xx},fatal:true}
if (target != null) { if (z.error.details != null) {
ret.details.push({ z.error.details.forEach(x => {
message: x.message, let target = errorTargetFromSaveResult(vm, z, x.target);
error: x.error, if (target != null) {
target: target ret.details.push({
}); message: x.message,
} error: x.error,
}); target: target
});
}
});
} else {
//only one error so just return it
console.log("single error path:", z.error);
ret = z.error;
//ret.details.push(z.error);
}
}); });
console.log("Returning ret=:", ret);
return ret; return ret;
} }