[Update] 完善改密计划详情页面(2)

This commit is contained in:
Bai
2020-05-25 14:43:59 +08:00
parent 7184f0c02b
commit c4c8a318a8
7 changed files with 134 additions and 79 deletions

View File

@@ -608,13 +608,8 @@
} }
}, },
"xpack": { "xpack": {
"PasswordStrategy": "密码策略",
"PasswordLength": "密码长度",
"CyclePerform": "周期执行",
"RegularlyPerform": "定期执行",
"Basic": "基本", "Basic": "基本",
"Other": "其他", "Other": "其他",
"Run": "执行",
"Admin": "管理员", "Admin": "管理员",
"AssetCount": "资产数量", "AssetCount": "资产数量",
"Auditor": "审计员", "Auditor": "审计员",
@@ -625,11 +620,23 @@
"AdminUser": "管理用户", "AdminUser": "管理用户",
"SystemUser": "系统用户", "SystemUser": "系统用户",
"Label": "标签", "Label": "标签",
"assetAndNode": "资产或节点",
"ChangeAuthPlan": { "ChangeAuthPlan": {
"ChangeAuthPlan": "改密计划", "ChangeAuthPlan": "改密计划",
"ChangeAuthPlanCreate": "创建改密计划", "ChangeAuthPlanCreate": "创建改密计划",
"ChangeAuthPlanUpdate": "更新改密计划", "ChangeAuthPlanUpdate": "更新改密计划",
"ChangeAuthPlanDetail": "改密计划详情" "ChangeAuthPlanDetail": "改密计划详情",
"ExecutionList": "执行列表",
"Name": "名称",
"Username": "用户名",
"PasswordStrategy": "密码策略",
"PasswordLength": "密码长度",
"CyclePerform": "周期执行",
"RegularlyPerform": "定期执行",
"DateJoined": "创建日期",
"DateUpdated": "更新日期",
"ManualRunPlan": "手动执行计划",
"Run": "执行"
}, },
"Corporation": "公司", "Corporation": "公司",
"Edition": "版本", "Edition": "版本",

View File

@@ -17,7 +17,7 @@ export default {
fields: [ fields: [
[this.$t('xpack.Basic'), ['name']], [this.$t('xpack.Basic'), ['name']],
[this.$t('xpack.Asset'), ['username', 'assets', 'nodes']], [this.$t('xpack.Asset'), ['username', 'assets', 'nodes']],
[this.$t('xpack.PasswordStrategy'), ['password_strategy', 'password', 'password_rules_length']], [this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules_length']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']], [this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('xpack.Other'), ['comment']] [this.$t('xpack.Other'), ['comment']]
], ],
@@ -46,7 +46,7 @@ export default {
}, },
password_rules_length: { password_rules_length: {
type: 'input', type: 'input',
label: this.$t('xpack.PasswordLength'), label: this.$t('xpack.ChangeAuthPlan.PasswordLength'),
hidden: (formValue) => { hidden: (formValue) => {
return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1 return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1
} }
@@ -72,7 +72,7 @@ export default {
type: 'switch' type: 'switch'
}, },
crontab: { crontab: {
label: this.$t('xpack.RegularlyPerform'), label: this.$t('xpack.ChangeAuthPlan.RegularlyPerform'),
hidden: (formValue) => { hidden: (formValue) => {
return formValue.is_periodic === false return formValue.is_periodic === false
}, },
@@ -86,7 +86,7 @@ export default {
'' ''
}, },
interval: { interval: {
label: this.$t('xpack.CyclePerform'), label: this.$t('xpack.ChangeAuthPlan.CyclePerform'),
hidden: (formValue) => { hidden: (formValue) => {
return formValue.is_periodic === false return formValue.is_periodic === false
}, },

View File

@@ -1,57 +0,0 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<DetailCard :items="detailItems" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions :actions="quickActions" type="primary" />
</el-col>
</el-row>
</template>
<script>
import { DetailCard, QuickActions } from '@/components'
export default {
name: 'ChangeAuthPlanInfo',
components: {
DetailCard,
QuickActions
},
props: {
object: {
type: Object,
default: () => ({})
}
},
data() {
return {
quickActions: [
]
}
},
computed: {
detailItems() {
return [
{
key: 'name',
value: this.object.name
},
{
key: 'username',
value: this.object.username
},
{
key: 'password strategy',
value: this.object.password_strategy
}
]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,94 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<DetailCard :items="detailItems" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions :actions="quickActions" type="primary" />
</el-col>
</el-row>
</template>
<script>
import { DetailCard, QuickActions } from '@/components'
export default {
name: 'ChangeAuthPlanInfo',
components: {
DetailCard,
QuickActions
},
props: {
object: {
type: Object,
default: () => ({})
}
},
data() {
return {
quickActions: [
{
title: this.$t('xpack.ChangeAuthPlan.ManualRunPlan'),
attrs: {
type: 'primary',
label: this.$t('xpack.ChangeAuthPlan.Run')
},
callbacks: {
click: function() {
this.$axios.post(
`/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: this.object.id }
).then(res => {
window.open(`/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
})
}.bind(this)
}
}
]
}
},
computed: {
detailItems() {
return [
{
key: this.$t('xpack.ChangeAuthPlan.Name'),
value: this.object.name
},
{
key: this.$t('xpack.ChangeAuthPlan.Username'),
value: this.object.username
},
{
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
value: this.object.password_strategy_display
},
{
key: this.$t('xpack.ChangeAuthPlan.RegularlyPerform'),
value: this.object.crontab
},
{
key: this.$t('xpack.ChangeAuthPlan.CyclePerform'),
value: this.object.interval
},
{
key: this.$t('xpack.ChangeAuthPlan.DateJoined'),
value: this.object.date_created
},
{
key: this.$t('xpack.ChangeAuthPlan.DateUpdated'),
value: this.object.date_updated
},
{
key: this.$t('common.Comment'),
value: this.object.comment
}
]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -8,12 +8,16 @@
<script> <script>
import { GenericDetailPage } from '@/layout/components' import { GenericDetailPage } from '@/layout/components'
import ChangeAuthPlanInfo from './ChangeAuthPlanDetail' import ChangeAuthPlanInfo from './ChangeAuthPlanInfo'
import ChangeAuthPlanAsset from './ChangeAuthPlanAsset'
import ChangeAuthPlanExecutionList from './ChangeAuthPlanExecution/ChangeAuthPlanExecutionList'
export default { export default {
components: { components: {
GenericDetailPage, GenericDetailPage,
ChangeAuthPlanInfo ChangeAuthPlanInfo,
ChangeAuthPlanAsset,
ChangeAuthPlanExecutionList
}, },
data() { data() {
return { return {
@@ -24,6 +28,14 @@ export default {
{ {
title: this.$t('common.BasicInfo'), title: this.$t('common.BasicInfo'),
name: 'ChangeAuthPlanInfo' name: 'ChangeAuthPlanInfo'
},
{
title: this.$t('xpack.assetAndNode'),
name: 'ChangeAuthPlanAsset'
},
{
title: this.$t('xpack.ChangeAuthPlan.ExecutionList'),
name: 'ChangeAuthPlanExecutionList'
} }
] ]
} }

View File

@@ -34,18 +34,17 @@ export default {
actions: { actions: {
extraActions: [ extraActions: [
{ {
title: vm.$t('xpack.Run'), title: vm.$t('xpack.ChangeAuthPlan.Run'),
name: 'run', name: 'run',
type: 'info', type: 'info',
callback: function({ cellValue, tableData }) { callback: function(data) {
const newPage = vm.$router.resolve({ this.$axios.post(
name: 'CeleryTaskLog', `/api/v1/xpack/change-auth-plan/plan-execution/`,
query: { { plan: data.cellValue }
id: 12345678 ).then(res => {
} window.open(`/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
}) })
window.open(newPage.href, '_blank', 'toolbar=yes, width=900, height=600') }.bind(this)
}
} }
] ]
} }

View File

@@ -106,7 +106,7 @@ export default {
path: 'plan/:id', path: 'plan/:id',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/index.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/index.vue'),
name: 'ChangeAuthPlanDetail', name: 'ChangeAuthPlanDetail',
meta: { title: i18n.t('xpack.ChangeAuthPlanDetail'), activeMenu: '/xpack/change-auth-plan' }, meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan' },
hidden: true hidden: true
}, },
{ {