From 9c13f11e214dab1b22f449a8fa19fb892adfbcb9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 5 Apr 2020 21:05:17 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 2 ++ ayanova/src/api/gzform.js | 21 ++++++++++++++++++++- ayanova/src/views/widget.vue | 3 ++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index f188a430..3f74a654 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index 6706c628..6524f4b4 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -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); } diff --git a/ayanova/src/views/widget.vue b/ayanova/src/views/widget.vue index aefe97d8..c3defab3 100644 --- a/ayanova/src/views/widget.vue +++ b/ayanova/src/views/widget.vue @@ -1,5 +1,6 @@