[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": "节点", "Node": "节点",
"SystemUser": "系统用户", "SystemUser": "系统用户",
"User": "用户", "User": "用户",
"USER": "用户",
"UserGroups": "用户组", "UserGroups": "用户组",
"addAssetToThisPermission": "添加资产", "addAssetToThisPermission": "添加资产",
"addDatabaseAppToThisPermission": "添加数据库应用", "addDatabaseAppToThisPermission": "添加数据库应用",

View File

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

View File

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

View File

@ -55,7 +55,7 @@ export default {
this.$axios.put( this.$axios.put(
`/api/v1/xpack/change-auth-plan/plan-execution-subtask/${cellValue}/`, `/api/v1/xpack/change-auth-plan/plan-execution-subtask/${cellValue}/`,
).then(res => { ).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) }.bind(this)
} }

View File

@ -75,7 +75,7 @@ export default {
type: 'primary', type: 'primary',
title: this.$t('xpack.ChangeAuthPlan.Log'), title: this.$t('xpack.ChangeAuthPlan.Log'),
callback: function({ cellValue, tableData }) { 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/`, `/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: this.object.id } { plan: this.object.id }
).then(res => { ).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) }.bind(this)
} }

View File

@ -56,7 +56,7 @@ export default {
`/api/v1/xpack/change-auth-plan/plan-execution/`, `/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: data.cellValue } { plan: data.cellValue }
).then(res => { ).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) }.bind(this)
} }

View File

@ -1,6 +1,28 @@
<template> <template>
<div> <div>
<GenericTreeListPage ref="TreeTablePage" :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" /> <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()"> <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 label-position="right" label-width="80px" :model="dialogInfo">
<el-form-item :label="this.$t('assets.Hostname')"> <el-form-item :label="this.$t('assets.Hostname')">
@ -33,7 +55,16 @@ export default {
}, },
data() { data() {
return { return {
MFAConfirmed: false,
MFAInput: '',
MFAInfo: {
asset: '',
username: '',
hostname: '',
password: ''
},
showDialog: false, showDialog: false,
showMFADialog: false,
dialogInfo: { dialogInfo: {
asset: '', asset: '',
username: '', username: '',
@ -93,6 +124,15 @@ export default {
hasDelete: false, // can set function(row, value) hasDelete: false, // can set function(row, value)
canDelete: false, canDelete: false,
extraActions: [ 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', name: 'delete',
title: this.$t('common.Delete'), title: this.$t('common.Delete'),
@ -109,10 +149,10 @@ export default {
callback: (val) => { callback: (val) => {
console.log(val.cellValue) console.log(val.cellValue)
this.$axios.post( this.$axios.post(
`api/v1/assets/asset-users/tasks/?id=${val.cellValue}`, `/api/v1/assets/asset-users/tasks/?id=${val.cellValue}`,
{ action: 'test' } { action: 'test' }
).then(res => { ).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.hostname = val.row.hostname
this.dialogInfo.username = val.row.username this.dialogInfo.username = val.row.username
}.bind(this) }.bind(this)
},
{
name: 'Push',
title: this.$t('common.Push'),
callback: function(val) {
console.log('Push')
}
} }
] ]
} }
@ -142,6 +175,36 @@ export default {
} }
}, },
methods: { 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() { handleCancel() {
this.dialogInfo = { this.dialogInfo = {
asset: '', asset: '',