feat: 添加批量测试资产可连接性功能 (#590)

* feat: 添加批量测试资产可连接性功能

* feat: 添加批量测试资产可连接性功能

Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot 2021-01-20 14:56:03 +08:00 committed by GitHub
parent 5889e20aae
commit f58e37a76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,14 @@ export default {
return selectedRows.length > 0 && vm.object.auto_push
},
callback: this.bulkPushCallback.bind(this)
},
{
title: this.$t('assets.TestAssetsConnective'),
name: 'TestSelected',
can({ selectedRows }) {
return selectedRows.length > 0 && vm.object.auto_push
},
callback: this.bulkTestCallback.bind(this)
}
]
},
@ -214,7 +222,17 @@ export default {
})
const data = { action: 'push', assets: assets }
this.$axios.post(theUrl, data).then(resp => {
window.open(`/#/ops/celery/task/${resp.task}/log/`, '', 'width=900,height=600')
window.open(`/#/ops/task/task/${resp.task}/log/`, '', 'width=900,height=600')
})
},
bulkTestCallback({ selectedRows }) {
const theUrl = `/api/v1/assets/system-users/${this.object.id}/tasks/`
const assets = selectedRows.map((v) => {
return v.asset
})
const data = { action: 'test', assets: assets }
this.$axios.post(theUrl, data).then(resp => {
window.open(`/#/ops/task/task/${resp.task}/log/`, '', 'width=900,height=600')
})
}
}