Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script>
export default {
props: ['type'],
data() {
return {
value: "",
valueFromModel: "",
userHasUpdated: false,
}
},
watch: {
value: {
handler() {
this.emitValue();
}
},
},
methods: {
node() {
return this.$root.$children[0].$refs.modeler.highlightedNode.definition;
},
valueFromNode() {
const configString = _.get(this.node(), 'errorHandling', null);
const config = JSON.parse(configString);
return _.get(config, this.configKey, null);
},
getNodeConfig(valueFromModel) {
if (this.valueFromNode()) {
return;
}

this.valueFromModel = this.value = valueFromModel[this.configKey];
},
emitValue() {
if (!this.userHasUpdated) {
return;
}
const existingSetting = JSON.parse(_.get(this.node(), 'errorHandling', '{}'));
const json = JSON.stringify({ ...existingSetting, [this.configKey]: this.value });
Vue.set(this.node(), 'errorHandling', json);
},
userHasUpdatedValue() {
this.userHasUpdated = true;
},
},
mounted() {
this.value = this.valueFromNode();
this.$root.$on("contentChanged", this.getNodeConfig);
},
beforeDestroy() {
this.$root.$off("contentChanged", this.getNodeConfig);
},
computed: {
helper() {
if (this.type === 'script') {
return this.$t(this.scriptHelperText);
} else if (this.type === 'data-connector') {
return this.$t(this.dataConnectorHelperText);
}
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -1,93 +1,23 @@
<template>
<div role="group">
<label for="retry_attempts">{{ $t('Retry Attempts') }}</label>
<b-form-input id="retry_attempts" type="number" v-model="config.retry_attempts" @input="updateConfig" min="0" max="50"></b-form-input>
<b-form-input id="retry_attempts" type="number" v-model="value" @input="userHasUpdatedValue" min="0" max="50"></b-form-input>
<small class="form-text text-muted">{{ helper }}</small>
</div>
</template>

<script>
import ErrorHandlingMixin from './ErrorHandlingMixin';

export default {
props: ['type'],
mixins: [ErrorHandlingMixin],
data() {
return {
config: {
retry_attempts: "",
},
valueContent: "",
configKey: 'retry_attempts',
scriptHelperText: 'Set maximum run retry attempts in seconds. Leave empty to use script default. Set to 0 for no retry attempts.',
dataConnectorHelperText: 'Set maximum run retry attempts in seconds. Leave empty to use data connector default. Set to 0 for no retry attempts.'
}
},
watch: {
config: {
deep: true,
handler() {
this.setNodeConfig();
}
},
},
methods: {
node() {
return this.$root.$children[0].$refs.modeler.highlightedNode.definition;
},
getNodeConfig(newValue) {
this.valueContent = newValue;
const configString = _.get(this.node(), 'errorHandling', null);
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() {
const existingSetting = JSON.parse(_.get(this.node(), 'errorHandling', '{}'));
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.$root.$on("contentChanged", this.getNodeConfig);
},
beforeDestroy() {
this.$root.$off("contentChanged", this.getNodeConfig);
},
computed: {
helper() {
if (this.type === 'script') {
return this.$t('Set maximum run retry attempts in seconds. Leave empty to use script default. Set to 0 for no retry attempts.');
} else if (this.type === 'data-connector') {
return this.$t('Set maximum run retry attempts in seconds. Leave empty to use data connector default. Set to 0 for no retry attempts.');
}
}
}
}
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,94 +1,24 @@
<template>
<div role="group">
<label for="retry_wait_time">{{ $t('Retry Wait Time') }}</label>
<b-form-input id="retry_wait_time" type="number" v-model="config.retry_wait_time" @input="updateConfig" min="0" max="3600"></b-form-input>
<b-form-input id="retry_wait_time" type="number" v-model="value" @input="userHasUpdatedValue" min="0" max="3600"></b-form-input>
<small class="form-text text-muted">{{ helper }}</small>
</div>
</template>

<script>
import ErrorHandlingMixin from './ErrorHandlingMixin';

export default {
props: ['type'],
mixins: [ErrorHandlingMixin],
data() {
return {
config: {
retry_wait_time: "",
},
valueContent: "",
configKey: 'retry_wait_time',
scriptHelperText: 'Set maximum run retry wait time in seconds. Leave empty to use script default. Set to 0 for no retry wait time.',
dataConnectorHelperText: 'Set maximum run retry wait time in seconds. Leave empty to use data connector default. Set to 0 for no retry wait time.'
}
},
watch: {
config: {
deep: true,
handler() {
this.setNodeConfig();
}
},
},
methods: {
node() {
return this.$root.$children[0].$refs.modeler.highlightedNode.definition;
},
getNodeConfig(newValue) {
this.valueContent = newValue;
const configString = _.get(this.node(), 'errorHandling', null);
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() {
const existingSetting = JSON.parse(_.get(this.node(), 'errorHandling', '{}'));
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.getNodeConfig);
},
beforeDestroy() {
this.$root.$off("contentChanged", this.getNodeConfig);
},
computed: {
helper() {
if (this.type === 'script') {
return this.$t('Set maximum run retry wait time in seconds. Leave empty to use script default. Set to 0 for no retry wait time.');
} else if (this.type === 'data-connector') {
return this.$t('Set maximum run retry wait time in seconds. Leave empty to use data connector default. Set to 0 for no retry wait time.');
}
}
}
}
</script>

<style scoped></style>
<style scoped></style>
Original file line number Diff line number Diff line change
@@ -1,94 +1,24 @@
<template>
<div role="group">
<label for="timeout">{{ $t('Timeout') }}</label>
<b-form-input id="timeout" type="number" min="0" max="3600" v-model="config.timeout" @input="updateConfig"></b-form-input>
<b-form-input id="timeout" type="number" min="0" max="3600" v-model="value" @input="userHasUpdatedValue"></b-form-input>
<small class="form-text text-muted">{{ helper }}</small>
</div>
</template>

<script>
import ErrorHandlingMixin from './ErrorHandlingMixin';

export default {
props: ['type'],
mixins: [ErrorHandlingMixin],
data() {
return {
config: {
timeout: "",
},
valueContent: ""
configKey: 'timeout',
scriptHelperText: 'Set maximum run time in seconds. Leave empty to use script default. Set to 0 for no timeout.',
dataConnectorHelperText: 'Set maximum run time in seconds. Leave empty to use data connector default. Set to 0 for no timeout.'
}
},
watch: {
config: {
deep: true,
handler() {
this.setNodeConfig();
}
},
},
methods: {
node() {
return this.$root.$children[0].$refs.modeler.highlightedNode.definition;
},
getNodeConfig(newValue) {
this.valueContent = newValue;
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');
}
}
}
}
},
setNodeConfig() {
const existingSetting = JSON.parse(_.get(this.node(), 'errorHandling', '{}'));
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.$root.$on("contentChanged", this.getNodeConfig);
},
beforeDestroy() {
this.$root.$off("contentChanged", this.getNodeConfig);
},
computed: {
helper() {
if (this.type === 'script') {
return this.$t('Set maximum run time in seconds. Leave empty to use script default. Set to 0 for no timeout.');
} else if (this.type === 'data-connector') {
return this.$t('Set maximum run time in seconds. Leave empty to use data connector default. Set to 0 for no timeout.');
}
}
}
}
</script>

<style scoped></style>
<style scoped></style>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down