feat: 增加账号模版模块

This commit is contained in:
“huailei000”
2022-10-28 19:05:58 +08:00
committed by huailei
parent d8deab799e
commit 8551426619
8 changed files with 275 additions and 0 deletions

View File

@@ -95,6 +95,8 @@
"assets": {
"SelectTemplate": "Select template",
"InAssetDetail": "Update account information in asset details",
"SecretType": "Secret type",
"PrivilegedTemplate": "Privileged",
"All": "All",
"CloudPlatform": "Cloud platform",
"RecentlyUsed": "Recently used",
@@ -716,6 +718,9 @@
"SessionDetail": "SessionDetail",
"Accounts": "Accounts",
"AssetAccount": "Asset Account",
"AccountTemplate": "Account template",
"CreateAccountTemplate": "Create account template",
"UpdateAccountTemplate": "Update account template",
"AssetHistoryAccount": "Asset History Account",
"ApplicationAccount": "Application Account",
"Ticket": "Tickets",

View File

@@ -100,6 +100,8 @@
"assets": {
"SelectTemplate": "テンプレートの選択",
"InAssetDetail": "資産詳細でのアカウント情報の更新",
"SecretType": "機密タイプ",
"PrivilegedTemplate": "特権的",
"All": "すべて",
"CloudPlatform": "クラウドプラットフォーム",
"RecentlyUsed": "最近使われる",
@@ -724,6 +726,9 @@
"TicketFlowUpdate": "承認フローの更新",
"Accounts": "アカウント管理",
"AssetAccount": "資産アカウント",
"AccountTemplate": "アカウントテンプレート",
"CreateAccountTemplate": "アカウントテンプレートの作成",
"UpdateAccountTemplate": "アカウントテンプレートの更新",
"AssetHistoryAccount": "資産履歴",
"ApplicationAccount": "アプリアカウント",
"Ticket": "ワークオーダー",

View File

@@ -100,6 +100,8 @@
"assets": {
"SelectTemplate": "选择模版",
"InAssetDetail": "在资产详情中更新账号信息",
"SecretType": "密文类型",
"PrivilegedTemplate": "特权的",
"Address": "地址",
"PrivateKey": "密钥",
"Secret": "密码",
@@ -737,6 +739,9 @@
"TicketFlowUpdate": "更新审批流",
"Accounts": "账号管理",
"AssetAccount": "资产账号",
"AccountTemplate": "账号模版",
"CreateAccountTemplate": "创建账号模版",
"UpdateAccountTemplate": "更新账号模版",
"AssetHistoryAccount": "资产历史账号",
"ApplicationAccount": "应用账号",
"Ticket": "工单",

View File

@@ -34,6 +34,54 @@ export default [
}
]
},
{
path: 'account-template',
component: empty,
meta: {
title: i18n.t('route.AccountTemplate'),
app: 'assets',
permissions: ['assets.view_accounttemplate']
},
redirect: '',
children: [
{
path: '',
name: 'AccountTemplateList',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateList'),
meta: {
title: i18n.t('route.AccountTemplate'),
permissions: ['assets.view_accounttemplate']
}
},
{
path: 'create',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
name: 'AccountTemplateCreate',
meta: {
title: i18n.t('route.CreateAccountTemplate'),
action: 'create'
},
hidden: true
},
{
path: ':id/update',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
name: 'AccountTemplateUpdate',
meta: {
title: i18n.t('route.UpdateAccountTemplate'),
action: 'update'
},
hidden: true
},
{
path: ':id',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateDetail/index.vue'),
name: 'AccountTemplateDetail',
meta: { title: i18n.t('route.AccountTemplate') },
hidden: true
}
]
},
{
path: 'gathered-user',
component: empty,

View File

@@ -0,0 +1,34 @@
<template>
<GenericCreateUpdatePage v-bind="$data" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'GatewayCreateUpdate',
components: {
GenericCreateUpdatePage
},
data() {
return {
initial: {},
url: '/api/v1/assets/account-templates/',
hasDetailInMsg: false,
fields: [
[this.$t('common.Basic'), ['name', 'username', 'privileged']],
[this.$t('assets.Secret'), ['secret_type', 'secret']],
[this.$t('common.Other'), ['comment']]
],
fieldsMeta: {
},
createSuccessNextRoute: { name: 'AccountTemplateList' },
updateSuccessNextRoute: { name: 'AccountTemplateList' }
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,90 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<DetailCard :items="detailCardItems" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions type="primary" :actions="quickActions" />
</el-col>
</el-row>
</template>
<script>
import DetailCard from '@/components/DetailCard'
import QuickActions from '@/components/QuickActions'
import { toSafeLocalDateStr } from '@/utils/common'
export default {
name: 'Detail',
components: {
DetailCard,
QuickActions
},
props: {
object: {
type: Object,
default: () => {}
}
},
data() {
return {
quickActions: [
{
title: this.$t('assets.PrivilegedTemplate'),
type: 'switcher',
attrs: {
model: this.object?.privileged,
disabled: !this.$hasPerm('assets.change_accounttemplate')
},
callbacks: {
change: function(val) {
this.$axios.patch(
'/api/v1/assets/account-templates/',
{ privileged: val }
).then(res => {
this.$message.success(this.$t('common.updateSuccessMsg'))
}).catch(err => {
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
})
}.bind(this)
}
}
]
}
},
computed: {
detailCardItems() {
return [
{
key: this.$t('assets.Name'),
value: this.object.name
},
{
key: this.$t('users.Username'),
value: this.object.username
},
{
key: this.$t('assets.SecretType'),
value: this.object.secret_type
},
{
key: this.$t('xpack.ChangeAuthPlan.DateJoined'),
value: toSafeLocalDateStr(this.object.date_created)
},
{
key: this.$t('xpack.ChangeAuthPlan.DateUpdated'),
value: toSafeLocalDateStr(this.object.date_updated)
},
{
key: this.$t('assets.Comment'),
value: this.object.comment
}
]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,43 @@
<template>
<GenericDetailPage
:object.sync="object"
:active-menu.sync="config.activeMenu"
v-bind="config"
v-on="$listeners"
>
<keep-alive>
<component :is="config.activeMenu" :object="object" />
</keep-alive>
</GenericDetailPage>
</template>
<script>
import { GenericDetailPage, TabPage } from '@/layout/components'
import Detail from './Detail.vue'
export default {
components: {
GenericDetailPage,
TabPage,
Detail
},
data() {
return {
object: {},
config: {
url: '/api/v1/assets/account-templates/',
activeMenu: 'Detail',
submenu: [
{
title: this.$t('common.BasicInfo'),
name: 'Detail'
}
]
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,45 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
</template>
<script>
import { GenericListPage } from '@/layout/components'
export default {
name: 'AccountBackupPlanList',
components: {
GenericListPage
},
data() {
return {
tableConfig: {
url: '/api/v1/assets/account-templates/',
columns: ['name', 'username', 'privileged', 'actions'],
columnsShow: {
min: ['name', 'actions']
},
columnsMeta: {
privileged: {
width: '100px'
}
}
},
headerActions: {
hasRefresh: true,
hasExport: false,
hasImport: false,
hasMoreActions: false,
createRoute: () => {
return {
name: 'AccountTemplateCreate'
}
}
}
}
}
}
</script>
<style scoped>
</style>