Merge pull request #2737 from jumpserver/pr@dev@perf_account_history

perf: 优化账号,去掉 version
This commit is contained in:
老广
2023-02-22 11:47:13 +08:00
committed by GitHub
4 changed files with 15 additions and 12 deletions

View File

@@ -139,9 +139,6 @@ export default {
} }
} }
}, },
version: {
width: '70px'
},
secret_type: { secret_type: {
width: '100px', width: '100px',
formatter: function(row) { formatter: function(row) {

View File

@@ -28,7 +28,7 @@ export default {
width: '60%', width: '60%',
tableConfig: { tableConfig: {
url: `/api/v1/accounts/account-secrets/${this.account.id}/histories/`, url: `/api/v1/accounts/account-secrets/${this.account.id}/histories/`,
columns: ['secret', 'secret_type', 'version'], columns: ['secret', 'secret_type', 'history_date'],
columnsMeta: { columnsMeta: {
secret: { secret: {
formatter: ShowKeyCopyFormatter, formatter: ShowKeyCopyFormatter,

View File

@@ -2,20 +2,20 @@
<div> <div>
<UserConfirmDialog <UserConfirmDialog
:url="url" :url="url"
@UserConfirmDone="getAuthInfo"
@UserConfirmCancel="exit" @UserConfirmCancel="exit"
@UserConfirmDone="getAuthInfo"
/> />
<Dialog <Dialog
:title="dialogTitle"
:show-cancel="false"
:destroy-on-close="true" :destroy-on-close="true"
:width="'50'" :show-cancel="false"
:title="dialogTitle"
:visible.sync="showSecret" :visible.sync="showSecret"
:width="'50'"
v-bind="$attrs" v-bind="$attrs"
@confirm="showSecret = false" @confirm="showSecret = false"
v-on="$listeners" v-on="$listeners"
> >
<el-form class="password-form" label-position="right" label-width="100px" :model="secretInfo"> <el-form :model="secretInfo" class="password-form" label-position="right" label-width="100px">
<el-form-item :label="$tc('assets.Name')"> <el-form-item :label="$tc('assets.Name')">
<span>{{ account['name'] }}</span> <span>{{ account['name'] }}</span>
</el-form-item> </el-form-item>
@@ -45,9 +45,8 @@
type="text" type="text"
@click="onShowPasswordHistory" @click="onShowPasswordHistory"
> >
{{ secretInfo.version }} {{ historyCount }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</Dialog> </Dialog>
@@ -97,6 +96,7 @@ export default {
secretInfo: {}, secretInfo: {},
showSecret: false, showSecret: false,
sshKeyFingerprint: '', sshKeyFingerprint: '',
historyCount: 0,
showPasswordHistoryDialog: false showPasswordHistoryDialog: false
} }
}, },
@@ -108,6 +108,12 @@ export default {
return this.account['secret_type'].value return this.account['secret_type'].value
} }
}, },
mounted() {
const url = `/api/v1/accounts/account-secrets/${this.account.id}/histories/?limit=1`
this.$axios.get(url).then(resp => {
this.historyCount = resp.count
})
},
methods: { methods: {
getAuthInfo() { getAuthInfo() {
this.$axios.get(this.url, { disableFlashErrorMsg: true }).then(resp => { this.$axios.get(this.url, { disableFlashErrorMsg: true }).then(resp => {

View File

@@ -48,7 +48,7 @@ export default {
return { return {
templateDialogVisible: false, templateDialogVisible: false,
columns: [ columns: [
'name', 'username', 'version', 'privileged', 'connectivity', 'name', 'username', 'privileged', 'connectivity',
'is_active', 'date_created', 'date_updated', 'actions' 'is_active', 'date_created', 'date_updated', 'actions'
], ],
headerExtraActions: [ headerExtraActions: [