mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-18 16:32:28 +00:00
perf: 修改<工作台-我的资产>页面;修改<控制台-用户详情>页面;修改<GrantedSystemUsersShowFormatter>为<GrantedAccountShowFormatter>组件;
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
import { DetailFormatter, SystemUserFormatter } from '@/components/TableFormatters'
|
||||
import { DetailFormatter, AccountShowFormatter } from '@/components/TableFormatters'
|
||||
import TreeTable from '../TreeTable'
|
||||
|
||||
export default {
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
getShowUrl: {
|
||||
type: Function,
|
||||
default({ row, col }) {
|
||||
return this.tableUrl.replace('/assets/', `/assets/${row.id}/system-users/?cache_policy=1`)
|
||||
return this.tableUrl.replace('/assets/', `/assets/${row.id}/accounts/?cache_policy=1`)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -59,8 +59,8 @@ export default {
|
||||
hasTree: true,
|
||||
columns: [
|
||||
{
|
||||
prop: 'hostname',
|
||||
label: this.$t('assets.Hostname'),
|
||||
prop: 'name',
|
||||
label: this.$t('assets.Name'),
|
||||
formatter: DetailFormatter,
|
||||
sortable: true,
|
||||
formatterArgs: {
|
||||
@@ -69,16 +69,16 @@ export default {
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'ip',
|
||||
label: this.$t('assets.IP'),
|
||||
prop: 'address',
|
||||
label: this.$t('assets.Address'),
|
||||
width: '140px',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
prop: 'systemUsers',
|
||||
label: this.$t('assets.SystemUsers'),
|
||||
prop: 'accounts',
|
||||
label: this.$t('assets.Account'),
|
||||
align: 'center',
|
||||
formatter: SystemUserFormatter,
|
||||
formatter: AccountShowFormatter,
|
||||
formatterArgs: {
|
||||
getUrl: this.getShowUrl.bind(this)
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<span v-if="!systemUsers"><a style="color: #1c84c6;" @click="showSystemUser">{{ this.$t('common.Show') }}</a></span>
|
||||
<span v-else>{{ systemUsers.toString() }}</span>
|
||||
<span v-if="!accounts"><a style="color: #1c84c6;" @click="showAccount">{{ this.$t('common.Show') }}</a></span>
|
||||
<span v-else>{{ accounts.toString() }}</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -20,15 +20,15 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
systemUsers: null
|
||||
accounts: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async showSystemUser() {
|
||||
async showAccount() {
|
||||
const formatterArgs = Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
|
||||
const url = formatterArgs.getUrl({ row: this.row, col: this.col })
|
||||
const data = await this.$axios.get(url)
|
||||
this.systemUsers = data.map((item) => item.name)
|
||||
this.accounts = data.map((item) => item.name)
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@ import ChoicesFormatter from './ChoicesFormatter'
|
||||
import ActionsFormatter from './ActionsFormatter'
|
||||
import DeleteActionFormatter from './DeleteActionFormatter'
|
||||
import DateFormatter from './DateFormatter'
|
||||
import SystemUserFormatter from './GrantedSystemUsersShowFormatter'
|
||||
import AccountShowFormatter from './GrantedAccountShowFormatter'
|
||||
import ShowKeyCopyFormatter from './ShowKeyCopyFormatter'
|
||||
import DialogDetailFormatter from './DialogDetailFormatter'
|
||||
import EditableInputFormatter from './EditableInputFormatter'
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
ActionsFormatter,
|
||||
DeleteActionFormatter,
|
||||
DateFormatter,
|
||||
SystemUserFormatter,
|
||||
AccountShowFormatter,
|
||||
ShowKeyCopyFormatter,
|
||||
DialogDetailFormatter,
|
||||
ArrayFormatter,
|
||||
@@ -37,7 +37,7 @@ export {
|
||||
ActionsFormatter,
|
||||
DeleteActionFormatter,
|
||||
DateFormatter,
|
||||
SystemUserFormatter,
|
||||
AccountShowFormatter,
|
||||
ShowKeyCopyFormatter,
|
||||
DialogDetailFormatter,
|
||||
ArrayFormatter,
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
<script>
|
||||
import GenericTreeListPage from '@/layout/components/GenericTreeListPage'
|
||||
import { SystemUserFormatter, DialogDetailFormatter } from '@/components/TableFormatters'
|
||||
import { AccountShowFormatter, DialogDetailFormatter } from '@/components/TableFormatters'
|
||||
export default {
|
||||
components: {
|
||||
GenericTreeListPage
|
||||
@@ -22,22 +22,22 @@ export default {
|
||||
showMenu: false,
|
||||
showRefresh: true,
|
||||
showAssets: false,
|
||||
url: '/api/v1/perms/users/assets/',
|
||||
nodeUrl: '/api/v1/perms/users/nodes/',
|
||||
url: '/api/v1/perms/my/users/assets/',
|
||||
nodeUrl: '/api/v1/perms/my/users/nodes/',
|
||||
// ?assets=0不显示资产. =1显示资产
|
||||
treeUrl: '/api/v1/perms/users/nodes/children/tree/?cache_policy=2',
|
||||
treeUrl: '/api/v1/perms/users/my/nodes/children/tree/?cache_policy=2',
|
||||
callback: {
|
||||
refresh: () => {},
|
||||
onSelected: function(event, treeNode) {
|
||||
if (treeNode.meta.type === 'node') {
|
||||
const currentNodeId = treeNode.meta.data.id
|
||||
this.tableConfig.url = `/api/v1/perms/users/nodes/${currentNodeId}/assets/?cache_policy=1`
|
||||
this.tableConfig.url = `/api/v1/perms/users/my/nodes/${currentNodeId}/assets/?cache_policy=1`
|
||||
}
|
||||
}.bind(this)
|
||||
}
|
||||
},
|
||||
tableConfig: {
|
||||
url: '/api/v1/perms/users/assets/',
|
||||
url: '/api/v1/perms/users/my/assets/',
|
||||
hasTree: true,
|
||||
columns: ['name', 'address', 'platform', 'category', 'accounts', 'type', 'comment', 'actions'],
|
||||
columnsShow: {
|
||||
@@ -91,19 +91,19 @@ export default {
|
||||
},
|
||||
sortable: true
|
||||
},
|
||||
ip: {
|
||||
address: {
|
||||
sortable: 'custom',
|
||||
width: '150px'
|
||||
},
|
||||
system_users: {
|
||||
accounts: {
|
||||
showOverflowTooltip: true,
|
||||
align: 'center',
|
||||
label: this.$t('assets.SystemUsers'),
|
||||
label: this.$t('assets.Account'),
|
||||
width: '120px',
|
||||
formatter: SystemUserFormatter,
|
||||
formatter: AccountShowFormatter,
|
||||
formatterArgs: {
|
||||
getUrl: ({ row }) => {
|
||||
return `/api/v1/perms/users/assets/${row.id}/system-users/?cache_policy=1`
|
||||
return `/api/v1/perms/users/my/assets/${row.id}/accounts/?cache_policy=1`
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -46,12 +46,12 @@ export default {
|
||||
name: 'UserGrantedAssets',
|
||||
hidden: () => !vm.$hasPerm('perms.view_userassets')
|
||||
},
|
||||
{
|
||||
title: this.$t('users.tabs.grantedAccounts'),
|
||||
name: 'UserGrantedAccounts',
|
||||
// Todo: perms.view_useraccounts
|
||||
hidden: () => !vm.$hasPerm('perms.view_userassets')
|
||||
},
|
||||
// {
|
||||
// title: this.$t('users.tabs.grantedAccounts'),
|
||||
// name: 'UserGrantedAccounts',
|
||||
// // Todo: perms.view_useraccounts
|
||||
// hidden: () => !vm.$hasPerm('perms.view_userassets')
|
||||
// },
|
||||
{
|
||||
title: this.$t('users.tabs.assetPermissionRules'),
|
||||
name: 'UserAssetPermissionRules',
|
||||
|
Reference in New Issue
Block a user