Fixed: Fix the issue of losing the automation status when cloning the platform list. (#4951)

* Fixed: Fix the issue of losing the automation status when cloning the platform list.

* Fixed: Remove console

---------

Co-authored-by: zhaojisen <1301338853@qq.com>
This commit is contained in:
fit2bot 2025-04-14 19:00:51 +08:00 committed by GitHub
parent 6fa4efaa5f
commit 03d1e9a881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,23 +60,20 @@ export default {
url: `/api/v1/assets/platforms/`,
cleanFormValue: (values) => {
const protocols = values['protocols'] || []
const query = this.$route.query || {}
const automation = values['automation'] || {}
const category_type = values['category_type']
const ansibleConfig = automation?.['ansible_config'] || {}
automation.ansible_config = ansibleConfig instanceof Object ? ansibleConfig : JSON.parse(ansibleConfig)
if (query.hasOwnProperty('_clone_from')) {
if (automation.hasOwnProperty('id')) {
delete automation['id']
}
values['protocols'] = protocols.map(i => {
if (i.hasOwnProperty('id')) {
delete i['id']
}
return i
})
if (automation.hasOwnProperty('id')) {
delete automation['id']
}
values['protocols'] = protocols.map(i => {
if (i.hasOwnProperty('id')) {
delete i['id']
}
return i
})
values['category'] = category_type[0]
values['type'] = category_type[1]
return values