mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
Merge branch 'v3' of github.com:jumpserver/lina into v3
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
<script>
|
||||
import { GenericListTableDialog } from '@/layout/components'
|
||||
import { ShowKeyCopyFormatter } from '@/components/TableFormatters'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -27,7 +28,12 @@ export default {
|
||||
width: '60%',
|
||||
tableConfig: {
|
||||
url: `/api/v1/assets/account-secrets/${this.account.id}/histories/`,
|
||||
columns: ['secret', 'secret_type', 'version']
|
||||
columns: ['secret', 'secret_type', 'version'],
|
||||
columnsMeta: {
|
||||
secret: {
|
||||
formatter: ShowKeyCopyFormatter
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasImport: false,
|
||||
@@ -51,12 +57,6 @@ export default {
|
||||
this.$emit('update:visible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -15,44 +15,56 @@
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<div>
|
||||
<el-form label-position="right" label-width="80px" :model="authInfo">
|
||||
<el-form-item :label="this.$t('assets.Name')">
|
||||
<el-input v-model="account.asset.name" readonly />
|
||||
<el-form class="password-form" label-position="right" label-width="80px" :model="authInfo">
|
||||
<el-form-item :label="this.$t('assets.Name')">
|
||||
<ShowKeyCopyFormatter v-model="account.asset.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$tc('assets.Username')">
|
||||
<ShowKeyCopyFormatter v-model="account.username" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="secretTypePassword" :label="this.$t('assets.Password')">
|
||||
<ShowKeyCopyFormatter v-model="authInfo.secret" />
|
||||
</el-form-item>
|
||||
<div v-else>
|
||||
<el-form-item :label="this.$t('assets.SSHSecretKey')">
|
||||
<ShowKeyCopyFormatter v-model="authInfo.secret" :has-show="false" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$tc('assets.Username')">
|
||||
<el-input v-model="account['username']" readonly />
|
||||
<el-form-item :label="this.$t('assets.sshKeyFingerprint')">
|
||||
<span>{{ sshKeyFingerprint }}</span>
|
||||
<el-button type="text" @click="onDownload">{{ $t('common.Download') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="secretTypePassword" :label="this.$t('assets.Password')">
|
||||
<ShowKeyCopyFormatter v-model="authInfo.secret" />
|
||||
</el-form-item>
|
||||
<el-form-item v-else :label="this.$t('users.SSHKey')">
|
||||
<el-input v-model="authInfo['private_key']" class="item-textarea" type="textarea" show-password readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('common.DateCreated')">
|
||||
<span>{{ $moment(authInfo.date_created, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('common.DateUpdated')">
|
||||
<span>{{ $moment(authInfo.date_updated, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('accounts.PasswordRecord')">
|
||||
<span>{{ authInfo.version }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item :label="this.$t('common.DateCreated')">
|
||||
<span>{{ $moment(authInfo.date_created, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('common.DateUpdated')">
|
||||
<span>{{ $moment(authInfo.date_updated, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('accounts.PasswordRecord')">
|
||||
<el-button type="text" @click="onShowPasswordHistory">{{ authInfo.version }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</Dialog>
|
||||
<PasswordHistoryDialog
|
||||
v-if="showPasswordHistoryDialog"
|
||||
:account="account"
|
||||
:visible.sync="showPasswordHistoryDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog'
|
||||
import PasswordHistoryDialog from './PasswordHistoryDialog'
|
||||
import UserConfirmDialog from '@/components/UserConfirmDialog'
|
||||
import { ShowKeyCopyFormatter } from '@/components/TableFormatters'
|
||||
import { downloadFile } from '@/utils/common.js'
|
||||
|
||||
export default {
|
||||
name: 'ShowSecretInfo',
|
||||
components: {
|
||||
Dialog,
|
||||
PasswordHistoryDialog,
|
||||
UserConfirmDialog,
|
||||
ShowKeyCopyFormatter
|
||||
},
|
||||
@@ -71,6 +83,8 @@ export default {
|
||||
dialogTitle: this.$tc('common.ViewSecret'),
|
||||
authInfo: {},
|
||||
showAuthInfo: false,
|
||||
sshKeyFingerprint: '',
|
||||
showPasswordHistoryDialog: false,
|
||||
url: `/api/v1/assets/account-secrets/${this.account.id}/`
|
||||
}
|
||||
},
|
||||
@@ -83,11 +97,19 @@ export default {
|
||||
getAuthInfo() {
|
||||
this.$axios.get(this.url, { disableFlashErrorMsg: true }).then(resp => {
|
||||
this.authInfo = resp
|
||||
this.sshKeyFingerprint = resp.specific.ssh_key_fingerprint
|
||||
this.showAuthInfo = true
|
||||
})
|
||||
},
|
||||
exit() {
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
onShowPasswordHistory() {
|
||||
this.showPasswordHistoryDialog = true
|
||||
},
|
||||
onDownload() {
|
||||
const { secret, secret_type } = this.authInfo || {}
|
||||
downloadFile(secret, secret_type + '.key')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,4 +134,7 @@ export default {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
.password-form >>> .el-form-item {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
:account="account"
|
||||
@add="addAccountSuccess"
|
||||
/>
|
||||
<PasswordHistoryDialog
|
||||
v-if="showPasswordHistoryDialog"
|
||||
:account="account"
|
||||
:visible.sync="showPasswordHistoryDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -32,14 +27,12 @@ import AccountCreateUpdate from './AccountCreateUpdate'
|
||||
import { connectivityMeta } from './const'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { hasUUID } from '@/utils/common'
|
||||
import PasswordHistoryDialog from './PasswordHistoryDialog'
|
||||
|
||||
export default {
|
||||
name: 'AccountListTable',
|
||||
components: {
|
||||
ListTable,
|
||||
UpdateSecretInfo,
|
||||
PasswordHistoryDialog,
|
||||
ViewSecret,
|
||||
AccountCreateUpdate
|
||||
},
|
||||
@@ -78,7 +71,6 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
showPasswordHistoryDialog: false,
|
||||
showViewSecretDialog: false,
|
||||
showUpdateSecretDialog: false,
|
||||
showAddDialog: false,
|
||||
@@ -185,17 +177,6 @@ export default {
|
||||
vm.showAddDialog = true
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('accounts.HistoryPassword'),
|
||||
can: this.$hasPerm('assets.view_accountsecret') && !this.$store.getters.currentOrgIsRoot,
|
||||
callback: ({ row }) => {
|
||||
vm.account = row
|
||||
vm.showPasswordHistoryDialog = false
|
||||
setTimeout(() => {
|
||||
vm.showPasswordHistoryDialog = true
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -230,23 +230,28 @@ export default {
|
||||
generateTotalColumns() {
|
||||
const config = _.cloneDeep(this.config)
|
||||
let columns = []
|
||||
for (let col of config.columns) {
|
||||
if (typeof col === 'object') {
|
||||
columns.push(col)
|
||||
} else if (typeof col === 'string') {
|
||||
col = this.generateColumn(col)
|
||||
columns.push(col)
|
||||
const configColumns = config?.columns || []
|
||||
if (configColumns.length > 0) {
|
||||
for (let col of configColumns) {
|
||||
if (typeof col === 'object') {
|
||||
columns.push(col)
|
||||
} else if (typeof col === 'string') {
|
||||
col = this.generateColumn(col)
|
||||
columns.push(col)
|
||||
}
|
||||
}
|
||||
columns = columns.filter(item => {
|
||||
let has = item.has
|
||||
if (has === undefined) {
|
||||
has = true
|
||||
} else if (typeof has === 'function') {
|
||||
has = has()
|
||||
}
|
||||
return has
|
||||
})
|
||||
} else {
|
||||
columns = Object.keys(this.meta).map(key => this.generateColumn(key))
|
||||
}
|
||||
columns = columns.filter(item => {
|
||||
let has = item.has
|
||||
if (has === undefined) {
|
||||
has = true
|
||||
} else if (typeof has === 'function') {
|
||||
has = has()
|
||||
}
|
||||
return has
|
||||
})
|
||||
// 第一次初始化时记录 totalColumns
|
||||
this.totalColumns = columns
|
||||
config.columns = columns
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<span>{{ currentValue }}</span>
|
||||
<span class="right">
|
||||
<span class="text">{{ currentValue }}</span>
|
||||
<span v-if="iValue" class="action">
|
||||
<el-tooltip
|
||||
v-if="hasShow"
|
||||
effect="dark"
|
||||
@@ -81,11 +81,18 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
.right {
|
||||
.text {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.action {
|
||||
float: right;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -311,3 +311,17 @@ export function groupedDropdownToCascader(group) {
|
||||
|
||||
export { BASE_URL }
|
||||
|
||||
/**
|
||||
* Download file
|
||||
* @param {String} content
|
||||
* @param {String} fileName
|
||||
*/
|
||||
export function downloadFile(content, filename) {
|
||||
const a = document.createElement('a')
|
||||
const blob = new Blob([content])
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
a.href = url
|
||||
a.download = filename
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
@@ -37,14 +37,15 @@ export default {
|
||||
component: 'el-cascader',
|
||||
label: this.$t('xpack.AccountBackupPlan.Types'),
|
||||
remote: {
|
||||
request: () => vm.$axios.get('/api/v1/assets/platforms/categories/')
|
||||
request: () => vm.$axios.get('/api/v1/assets/categories/')
|
||||
},
|
||||
el: {
|
||||
options: [],
|
||||
showAllLevels: false,
|
||||
props: {
|
||||
multiple: true,
|
||||
emitPath: false
|
||||
emitPath: false,
|
||||
children: 'types'
|
||||
},
|
||||
style: {
|
||||
width: '100%'
|
||||
|
||||
Reference in New Issue
Block a user