[fix]添加密码匣子查看功能,删除重复路由

This commit is contained in:
OrangeM21 2020-06-08 12:07:14 +08:00
parent c0ad1fdb32
commit 576a09f44f
8 changed files with 85 additions and 20 deletions

View File

@ -333,6 +333,7 @@
"Node": "节点",
"SystemUser": "系统用户",
"User": "用户",
"USER": "用户",
"UserGroups": "用户组",
"addAssetToThisPermission": "添加资产",
"addDatabaseAppToThisPermission": "添加数据库应用",

View File

@ -330,6 +330,7 @@
"Node": "Node",
"SystemUser": "System user",
"User": "User",
"USER": "User",
"UserGroups": "UserGroups",
"addAssetToThisPermission": "Add asset to this permission",
"addDatabaseAppToThisPermission": "Add DatabaseApp to this permission",

View File

@ -34,13 +34,13 @@ export default [
component: () => import('@/views/ops/CommandExecution'),
meta: { title: i18n.t('route.BatchCommand') }
},
{
path: 'celery/task/:id',
component: () => import('@/views/ops/CeleryTaskLog'),
name: 'CeleryTaskLog',
hidden: true,
meta: { title: i18n.t('route.CeleryTaskLog') }
},
// {
// path: 'celery/task/:id',
// component: () => import('@/views/ops/CeleryTaskLog'),
// name: 'CeleryTaskLog',
// hidden: true,
// meta: { title: i18n.t('route.CeleryTaskLog') }
// },
{
path: 'task/monitor',
name: 'TaskMonitor',

View File

@ -55,7 +55,7 @@ export default {
this.$axios.put(
`/api/v1/xpack/change-auth-plan/plan-execution-subtask/${cellValue}/`,
).then(res => {
window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
window.open(`/#/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
})
}.bind(this)
}

View File

@ -75,7 +75,7 @@ export default {
type: 'primary',
title: this.$t('xpack.ChangeAuthPlan.Log'),
callback: function({ cellValue, tableData }) {
window.open(`/core/ops/celery/task/${cellValue}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
window.open(`/#/ops/celery/task/${cellValue}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
}
},
{

View File

@ -40,7 +40,7 @@ export default {
`/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: this.object.id }
).then(res => {
window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
window.open(`/#/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
})
}.bind(this)
}

View File

@ -56,7 +56,7 @@ export default {
`/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: data.cellValue }
).then(res => {
window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
window.open(`/#/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
})
}.bind(this)
}

View File

@ -1,6 +1,28 @@
<template>
<div>
<GenericTreeListPage ref="TreeTablePage" :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" />
<Dialog width="25%" :title="this.$t('common.MFAConfirm')" :visible.sync="showMFADialog" :show-confirm="false" @cancel="handleMFAConfirm()">
<div v-if="MFAConfirmed">
<el-form label-position="right" label-width="80px" :model="MFAInfo">
<el-form-item :label="this.$t('assets.Hostname')">
<el-input v-model="MFAInfo.hostname" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Username')">
<el-input v-model="MFAInfo.username" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Password')">
<el-input v-model="MFAInfo.password" type="password" show-password />
</el-form-item>
</el-form>
</div>
<div v-else style="display: flex;justify-content:space-between;">
<div style="line-height: 34px;text-align: center">MFA</div>
<div style="width: 70%">
<el-input v-model="MFAInput" />
</div>
<el-button size="small" type="primary" @click="MFAConfirm">{{ this.$t('common.Confirm') }}</el-button>
</div>
</Dialog>
<Dialog width="50" :title="this.$t('assets.UpdateAssetUserToken')" :visible.sync="showDialog" @confirm="handleConfirm()" @cancel="handleCancel()">
<el-form label-position="right" label-width="80px" :model="dialogInfo">
<el-form-item :label="this.$t('assets.Hostname')">
@ -33,7 +55,16 @@ export default {
},
data() {
return {
MFAConfirmed: false,
MFAInput: '',
MFAInfo: {
asset: '',
username: '',
hostname: '',
password: ''
},
showDialog: false,
showMFADialog: false,
dialogInfo: {
asset: '',
username: '',
@ -93,6 +124,15 @@ export default {
hasDelete: false, // can set function(row, value)
canDelete: false,
extraActions: [
{
name: this.$t('common.View'),
title: this.$t('common.View'),
type: 'primary',
callback: function(val) {
this.MFAInfo.asset = val.cellValue
this.showMFADialog = true
}.bind(this)
},
{
name: 'delete',
title: this.$t('common.Delete'),
@ -109,10 +149,10 @@ export default {
callback: (val) => {
console.log(val.cellValue)
this.$axios.post(
`api/v1/assets/asset-users/tasks/?id=${val.cellValue}`,
`/api/v1/assets/asset-users/tasks/?id=${val.cellValue}`,
{ action: 'test' }
).then(res => {
window.open(`/core/ops/celery/task/${res.task}/log/`, '', 'width=900,height=600')
window.open(`/#/ops/celery/task/${res.task}/log/`, '', 'width=900,height=600')
})
}
},
@ -126,13 +166,6 @@ export default {
this.dialogInfo.hostname = val.row.hostname
this.dialogInfo.username = val.row.username
}.bind(this)
},
{
name: 'Push',
title: this.$t('common.Push'),
callback: function(val) {
console.log('Push')
}
}
]
}
@ -142,6 +175,36 @@ export default {
}
},
methods: {
MFAConfirm() {
if (this.MFAInput.length !== 6) {
return this.$message.error(this.$t('common.updateErrorMsg'))
}
this.$axios.post(
`/api/v1/authentication/otp/verify/`, {
code: this.MFAInput
}
).then(
res => {
this.$axios.get(`/api/v1/assets/asset-user-auth-infos/${this.MFAInfo.asset}/`).then(res => {
this.MFAConfirmed = true
this.MFAInfo.hostname = res.hostname
this.MFAInfo.password = res.password
this.MFAInfo.username = res.username
})
}
)
},
handleMFAConfirm() {
this.MFAInfo = {
asset: '',
username: '',
hostname: '',
password: ''
}
this.MFAInput = ''
this.showMFADialog = false
this.MFAConfirmed = false
},
handleCancel() {
this.dialogInfo = {
asset: '',