diff --git a/src/views/assets/Platform/PlatformCreateUpdate.vue b/src/views/assets/Platform/PlatformCreateUpdate.vue index 0fa3f9890..a73429202 100644 --- a/src/views/assets/Platform/PlatformCreateUpdate.vue +++ b/src/views/assets/Platform/PlatformCreateUpdate.vue @@ -62,7 +62,7 @@ export default { } return obj }, - object: {} + defaultOptions: {} } }, async mounted() { @@ -90,7 +90,7 @@ export default { const type = this.$route.query.type const url = `/api/v1/assets/categories/constraints/?category=${category}&type=${type}` const constraints = await this.$axios.get(url) - this.object = constraints + this.defaultOptions = constraints const fieldsCheck = ['protocols_enabled', 'domain_enabled', 'su_enabled'] for (const field of fieldsCheck) { diff --git a/src/views/assets/Platform/PlatformDetail/Automation.vue b/src/views/assets/Platform/PlatformDetail/Automation.vue index 958d7166a..ab18e1390 100644 --- a/src/views/assets/Platform/PlatformDetail/Automation.vue +++ b/src/views/assets/Platform/PlatformDetail/Automation.vue @@ -36,15 +36,19 @@ export default { submitMethod: () => 'patch', fields: [['', ['automation']]], fieldsMeta: platformFieldsMeta(this), - onSubmit: this.submit + onSubmit: this.submit, + defaultOptions: {} } }, computed: { ...mapGetters(['isSystemAdmin']) }, - mounted() { + async mounted() { try { - setAutomations(this) + const { category, type } = this.object + const url = `/api/v1/assets/categories/constraints/?category=${category.value}&type=${type.value}` + this.defaultOptions = await this.$axios.get(url) + await setAutomations(this) } finally { this.loading = false } diff --git a/src/views/assets/Platform/const.js b/src/views/assets/Platform/const.js index 879078956..163ca1a01 100644 --- a/src/views/assets/Platform/const.js +++ b/src/views/assets/Platform/const.js @@ -78,7 +78,7 @@ export const platformFieldsMeta = (vm) => { } export const setAutomations = (vm) => { - const automation = vm.object.automation || {} + const automation = vm.defaultOptions.automation || {} const autoFieldsMeta = vm.fieldsMeta.automation.fieldsMeta const autoFields = vm.fieldsMeta.automation.fields .filter(item => item.endsWith('_method'))