From 1cd6dce9c1142d5df72f900e0e0f0ff4a17a835a Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:09:32 -0400 Subject: [PATCH 1/5] feature/FOUR-9157 pre-filled for timeout, retry and wait time. --- .../components/inspector/ErrorHandlingRetryAttempts.vue | 6 +++++- .../components/inspector/ErrorHandlingRetryWaitTime.vue | 6 +++++- .../modeler/components/inspector/ErrorHandlingTimeout.vue | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index 1523c048e1..1e54d734af 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -33,7 +33,11 @@ export default { const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - this.config.retry_attempts = _.get(config, 'retry_attempts', ""); + if (_.get(config, 'retry_attempts') === undefined) { + this.config.retry_attempts = 0; + } else { + this.config.retry_attempts = _.get(config, 'retry_attempts'); + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index 99df371b8b..6788976612 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -33,7 +33,11 @@ export default { const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - this.config.retry_wait_time = _.get(config, 'retry_wait_time', ""); + if (_.get(config, 'retry_wait_time') === undefined) { + this.config.retry_wait_time = 0; + } else { + this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index 45f814ab99..f6fe92e537 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -33,7 +33,11 @@ export default { const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - this.config.timeout = _.get(config, 'timeout', ""); + if (_.get(config, 'timeout') === undefined) { + this.config.timeout = 0; + } else { + this.config.timeout = _.get(config, 'timeout'); + } } }, setNodeConfig() { From 4134aea1389c5d5eb83f85b5fb9a2315f47df036 Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:45:50 -0400 Subject: [PATCH 2/5] feature/FOUR-9156: Script configuration should have the same values. --- .../inspector/ErrorHandlingRetryAttempts.vue | 24 ++++++++----- .../inspector/ErrorHandlingRetryWaitTime.vue | 34 +++++++++++++++---- .../inspector/ErrorHandlingTimeout.vue | 24 ++++++++----- .../components/inspector/ScriptSelect.vue | 10 +++--- 4 files changed, 65 insertions(+), 27 deletions(-) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index 1e54d734af..ed8eac0791 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -1,7 +1,7 @@ @@ -15,6 +15,7 @@ export default { config: { retry_attempts: "", }, + valueContent: "", } }, watch: { @@ -29,15 +30,14 @@ export default { node() { return this.$root.$children[0].$refs.modeler.highlightedNode.definition; }, - getNodeConfig() { + getNodeConfig(newValue) { + this.valueContent = newValue; const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - if (_.get(config, 'retry_attempts') === undefined) { - this.config.retry_attempts = 0; - } else { - this.config.retry_attempts = _.get(config, 'retry_attempts'); - } + this.config.retry_attempts = _.get(config, 'retry_attempts'); + } else { + this.config.retry_attempts = this.valueContent.retry_attempts; } }, setNodeConfig() { @@ -45,9 +45,17 @@ export default { const json = JSON.stringify({ ...existingSetting, retry_attempts: this.config.retry_attempts }); Vue.set(this.node(), 'errorHandling', json); }, + updateConfig() { + if (this.valueContent.retry_attempts !== this.config.retry_attempts) { + this.setNodeConfig(); + } + }, }, mounted() { - this.getNodeConfig(); + this.$root.$on("contentChanged", this.getNodeConfig); + }, + beforeDestroy() { + this.$root.$off("contentChanged", this.getNodeConfig); }, computed: { helper() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index 6788976612..a9b4f624fb 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -1,7 +1,7 @@ @@ -15,6 +15,7 @@ export default { config: { retry_wait_time: "", }, + valueContent: "", } }, watch: { @@ -26,18 +27,28 @@ export default { }, }, methods: { + actualizarValorContent(nuevoValor) { + this.valorContent = nuevoValor; // Actualizar el valor de la variable en este componente + const configString = _.get(this.node(), 'errorHandling', null); + console.log("🚀 ~ file: ErrorHandlingRetryWaitTime.vue:32 ~ actualizarValorContent ~ configString:", configString) + if (configString) { + const config = JSON.parse(configString); + this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + } else { + this.config.retry_wait_time = this.valorContent.retry_wait_time; + } + }, node() { return this.$root.$children[0].$refs.modeler.highlightedNode.definition; }, - getNodeConfig() { + getNodeConfig(newValue) { + this.valueContent = newValue; // Actualizar el valor de la variable en este componente const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - if (_.get(config, 'retry_wait_time') === undefined) { - this.config.retry_wait_time = 0; - } else { - this.config.retry_wait_time = _.get(config, 'retry_wait_time'); - } + this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + } else { + this.config.retry_wait_time = this.valueContent.retry_wait_time; } }, setNodeConfig() { @@ -45,10 +56,19 @@ export default { const json = JSON.stringify({ ...existingSetting, retry_wait_time: this.config.retry_wait_time }); Vue.set(this.node(), 'errorHandling', json); }, + updateConfig() { + if (this.valueContent.retry_wait_time !== this.config.retry_wait_time) { + this.setNodeConfig(); + } + }, }, mounted() { + this.$root.$on("contentChanged", this.actualizarValorContent); // Escuchar evento personalizado this.getNodeConfig(); }, + beforeDestroy() { + this.$root.$off("contentChanged", this.actualizarValorContent); // Dejar de escuchar el evento al destruir el componente + }, computed: { helper() { if (this.type === 'script') { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index f6fe92e537..8a1b4e9b79 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -1,7 +1,7 @@ @@ -15,6 +15,7 @@ export default { config: { timeout: "", }, + valueContent: "" } }, watch: { @@ -29,15 +30,14 @@ export default { node() { return this.$root.$children[0].$refs.modeler.highlightedNode.definition; }, - getNodeConfig() { + getNodeConfig(newValue) { + this.valueContent = newValue; const configString = _.get(this.node(), 'errorHandling', null); if (configString) { const config = JSON.parse(configString); - if (_.get(config, 'timeout') === undefined) { - this.config.timeout = 0; - } else { - this.config.timeout = _.get(config, 'timeout'); - } + this.config.timeout = _.get(config, 'timeout'); + } else { + this.config.timeout = this.valueContent.timeout; } }, setNodeConfig() { @@ -45,9 +45,17 @@ export default { const json = JSON.stringify({ ...existingSetting, timeout: this.config.timeout }); Vue.set(this.node(), 'errorHandling', json); }, + updateConfig() { + if (this.valueContent.timeout !== this.config.timeout) { + this.setNodeConfig(); + } + }, }, mounted() { - this.getNodeConfig(); + this.$root.$on("contentChanged", this.getNodeConfig); + }, + beforeDestroy() { + this.$root.$off("contentChanged", this.getNodeConfig); }, computed: { helper() { diff --git a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue index 955c4b5a52..383f4c4587 100644 --- a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue +++ b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue @@ -43,10 +43,10 @@ export default { props: ["value", "label", "helper", "params", 'required'], data() { - return { - content: "", - loading: false, - scripts: [], + return { + content: "", + loading: false, + scripts: [], error: '' }; }, @@ -65,6 +65,7 @@ if (this.content && this.content.id != this.value) { this.error = ''; this.$emit('input', this.content.id); + this.$root.$emit("contentChanged", this.content); } } }, @@ -80,6 +81,7 @@ .then(response => { this.loading = false; this.content = response.data; + this.$root.$emit("contentChanged", this.content); }) .catch(error => { this.loading = false; From f7a26b38bf0c877ebedd7d029bb7c26e78dfa425 Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:45:05 -0400 Subject: [PATCH 3/5] FOUR-9157: Fix behavior with AutoSave --- .../inspector/ErrorHandlingRetryAttempts.vue | 15 ++++++--- .../inspector/ErrorHandlingRetryWaitTime.vue | 33 ++++++++----------- .../inspector/ErrorHandlingTimeout.vue | 15 ++++++--- .../components/inspector/ScriptSelect.vue | 1 - 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index ed8eac0791..31ff7c606e 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -33,11 +33,18 @@ export default { getNodeConfig(newValue) { this.valueContent = newValue; const configString = _.get(this.node(), 'errorHandling', null); - if (configString) { - const config = JSON.parse(configString); - this.config.retry_attempts = _.get(config, 'retry_attempts'); + if (this.config.id) { + if (this.config.id !== this.valueContent.id) { + this.config.retry_attempts = this.valueContent.retry_attempts; + this.config.id = this.valueContent.id; + } else { + if (configString) { + const config = JSON.parse(configString); + this.config.retry_attempts = _.get(config, 'retry_attempts'); + } + } } else { - this.config.retry_attempts = this.valueContent.retry_attempts; + this.config.id = this.valueContent.id; } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index a9b4f624fb..bdc8f8e4f7 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -27,28 +27,24 @@ export default { }, }, methods: { - actualizarValorContent(nuevoValor) { - this.valorContent = nuevoValor; // Actualizar el valor de la variable en este componente - const configString = _.get(this.node(), 'errorHandling', null); - console.log("🚀 ~ file: ErrorHandlingRetryWaitTime.vue:32 ~ actualizarValorContent ~ configString:", configString) - if (configString) { - const config = JSON.parse(configString); - this.config.retry_wait_time = _.get(config, 'retry_wait_time'); - } else { - this.config.retry_wait_time = this.valorContent.retry_wait_time; - } - }, node() { return this.$root.$children[0].$refs.modeler.highlightedNode.definition; }, getNodeConfig(newValue) { - this.valueContent = newValue; // Actualizar el valor de la variable en este componente + this.valueContent = newValue; const configString = _.get(this.node(), 'errorHandling', null); - if (configString) { - const config = JSON.parse(configString); - this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + if (this.config.id) { + if (this.config.id !== this.valueContent.id) { + this.config.retry_wait_time = this.valueContent.retry_wait_time; + this.config.id = this.valueContent.id; + } else { + if (configString) { + const config = JSON.parse(configString); + this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + } + } } else { - this.config.retry_wait_time = this.valueContent.retry_wait_time; + this.config.id = this.valueContent.id; } }, setNodeConfig() { @@ -63,11 +59,10 @@ export default { }, }, mounted() { - this.$root.$on("contentChanged", this.actualizarValorContent); // Escuchar evento personalizado - this.getNodeConfig(); + this.$root.$on("contentChanged", this.getNodeConfig); }, beforeDestroy() { - this.$root.$off("contentChanged", this.actualizarValorContent); // Dejar de escuchar el evento al destruir el componente + this.$root.$off("contentChanged", this.getNodeConfig); }, computed: { helper() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index 8a1b4e9b79..8ce4e4b6cc 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -33,11 +33,18 @@ export default { getNodeConfig(newValue) { this.valueContent = newValue; const configString = _.get(this.node(), 'errorHandling', null); - if (configString) { - const config = JSON.parse(configString); - this.config.timeout = _.get(config, 'timeout'); + 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.timeout = this.valueContent.timeout; + this.config.id = this.valueContent.id; } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue index 383f4c4587..6ba1bf1934 100644 --- a/resources/js/processes/modeler/components/inspector/ScriptSelect.vue +++ b/resources/js/processes/modeler/components/inspector/ScriptSelect.vue @@ -65,7 +65,6 @@ if (this.content && this.content.id != this.value) { this.error = ''; this.$emit('input', this.content.id); - this.$root.$emit("contentChanged", this.content); } } }, From 39914cc5901c57020b3eaca3f87e8f056105ebed Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:36:57 -0400 Subject: [PATCH 4/5] FOUR-9157: First time selecting Script, fill Error Handling fields. --- .../components/inspector/ErrorHandlingRetryAttempts.vue | 3 +++ .../components/inspector/ErrorHandlingRetryWaitTime.vue | 3 +++ .../modeler/components/inspector/ErrorHandlingTimeout.vue | 3 +++ 3 files changed, 9 insertions(+) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index 31ff7c606e..5e521f08e3 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -45,6 +45,9 @@ export default { } } else { this.config.id = this.valueContent.id; + if (!configString) { + this.config.retry_attempts = this.valueContent.retry_attempts; + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index bdc8f8e4f7..9abe55f30d 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -45,6 +45,9 @@ export default { } } else { this.config.id = this.valueContent.id; + if (!configString) { + this.config.retry_wait_time = this.valueContent.retry_wait_time; + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index 8ce4e4b6cc..bc91edd252 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -45,6 +45,9 @@ export default { } } else { this.config.id = this.valueContent.id; + if (!configString) { + this.config.timeout = this.valueContent.timeout; + } } }, setNodeConfig() { From ffd27d7662fbf6173443f43a13e813f9a276029e Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Thu, 13 Jul 2023 21:26:54 -0400 Subject: [PATCH 5/5] Error Handling with Data Connector functionality --- .../inspector/ErrorHandlingRetryAttempts.vue | 12 ++++++++++++ .../inspector/ErrorHandlingRetryWaitTime.vue | 12 ++++++++++++ .../components/inspector/ErrorHandlingTimeout.vue | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index 5e521f08e3..ab8eb817c4 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue @@ -48,6 +48,18 @@ export default { if (!configString) { this.config.retry_attempts = this.valueContent.retry_attempts; } + if (this.valueContent.method) { + this.config.retry_attempts = this.valueContent.retry_attempts; + if (this.config.id !== this.valueContent.id) { + this.config.retry_attempts = this.valueContent.retry_attempts; + this.config.id = this.valueContent.id; + } else { + if (configString) { + const config = JSON.parse(configString); + this.config.retry_attempts = _.get(config, 'retry_attempts'); + } + } + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue index 9abe55f30d..c52e7dab1a 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryWaitTime.vue @@ -48,6 +48,18 @@ export default { if (!configString) { this.config.retry_wait_time = this.valueContent.retry_wait_time; } + if (this.valueContent.method) { + this.config.retry_wait_time = this.valueContent.retry_wait_time; + if (this.config.id !== this.valueContent.id) { + this.config.retry_wait_time = this.valueContent.retry_wait_time; + this.config.id = this.valueContent.id; + } else { + if (configString) { + const config = JSON.parse(configString); + this.config.retry_wait_time = _.get(config, 'retry_wait_time'); + } + } + } } }, setNodeConfig() { diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index bc91edd252..3029e16a71 100644 --- a/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue +++ b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue @@ -48,6 +48,18 @@ export default { 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'); + } + } + } } }, setNodeConfig() {