This commit is contained in:
2020-04-05 21:05:17 +00:00
parent d031f60285
commit 9c13f11e21
3 changed files with 24 additions and 2 deletions

View File

@@ -49,6 +49,8 @@ CURRENT TODOs
@@@@@@@@@@@ ROADMAP STAGE 2:
todo: submit widget to save, server was set to opsonly, error correctly displays but dirty is reset so can't save later when server opens without doing an edit to trigger dirty
todo: server state
- check server routes, what do they do to take into account server state

View File

@@ -496,6 +496,24 @@ export default {
//First let's get the top level error code
let apiErrorCode = parseInt(vm.formState.serverError.code);
//Not all server errors mean the form is invalid, exceptions here
let formValid = false;
/*
These errors are not the user's fault and no changes to the form are required
so they may be temporary and user should be able to retry save
API_CLOSED = 2000,
API_OPS_ONLY = 2001,
API_SERVER_ERROR = 2002,
*/
switch (apiErrorCode) {
case 2000:
case 2001:
case 2002:
formValid = true; //we came here because the user saved because the form was valid so it's safe to set that the same again
break;
default:
formValid = false;
}
//GENERAL ERROR
if (ref == "errorbox") {
@@ -504,10 +522,11 @@ export default {
if (vm.formState.serverError.message) {
err = err + "\r\n" + vm.formState.serverError.message;
}
//Update the form status
this.setFormState({
vm: vm,
valid: false
valid: formValid
});
ret.push(err);
}

View File

@@ -1,5 +1,6 @@
<template>
<v-container>
{{ formState }}
<v-row v-if="formState.ready">
<v-col>
<v-form ref="form">
@@ -429,7 +430,6 @@ export default {
let vm = this;
if (vm.canSave) {
vm.formState.loading = true;
let url = API_BASE_URL + vm.$route.params.recordid;
//clear any errors vm might be around from previous submit
@@ -463,6 +463,7 @@ export default {
}
})
.catch(function handleSubmitError(error) {
debugger;
vm.formState.loading = false;
window.$gz.errorHandler.handleFormError(error, vm);
});