fix: 添加WS链接类型 (#585)

* fix: 添加WS链接类型


Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot
2021-01-19 17:12:52 +08:00
committed by GitHub
parent 36767cd265
commit 08facb1eda
3 changed files with 12 additions and 2 deletions

View File

@@ -45,5 +45,12 @@ export default [
name: 'CeleryTaskLog',
hidden: true,
meta: { title: i18n.t('route.CeleryTaskLog'), roles: ['SuperAdmin', 'Admin', 'Auditor', 'User'] }
},
{
path: '/ops/task/task/:id/log/',
component: () => import('@/views/ops/CeleryTaskLog'),
name: 'TaskLog',
hidden: true,
meta: { title: i18n.t('route.CeleryTaskLog'), roles: ['SuperAdmin', 'Admin', 'Auditor', 'User'] }
}
]

View File

@@ -8,11 +8,14 @@ import { Terminal } from 'xterm'
import { FitAddon } from 'xterm-addon-fit'
export default {
name: 'CeleryTaskLog',
props: {
},
data() {
return {
xterm: null,
ws: null,
taskId: this.$route.params.id,
type: this.$route.params.type || this.$route.query.type || 'celery',
url: '/ws/ops/tasks/log/',
failOverPort: process.env.VUE_APP_WS_PORT
}
@@ -71,7 +74,7 @@ export default {
this.xterm.write(data.message)
}
this.ws.onopen = (e) => {
const msg = { 'task': this.taskId }
const msg = { 'task': this.taskId, 'type': this.type }
this.ws.send(JSON.stringify(msg))
}
},

View File

@@ -77,7 +77,7 @@ export default {
value: this.object.id,
formatter: function(row, value) {
const onClick = function() {
window.open(`/#/ops/celery/task/${value}/log/`, '', 'width=900,height=600')
window.open(`/#/ops/task/task/${value}/log/?type=ansible`, '', 'width=900,height=600')
}
const title = this.$t('common.View')
return <a onClick={onClick} >{ title }</a>