This commit is contained in:
@@ -306,7 +306,8 @@ CURRENTLY DOING: woitem outstanding: custom fields, attachments, wiki
|
||||
todo: Test hiding woitem custom wiki attach
|
||||
test errors in them??
|
||||
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
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div v-if="formState.ready">
|
||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||
<gz-alert :alert-message="obj.alertViz"></gz-alert>
|
||||
SERVERERROR:{{ formState.serverError }}
|
||||
<v-form ref="form">
|
||||
<GzWoHeader
|
||||
v-model="obj"
|
||||
@@ -481,7 +482,10 @@ export default {
|
||||
//handle errors
|
||||
if (this.saveResult.errors != null) {
|
||||
//# 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
|
||||
} else {
|
||||
//# SUCCESS ROUTE
|
||||
@@ -614,9 +618,12 @@ async function saveHeader(vm) {
|
||||
|
||||
let res = await window.$gz.api.upsert(`${API_BASE_URL}`, headerOnly);
|
||||
if (res.error) {
|
||||
if (isPost) {
|
||||
handleSaveError(vm, { fatal: true, error: res.error });
|
||||
}
|
||||
//if (isPost) { //NO IDEA WHY THIS WAS HERE< NEEDS REVISIT PROBABLY
|
||||
handleSaveError(vm, { fatal: true, error: res.error });
|
||||
// }else
|
||||
//{
|
||||
|
||||
//}
|
||||
} else {
|
||||
//update any server changed fields
|
||||
vm.obj.concurrency = res.data.concurrency;
|
||||
@@ -871,19 +878,30 @@ function formErrorFromSaveResult(vm) {
|
||||
details: [],
|
||||
message: "ErrorAPI2200"
|
||||
};
|
||||
console.log("formErrorFromSaveResult - input is:", vm.saveResult.errors);
|
||||
vm.saveResult.errors.forEach(z => {
|
||||
z.error.details.forEach(x => {
|
||||
let target = errorTargetFromSaveResult(vm, z, x.target);
|
||||
if (target != null) {
|
||||
ret.details.push({
|
||||
message: x.message,
|
||||
error: x.error,
|
||||
target: target
|
||||
});
|
||||
}
|
||||
});
|
||||
//console.log("z", z);
|
||||
//{error:{code:xx,message:xx,target:xx},fatal:true}
|
||||
if (z.error.details != null) {
|
||||
z.error.details.forEach(x => {
|
||||
let target = errorTargetFromSaveResult(vm, z, x.target);
|
||||
if (target != null) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user