diff --git a/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingRetryAttempts.vue index 1523c048e1..ab8eb817c4 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,11 +30,36 @@ 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); - 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.id = this.valueContent.id; + 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() { @@ -41,9 +67,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 99df371b8b..c52e7dab1a 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: { @@ -29,11 +30,36 @@ 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); - 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.id = this.valueContent.id; + 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() { @@ -41,9 +67,17 @@ 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.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/ErrorHandlingTimeout.vue b/resources/js/processes/modeler/components/inspector/ErrorHandlingTimeout.vue index 45f814ab99..3029e16a71 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,11 +30,36 @@ 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); - 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.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'); + } + } + } } }, setNodeConfig() { @@ -41,9 +67,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..6ba1bf1934 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: '' }; }, @@ -80,6 +80,7 @@ .then(response => { this.loading = false; this.content = response.data; + this.$root.$emit("contentChanged", this.content); }) .catch(error => { this.loading = false;