mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 22:48:27 +00:00
perf: 授权的资产列表中支持查看某个资产授权的账号
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import TreeTable from '../../Table/TreeTable/index.vue'
|
import TreeTable from '../../Table/TreeTable/index.vue'
|
||||||
import { DetailFormatter } from '@/components/Table/TableFormatters'
|
import { DetailFormatter } from '@/components/Table/TableFormatters'
|
||||||
|
import { AccountInfoFormatter } from '@/components/Table/TableFormatters'
|
||||||
import { connectivityMeta } from '@/components/Apps/AccountListTable/const'
|
import { connectivityMeta } from '@/components/Apps/AccountListTable/const'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -58,10 +59,11 @@ export default {
|
|||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: this.tableUrl,
|
url: this.tableUrl,
|
||||||
hasTree: true,
|
hasTree: true,
|
||||||
|
columnsExtra: ['view_account'],
|
||||||
columnsExclude: ['spec_info'],
|
columnsExclude: ['spec_info'],
|
||||||
columnsShow: {
|
columnsShow: {
|
||||||
min: ['name', 'address', 'accounts'],
|
min: ['name', 'address', 'accounts'],
|
||||||
default: ['name', 'address', 'platform', 'connectivity']
|
default: ['name', 'address', 'platform', 'view_account', 'connectivity']
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
name: {
|
name: {
|
||||||
@@ -73,6 +75,11 @@ export default {
|
|||||||
actions: {
|
actions: {
|
||||||
has: false
|
has: false
|
||||||
},
|
},
|
||||||
|
view_account: {
|
||||||
|
label: this.$t('assets.Account'),
|
||||||
|
formatter: AccountInfoFormatter,
|
||||||
|
width: '100px'
|
||||||
|
},
|
||||||
connectivity: connectivityMeta
|
connectivity: connectivityMeta
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -0,0 +1,57 @@
|
|||||||
|
<template>
|
||||||
|
<el-popover
|
||||||
|
:title="title"
|
||||||
|
placement="left-start"
|
||||||
|
trigger="click"
|
||||||
|
@show="getAsyncItems"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div v-for="account of accountData" :key="account.id" class="detail-item">
|
||||||
|
<span>{{ account.name }}({{ account.username }})</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-button slot="reference" size="mini" type="primary">{{ $t('common.View') }}</el-button>
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseFormatter from './base.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SwitchFormatter',
|
||||||
|
extends: BaseFormatter,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs),
|
||||||
|
value: this.cellValue,
|
||||||
|
accountData: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
title() {
|
||||||
|
return this.formatterArgs.title || this.col.label
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getAsyncItems() {
|
||||||
|
const userId = this.$route.params.id
|
||||||
|
const url = `api/v1/perms/users/${userId}/assets/${this.row.id}`
|
||||||
|
this.$axios.get(url).then(res => {
|
||||||
|
this.accountData = res?.permed_accounts || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.detail-item {
|
||||||
|
border-bottom: 1px solid #EBEEF5;
|
||||||
|
padding: 5px 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #F5F7FA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -17,6 +17,7 @@ import TwoTabFormatter from './TwoTabFormatter.vue'
|
|||||||
import ProtocolsFormatter from './ProtocolsFormatter.vue'
|
import ProtocolsFormatter from './ProtocolsFormatter.vue'
|
||||||
import TagChoicesFormatter from './TagChoicesFormatter.vue'
|
import TagChoicesFormatter from './TagChoicesFormatter.vue'
|
||||||
import SwitchFormatter from './SwitchFormatter.vue'
|
import SwitchFormatter from './SwitchFormatter.vue'
|
||||||
|
import AccountInfoFormatter from './AccountInfoFormatter.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
DetailFormatter,
|
DetailFormatter,
|
||||||
@@ -37,7 +38,8 @@ export default {
|
|||||||
ProtocolsFormatter,
|
ProtocolsFormatter,
|
||||||
TagChoicesFormatter,
|
TagChoicesFormatter,
|
||||||
LabelsFormatter,
|
LabelsFormatter,
|
||||||
SwitchFormatter
|
SwitchFormatter,
|
||||||
|
AccountInfoFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -59,5 +61,6 @@ export {
|
|||||||
ProtocolsFormatter,
|
ProtocolsFormatter,
|
||||||
TagChoicesFormatter,
|
TagChoicesFormatter,
|
||||||
LabelsFormatter,
|
LabelsFormatter,
|
||||||
SwitchFormatter
|
SwitchFormatter,
|
||||||
|
AccountInfoFormatter
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user