From ab012e9584e0856fef53641af0718b76b8817014 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 18 Jul 2023 12:58:31 -0700 Subject: [PATCH 1/3] Refactor error handling logic --- .../inspector/ErrorHandlingTimeout.vue | 67 +++++++------------ 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index 3029e16a71..a34dedb9a4 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -1,7 +1,7 @@ @@ -12,17 +12,15 @@ export default { props: ['type'], data() { return { - config: { - timeout: "", - }, - valueContent: "" + value: "", + valueFromModel: "", + userHasUpdated: false, } }, watch: { - config: { - deep: true, + value: { handler() { - this.setNodeConfig(); + this.emitValue(); } }, }, @@ -30,50 +28,33 @@ export default { node() { return this.$root.$children[0].$refs.modeler.highlightedNode.definition; }, - getNodeConfig(newValue) { - this.valueContent = newValue; + valueFromNode() + { const configString = _.get(this.node(), 'errorHandling', null); - if (this.config.id) { - if (this.config.id !== this.valueContent.id) { - this.config.timeout = this.valueContent.timeout; - this.config.id = this.valueContent.id; - } else { - if (configString) { - const config = JSON.parse(configString); - this.config.timeout = _.get(config, 'timeout'); - } - } - } else { - this.config.id = this.valueContent.id; - if (!configString) { - this.config.timeout = this.valueContent.timeout; - } - if (this.valueContent.method) { - this.config.timeout = this.valueContent.timeout; - if (this.config.id !== this.valueContent.id) { - this.config.timeout = this.valueContent.timeout; - this.config.id = this.valueContent.id; - } else { - if (configString) { - const config = JSON.parse(configString); - this.config.timeout = _.get(config, 'timeout'); - } - } - } + const config = JSON.parse(configString); + return _.get(config, 'timeout', null); + }, + getNodeConfig(valueFromModel) { + if (this.valueFromNode()) { + return; } + + this.valueFromModel = this.value = valueFromModel.timeout; }, - setNodeConfig() { + emitValue() { + if (!this.userHasUpdated) { + return; + } const existingSetting = JSON.parse(_.get(this.node(), 'errorHandling', '{}')); - const json = JSON.stringify({ ...existingSetting, timeout: this.config.timeout }); + const json = JSON.stringify({ ...existingSetting, timeout: this.value }); Vue.set(this.node(), 'errorHandling', json); }, - updateConfig() { - if (this.valueContent.timeout !== this.config.timeout) { - this.setNodeConfig(); - } + userHasUpdatedValue() { + this.userHasUpdated = true; }, }, mounted() { + this.value = this.valueFromNode(); this.$root.$on("contentChanged", this.getNodeConfig); }, beforeDestroy() { From 9ec8cde89611e7e93a56f93b71242850f735e413 Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:36:55 -0400 Subject: [PATCH 2/3] Error Handling Refactor with Mixin --- .../inspector/ErrorHandlingMixin.vue | 63 ++++++++++++++ .../inspector/ErrorHandlingRetryAttempts.vue | 82 ++---------------- .../inspector/ErrorHandlingRetryWaitTime.vue | 84 ++----------------- .../inspector/ErrorHandlingTimeout.vue | 63 ++------------ 4 files changed, 82 insertions(+), 210 deletions(-) create mode 100644 resources/js/processes/modeler/components/inspector/ErrorHandlingMixin.vue diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingMixin.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingMixin.vue new file mode 100644 index 0000000000..f0e489f2df --- /dev/null +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingMixin.vue @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index ab8eb817c4..cd284c2b84 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -1,93 +1,23 @@ diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index c52e7dab1a..42ea7a450e 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -1,94 +1,24 @@ - + \ No newline at end of file diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index a34dedb9a4..46c67f77bc 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -7,69 +7,18 @@ - + \ No newline at end of file From 68c86f9c30213e372555ae84510b179ff1a2ada0 Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:52:43 -0400 Subject: [PATCH 3/3] Error Handling taking only the three values from endpoints. --- .../modeler/components/inspector/ScriptSelect.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue index 6ba1bf1934..fc5ded0ece 100644 --- a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue +++ b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue @@ -80,7 +80,12 @@ .then(response => { this.loading = false; this.content = response.data; - this.$root.$emit("contentChanged", this.content); + this.error_handling = { + timeout: this.content.timeout, + retry_wait_time: this.content.retry_wait_time, + retry_attempts: this.content.retry_attempts + } + this.$root.$emit("contentChanged", this.error_handling); }) .catch(error => { this.loading = false;