mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
Merge pull request #2139 from jumpserver/pr@v3@feat_add_account_detail
merge v3
This commit is contained in:
@@ -91,12 +91,12 @@ export default {
|
|||||||
resource: 'account'
|
resource: 'account'
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
'asset', 'username', 'version', 'privileged',
|
'name', 'asset', 'username', 'version', 'privileged',
|
||||||
'secret_type', 'date_created', 'date_updated', 'actions'
|
'secret_type', 'date_created', 'date_updated', 'actions'
|
||||||
],
|
],
|
||||||
columnsShow: {
|
columnsShow: {
|
||||||
min: ['username', 'actions'],
|
min: ['name', 'username', 'actions'],
|
||||||
default: ['hostname', 'ip', 'username', 'version', 'privileged', 'actions']
|
default: ['name', 'hostname', 'ip', 'username', 'version', 'privileged', 'actions']
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
asset: {
|
asset: {
|
||||||
|
@@ -21,6 +21,13 @@ export default [
|
|||||||
app: 'assets',
|
app: 'assets',
|
||||||
permissions: ['assets.view_account']
|
permissions: ['assets.view_account']
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
component: () => import('@/views/accounts/AssetAccount/AssetAccountDetail/index.vue'),
|
||||||
|
name: 'AssetAccountDetail',
|
||||||
|
meta: { title: i18n.t('route.AssetAccount') },
|
||||||
|
hidden: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@@ -24,7 +24,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
object: {},
|
object: {},
|
||||||
config: {
|
config: {
|
||||||
url: '/api/v1/assets/account-templates/',
|
url: '/api/v1/assets/account-templates',
|
||||||
activeMenu: 'Detail',
|
activeMenu: 'Detail',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,89 @@
|
|||||||
|
<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() {
|
||||||
|
const vm = this
|
||||||
|
return {
|
||||||
|
quickActions: [
|
||||||
|
{
|
||||||
|
title: this.$t('assets.PrivilegedTemplate'),
|
||||||
|
type: 'switcher',
|
||||||
|
attrs: {
|
||||||
|
model: vm.object.privileged,
|
||||||
|
disabled: !vm.$hasPerm('assets.change_account')
|
||||||
|
},
|
||||||
|
callbacks: Object.freeze({
|
||||||
|
change: (val) => {
|
||||||
|
this.$axios.patch(
|
||||||
|
`/api/v1/assets/accounts/${this.object.id}/`,
|
||||||
|
{ name: this.object?.name, privileged: val }
|
||||||
|
).then(res => {
|
||||||
|
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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>
|
47
src/views/accounts/AssetAccount/AssetAccountDetail/index.vue
Normal file
47
src/views/accounts/AssetAccount/AssetAccountDetail/index.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<GenericDetailPage
|
||||||
|
:object.sync="TaskDetail"
|
||||||
|
:active-menu.sync="config.activeMenu"
|
||||||
|
v-bind="config"
|
||||||
|
v-on="$listeners"
|
||||||
|
>
|
||||||
|
<keep-alive>
|
||||||
|
<component :is="config.activeMenu" :object="TaskDetail" />
|
||||||
|
</keep-alive>
|
||||||
|
</GenericDetailPage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { GenericDetailPage, TabPage } from '@/layout/components'
|
||||||
|
import Detail from './Detail.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
GenericDetailPage,
|
||||||
|
TabPage,
|
||||||
|
Detail
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
TaskDetail: {},
|
||||||
|
config: {
|
||||||
|
url: '/api/v1/assets/accounts',
|
||||||
|
activeMenu: 'Detail',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
title: this.$t('common.BasicInfo'),
|
||||||
|
name: 'Detail'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
actions: {
|
||||||
|
hasUpdate: () => false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
Reference in New Issue
Block a user