Merge branch 'v3' of github.com:jumpserver/lina into v3

This commit is contained in:
ibuler
2022-11-01 20:37:58 +08:00
9 changed files with 102 additions and 5 deletions

View File

@@ -29,7 +29,7 @@ export default {
loading: true,
usernameChanged: false,
url: '/api/v1/assets/accounts/',
form: this.account || { },
form: this.account || {},
fields: [
[this.$t('common.Basic'), ['name', 'username', 'privileged']],
[this.$t('assets.Secret'), ['secret_type', 'secret', 'ssh_key', 'token', 'api_key', 'passphrase']],
@@ -121,6 +121,11 @@ export default {
})
},
confirm(form) {
const secretType = form.secret_type || ''
if (secretType !== 'password') {
form.secret = form[secretType]
delete form[secretType]
}
if (this.account?.name) {
this.$emit('edit', form)
} else {

View File

@@ -8,7 +8,7 @@
:account="account"
@updateAuthDone="onUpdateAuthDone"
/>
<AddAccount
<AccountCreateUpdate
v-if="showAddDialog"
:visible.sync="showAddDialog"
:asset="iAsset"
@@ -28,7 +28,7 @@ import ListTable from '@/components/ListTable/index'
import { ActionsFormatter } from '@/components/TableFormatters'
import ViewSecret from './ViewSecret'
import UpdateSecretInfo from './UpdateSecretInfo'
import AddAccount from './AddAccount'
import AccountCreateUpdate from './AccountCreateUpdate'
import { connectivityMeta } from './const'
import { openTaskPage } from '@/utils/jms'
import { hasUUID } from '@/utils/common'
@@ -41,7 +41,7 @@ export default {
UpdateSecretInfo,
PasswordHistoryDialog,
ViewSecret,
AddAccount
AccountCreateUpdate
},
props: {
url: {

View File

@@ -640,6 +640,7 @@
},
"perms": {
"": "",
"permAccount": "Accounts",
"Actions": "Actions",
"Permission": "Permissions",
"Asset": "Asset",

View File

@@ -647,6 +647,7 @@
},
"perms": {
"": "",
"permAccount": "認定アカウント",
"Actions": "アクション",
"Asset": "資産",
"Basic": "基本",

View File

@@ -662,6 +662,7 @@
},
"perms": {
"": "",
"permAccount": "授权账号",
"Actions": "动作",
"Asset": "资产",
"Basic": "基本",

View File

@@ -30,7 +30,8 @@ export default {
} catch (e) {
// pass
}
formValue['protocols'][0].port = port
const protocols = formValue['protocols']?.[0] || {}
protocols.port = port
}
},
username_selector: {

View File

@@ -0,0 +1,81 @@
<template>
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" class- />
</template>
<script>
import ListTable from '@/components/ListTable'
export default {
name: 'AssetPermissionAccount',
components: {
ListTable
},
props: {
object: {
type: Object,
default: () => ({})
}
},
data() {
const vm = this
return {
tableConfig: {
url: `/api/v1/perms/asset-permissions/${this.object.id}/accounts/`,
columns: [
'asset', 'name', 'username', 'privileged', 'version', 'comment'
],
columnsShow: {
default: [
'asset', 'name', 'username', 'privileged', 'version'
],
min: ['asset_name', 'name']
},
columnsMeta: {
asset: {
label: this.$t('assets.Asset'),
showOverflowTooltip: true,
formatter: function(row) {
const to = {
name: 'AssetDetail',
params: { id: row.asset.id }
}
if (vm.$hasPerm('assets.view_asset')) {
return <router-link to={ to } >{ row.asset.name }</router-link>
} else {
return <span>{ row.asset.name }</span>
}
}
},
name: {
formatter: null
},
privileged: {
width: '120px',
label: this.$t('assets.Privileged'),
formatterArgs: {
showFalse: false
}
}
},
tableAttrs: {
border: false
}
},
headerActions: {
hasSearch: true,
hasRefresh: true,
hasLeftActions: true,
hasRightActions: true,
hasExport: false,
hasImport: false,
hasCreate: false,
hasMoreActions: false
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -11,6 +11,7 @@ import { GenericDetailPage, TabPage } from '@/layout/components'
import AssetPermissionDetail from './AssetPermissionDetail'
import AssetPermissionUser from './AssetPermissionUser'
import AssetPermissionAsset from './AssetPermissionAsset'
import AssetPermissionAccount from './AssetPermissionAccount'
export default {
components: {
@@ -18,6 +19,7 @@ export default {
AssetPermissionDetail,
AssetPermissionUser,
AssetPermissionAsset,
AssetPermissionAccount,
TabPage
},
data() {
@@ -42,6 +44,11 @@ export default {
title: this.$t('perms.assetAndNode'),
name: 'AssetPermissionAsset',
hidden: () => !this.$hasPerm('assets.view_asset') || !this.$hasPerm('perms.change_assetpermission')
},
{
title: this.$t('perms.permAccount'),
name: 'AssetPermissionAccount',
hidden: () => !this.$hasPerm('assets.view_account') || !this.$hasPerm('perms.change_assetpermission')
}
]
}