mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 06:34:13 +00:00
Merge pull request #2155 from jumpserver/pr@v3@perf_account
pref: 继续优化 accounts view
This commit is contained in:
@@ -31,8 +31,19 @@ export default {
|
|||||||
columns: ['secret', 'secret_type', 'version'],
|
columns: ['secret', 'secret_type', 'version'],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
secret: {
|
secret: {
|
||||||
formatter: ShowKeyCopyFormatter
|
formatter: ShowKeyCopyFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
hasDownload: false,
|
||||||
|
name: this.account.name
|
||||||
|
}
|
||||||
|
},
|
||||||
|
secret_type: {
|
||||||
|
width: '200px'
|
||||||
|
},
|
||||||
|
version: {
|
||||||
|
width: '100px'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
headerActions: {
|
headerActions: {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
width="50"
|
width="50"
|
||||||
:title="this.$tc('assets.UpdateAssetUserToken')"
|
:title="this.$tcc('assets.UpdateAssetUserToken')"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@confirm="handleConfirm()"
|
@confirm="handleConfirm()"
|
||||||
@@ -51,7 +51,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
authInfo: {
|
secretInfo: {
|
||||||
password: '',
|
password: '',
|
||||||
private_key: '',
|
private_key: '',
|
||||||
passphrase: ''
|
passphrase: ''
|
||||||
@@ -61,12 +61,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
const data = {}
|
const data = {}
|
||||||
if (this.authInfo.password !== '') {
|
if (this.secretInfo.password !== '') {
|
||||||
data.password = encryptPassword(this.authInfo.password)
|
data.password = encryptPassword(this.secretInfo.password)
|
||||||
}
|
}
|
||||||
if (this.authInfo.private_key !== '') {
|
if (this.secretInfo.private_key !== '') {
|
||||||
data.private_key = encryptPassword(this.authInfo.private_key)
|
data.private_key = encryptPassword(this.secretInfo.private_key)
|
||||||
if (this.authInfo.passphrase) data.passphrase = this.authInfo.passphrase
|
if (this.secretInfo.passphrase) data.passphrase = this.secretInfo.passphrase
|
||||||
}
|
}
|
||||||
this.$axios.patch(
|
this.$axios.patch(
|
||||||
`/api/v1/assets/accounts/${this.account.id}/`,
|
`/api/v1/assets/accounts/${this.account.id}/`,
|
||||||
@@ -74,12 +74,12 @@ export default {
|
|||||||
{ disableFlashErrorMsg: true }
|
{ disableFlashErrorMsg: true }
|
||||||
).then(res => {
|
).then(res => {
|
||||||
this.authInfo = { password: '', private_key: '' }
|
this.authInfo = { password: '', private_key: '' }
|
||||||
this.$message.success(this.$tc('common.updateSuccessMsg'))
|
this.$message.success(this.$tcc('common.updateSuccessMsg'))
|
||||||
this.$emit('updateAuthDone', res)
|
this.$emit('updateAuthDone', res)
|
||||||
this.$emit('update:visible', false)
|
this.$emit('update:visible', false)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
const errMsg = Object.values(err.response.data).join(', ')
|
const errMsg = Object.values(err.response.data).join(', ')
|
||||||
this.$message.error(this.$tc('common.updateErrorMsg') + ' ' + errMsg)
|
this.$message.error(this.$tcc('common.updateErrorMsg') + ' ' + errMsg)
|
||||||
this.$emit('update:visible', true)
|
this.$emit('update:visible', true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -87,7 +87,7 @@ export default {
|
|||||||
this.$emit('update:visible', false)
|
this.$emit('update:visible', false)
|
||||||
},
|
},
|
||||||
getFile(file) {
|
getFile(file) {
|
||||||
this.authInfo.private_key = file
|
this.secretInfo.private_key = file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,29 +11,28 @@
|
|||||||
:show-cancel="false"
|
:show-cancel="false"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:width="'50'"
|
:width="'50'"
|
||||||
:visible.sync="showAuthInfo"
|
:visible.sync="showSecret"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
>
|
>
|
||||||
<el-form class="password-form" label-position="right" label-width="80px" :model="authInfo">
|
<el-form class="password-form" label-position="right" label-width="100px" :model="secretInfo">
|
||||||
<el-form-item :label="this.$tc('assets.Name')">
|
<el-form-item :label="this.$tc('assets.Name')">
|
||||||
<span>{{ account['name'] }}</span>
|
<span>{{ account['name'] }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="this.$tc('assets.Username')">
|
<el-form-item :label="this.$tc('assets.Username')">
|
||||||
<span>{{ account['username'] }}</span>
|
<span>{{ account['username'] }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="secretTypePassword" :label="this.$tc('assets.Password')">
|
<el-form-item :label="secretTypeLabel">
|
||||||
<ShowKeyCopyFormatter v-model="authInfo.secret" />
|
<ShowKeyCopyFormatter
|
||||||
|
:cell-value="secretInfo.secret"
|
||||||
|
:col="{ formatterArgs: {
|
||||||
|
name: account['name'],
|
||||||
|
}}"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="secretType === 'ssh_key'" :label="this.$tc('assets.sshKeyFingerprint')">
|
||||||
|
<span>{{ sshKeyFingerprint }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div v-else>
|
|
||||||
<el-form-item :label="this.$tc('assets.SSHSecretKey')">
|
|
||||||
<ShowKeyCopyFormatter v-model="authInfo.secret" :has-show="false" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="this.$tc('assets.sshKeyFingerprint')">
|
|
||||||
<span>{{ sshKeyFingerprint }}</span>
|
|
||||||
<el-button type="text" @click="onDownload">{{ $t('common.Download') }}</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
<el-form-item :label="this.$tc('common.DateCreated')">
|
<el-form-item :label="this.$tc('common.DateCreated')">
|
||||||
<span>{{ account['date_created'] | date }}</span>
|
<span>{{ account['date_created'] | date }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -41,7 +40,7 @@
|
|||||||
<span>{{ account['date_updated'] | date }}</span>
|
<span>{{ account['date_updated'] | date }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="this.$tc('accounts.PasswordRecord')">
|
<el-form-item :label="this.$tc('accounts.PasswordRecord')">
|
||||||
<el-button type="text" @click="onShowPasswordHistory">{{ authInfo.version }}</el-button>
|
<el-button type="text" @click="onShowPasswordHistory">{{ secretInfo.version }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -58,7 +57,6 @@ import Dialog from '@/components/Dialog'
|
|||||||
import PasswordHistoryDialog from './PasswordHistoryDialog'
|
import PasswordHistoryDialog from './PasswordHistoryDialog'
|
||||||
import UserConfirmDialog from '@/components/UserConfirmDialog'
|
import UserConfirmDialog from '@/components/UserConfirmDialog'
|
||||||
import { ShowKeyCopyFormatter } from '@/components/TableFormatters'
|
import { ShowKeyCopyFormatter } from '@/components/TableFormatters'
|
||||||
import { downloadFile } from '@/utils/common.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowSecretInfo',
|
name: 'ShowSecretInfo',
|
||||||
@@ -81,24 +79,27 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogTitle: this.$tc('assets.AccountDetail'),
|
dialogTitle: this.$tc('assets.AccountDetail'),
|
||||||
authInfo: {},
|
secretInfo: {},
|
||||||
showAuthInfo: false,
|
showSecret: false,
|
||||||
sshKeyFingerprint: '',
|
sshKeyFingerprint: '',
|
||||||
showPasswordHistoryDialog: false,
|
showPasswordHistoryDialog: false,
|
||||||
url: `/api/v1/assets/account-secrets/${this.account.id}/`
|
url: `/api/v1/assets/account-secrets/${this.account.id}/`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
secretTypePassword() {
|
secretTypeLabel() {
|
||||||
return this.authInfo.secret_type === 'password'
|
return this.account['secret_type'].label || 'Password'
|
||||||
|
},
|
||||||
|
secretType() {
|
||||||
|
return this.account['secret_type'].value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getAuthInfo() {
|
getAuthInfo() {
|
||||||
this.$axios.get(this.url, { disableFlashErrorMsg: true }).then(resp => {
|
this.$axios.get(this.url, { disableFlashErrorMsg: true }).then(resp => {
|
||||||
this.authInfo = resp
|
this.secretInfo = resp
|
||||||
this.sshKeyFingerprint = resp.specific.ssh_key_fingerprint
|
this.sshKeyFingerprint = resp.specific.ssh_key_fingerprint
|
||||||
this.showAuthInfo = true
|
this.showSecret = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
exit() {
|
exit() {
|
||||||
@@ -106,10 +107,6 @@ export default {
|
|||||||
},
|
},
|
||||||
onShowPasswordHistory() {
|
onShowPasswordHistory() {
|
||||||
this.showPasswordHistoryDialog = true
|
this.showPasswordHistoryDialog = true
|
||||||
},
|
|
||||||
onDownload() {
|
|
||||||
const { secret, secret_type } = this.authInfo || {}
|
|
||||||
downloadFile(secret, secret_type + '.key')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,11 +118,16 @@ export default {
|
|||||||
}
|
}
|
||||||
.el-form-item {
|
.el-form-item {
|
||||||
border-bottom: 1px solid #EBEEF5;
|
border-bottom: 1px solid #EBEEF5;
|
||||||
padding: 3px 0;
|
padding: 5px 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #F5F7FA;
|
background-color: #F5F7FA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
>>> .el-form-item__label {
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
/>
|
/>
|
||||||
<Dialog
|
<Dialog
|
||||||
v-if="dialogVisible"
|
v-if="dialogVisible"
|
||||||
:title="this.$t('assets.Assets')"
|
:title="this.$tc('assets.Assets')"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
custom-class="asset-select-dialog"
|
custom-class="asset-select-dialog"
|
||||||
width="80vw"
|
width="80vw"
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane v-if="shouldHide('min')" :label="this.$t('common.CronTab.min')">
|
<el-tab-pane v-if="shouldHide('min')" :label="this.$tc('common.CronTab.min')">
|
||||||
<CrontabMin
|
<CrontabMin
|
||||||
ref="cronmin"
|
ref="cronmin"
|
||||||
:check="checkNumber"
|
:check="checkNumber"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="shouldHide('hour')" :label="this.$t('common.CronTab.hour')">
|
<el-tab-pane v-if="shouldHide('hour')" :label="this.$tc('common.CronTab.hour')">
|
||||||
<CrontabHour
|
<CrontabHour
|
||||||
ref="cronhour"
|
ref="cronhour"
|
||||||
:check="checkNumber"
|
:check="checkNumber"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="shouldHide('day')" :label="this.$t('common.CronTab.day')">
|
<el-tab-pane v-if="shouldHide('day')" :label="this.$tc('common.CronTab.day')">
|
||||||
<CrontabDay
|
<CrontabDay
|
||||||
ref="cronday"
|
ref="cronday"
|
||||||
:check="checkNumber"
|
:check="checkNumber"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="shouldHide('month')" :label="this.$t('common.CronTab.month')">
|
<el-tab-pane v-if="shouldHide('month')" :label="this.$tc('common.CronTab.month')">
|
||||||
<CrontabMonth
|
<CrontabMonth
|
||||||
ref="cronmonth"
|
ref="cronmonth"
|
||||||
:check="checkNumber"
|
:check="checkNumber"
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="shouldHide('week')" :label="this.$t('common.CronTab.week')">
|
<el-tab-pane v-if="shouldHide('week')" :label="this.$tc('common.CronTab.week')">
|
||||||
<CrontabWeek
|
<CrontabWeek
|
||||||
ref="cronweek"
|
ref="cronweek"
|
||||||
:check="checkNumber"
|
:check="checkNumber"
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model="radioValue" :label="7">
|
<el-radio v-model="radioValue" :label="7">
|
||||||
{{ this.$t('common.CronTab.appoint') }}
|
{{ this.$t('common.CronTab.appoint') }}
|
||||||
<el-select v-model="checkboxList" clearable :placeholder="this.$t('common.CronTab.manyChoose')" multiple style="width:100%">
|
<el-select v-model="checkboxList" clearable :placeholder="this.$tc('common.CronTab.manyChoose')" multiple style="width:100%">
|
||||||
<el-option v-for="item in 31" :key="item" :value="item">{{ item }}</el-option>
|
<el-option v-for="item in 31" :key="item" :value="item">{{ item }}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model="radioValue" :label="4">
|
<el-radio v-model="radioValue" :label="4">
|
||||||
{{ this.$t('common.CronTab.appoint') }}
|
{{ this.$t('common.CronTab.appoint') }}
|
||||||
<el-select v-model="checkboxList" clearable :placeholder="this.$t('common.CronTab.manyChoose')" multiple style="width:100%">
|
<el-select v-model="checkboxList" clearable :placeholder="this.$tc('common.CronTab.manyChoose')" multiple style="width:100%">
|
||||||
<el-option v-for="item in 24" :key="item" :value="item-1">{{ item-1 }}</el-option>
|
<el-option v-for="item in 24" :key="item" :value="item-1">{{ item-1 }}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model="radioValue" :label="4">
|
<el-radio v-model="radioValue" :label="4">
|
||||||
{{ this.$t('common.CronTab.appoint') }}
|
{{ this.$t('common.CronTab.appoint') }}
|
||||||
<el-select v-model="checkboxList" clearable :placeholder="this.$t('common.CronTab.manyChoose')" multiple style="width:100%" size="small">
|
<el-select v-model="checkboxList" clearable :placeholder="this.$tc('common.CronTab.manyChoose')" multiple style="width:100%" size="small">
|
||||||
<el-option v-for="item in 60" :key="item" :value="item-1">{{ item-1 }}</el-option>
|
<el-option v-for="item in 60" :key="item" :value="item-1">{{ item-1 }}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model="radioValue" :label="4">
|
<el-radio v-model="radioValue" :label="4">
|
||||||
{{ this.$t('common.CronTab.appoint') }}
|
{{ this.$t('common.CronTab.appoint') }}
|
||||||
<el-select v-model="checkboxList" clearable :placeholder="this.$t('common.CronTab.manyChoose')" multiple style="width:100%">
|
<el-select v-model="checkboxList" clearable :placeholder="this.$tc('common.CronTab.manyChoose')" multiple style="width:100%">
|
||||||
<el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
|
<el-option v-for="item in 12" :key="item" :value="item">{{ item }}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model="radioValue" :label="6">
|
<el-radio v-model="radioValue" :label="6">
|
||||||
{{ this.$t('common.CronTab.appoint') }}
|
{{ this.$t('common.CronTab.appoint') }}
|
||||||
<el-select v-model="checkboxList" clearable :placeholder="this.$t('common.CronTab.manyChoose')" multiple style="width:100%">
|
<el-select v-model="checkboxList" clearable :placeholder="this.$tc('common.CronTab.manyChoose')" multiple style="width:100%">
|
||||||
<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{ item }}</el-option>
|
<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{ item }}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<el-input v-model="input" clearable @focus="showDialog" @clear="onClear" />
|
<el-input v-model="input" clearable @focus="showDialog" @clear="onClear" />
|
||||||
</div>
|
</div>
|
||||||
<el-dialog :title="this.$t('common.CronTab.newCron')" :visible.sync="showCron" top="8vh" width="580px" append-to-body>
|
<el-dialog :title="this.$tc('common.CronTab.newCron')" :visible.sync="showCron" top="8vh" width="580px" append-to-body>
|
||||||
<Crontab
|
<Crontab
|
||||||
:expression="expression"
|
:expression="expression"
|
||||||
@hide="showCron = false"
|
@hide="showCron = false"
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="value"
|
v-model="value"
|
||||||
type="datetimerange"
|
type="datetimerange"
|
||||||
:range-separator="this.$t('common.To')"
|
:range-separator="this.$tc('common.To')"
|
||||||
:start-placeholder="this.$t('common.DateStart')"
|
:start-placeholder="this.$tc('common.DateStart')"
|
||||||
:end-placeholder="this.$t('common.DateEnd')"
|
:end-placeholder="this.$tc('common.DateEnd')"
|
||||||
size="small"
|
size="small"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
class="datepicker"
|
class="datepicker"
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
<el-radio v-for="option of exportTypeOptions" :key="option.value" style="padding: 10px 20px;" :label="option.value" :disabled="!option.can">{{ option.label }}</el-radio>
|
<el-radio v-for="option of exportTypeOptions" :key="option.value" style="padding: 10px 20px;" :label="option.value" :disabled="!option.can">{{ option.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="export-form" :label="this.$t('common.imExport.ExportRange')" :label-width="'100px'">
|
<el-form-item class="export-form" :label="this.$tc('common.imExport.ExportRange')" :label-width="'100px'">
|
||||||
<el-radio-group v-model="exportOption">
|
<el-radio-group v-model="exportOption">
|
||||||
<el-radio v-for="option of exportOptions" :key="option.value" class="export-item" :label="option.value" :disabled="!option.can">{{ option.label }}</el-radio>
|
<el-radio v-for="option of exportOptions" :key="option.value" class="export-item" :label="option.value" :disabled="!option.can">{{ option.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
@@ -31,11 +31,11 @@ export default {
|
|||||||
false: this.$t('common.No')
|
false: this.$t('common.No')
|
||||||
},
|
},
|
||||||
getKey({ row, cellValue }) {
|
getKey({ row, cellValue }) {
|
||||||
return typeof cellValue === 'object' ? cellValue.value : cellValue
|
return (cellValue && typeof cellValue === 'object') ? cellValue.value : cellValue
|
||||||
},
|
},
|
||||||
getText({ row, cellValue }) {
|
getText({ row, cellValue }) {
|
||||||
const key = this.getKey({ row, cellValue })
|
const key = this.getKey({ row, cellValue })
|
||||||
return typeof cellValue === 'object' ? cellValue.label : this.textChoices[key] || cellValue
|
return (cellValue && typeof cellValue === 'object') ? cellValue.label : this.textChoices[key] || cellValue
|
||||||
},
|
},
|
||||||
getIcon({ row, cellValue }) {
|
getIcon({ row, cellValue }) {
|
||||||
return this.faChoices[cellValue]
|
return this.faChoices[cellValue]
|
||||||
|
@@ -1,71 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<span class="text">{{ currentValue }}</span>
|
<pre class="text">{{ currentValue }}</pre>
|
||||||
<span v-if="iValue" class="action">
|
<span v-if="cellValue" class="action">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="hasShow"
|
v-if="hasShow"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
placement="top"
|
placement="top"
|
||||||
:content="this.$t('common.View')"
|
:content="this.$tc('common.View')"
|
||||||
>
|
>
|
||||||
<i class="el-icon-view" @click="onShow()" />
|
<i class="fa" :class="isShow ? 'fa-eye-slash' : 'fa-eye'" @click="onShow()" />
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip
|
||||||
|
v-if="hasDownload"
|
||||||
|
effect="dark"
|
||||||
|
placement="top"
|
||||||
|
:content="this.$tc('common.Download')"
|
||||||
|
>
|
||||||
|
<i class="fa fa-download" @click="onDownload()" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="hasCopy"
|
v-if="hasCopy"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
placement="top"
|
placement="top"
|
||||||
:content="this.$t('common.Copy')"
|
:content="this.$tc('common.Copy')"
|
||||||
>
|
>
|
||||||
<i class="el-icon-copy-document" @click="onCopy()" />
|
<i class="fa fa-clone" @click="onCopy()" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { downloadText } from '@/utils/common'
|
||||||
|
import BaseFormatter from '@/components/TableFormatters/base'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowKeyCopyFormatter',
|
name: 'ShowKeyCopyFormatter',
|
||||||
|
extends: BaseFormatter,
|
||||||
props: {
|
props: {
|
||||||
value: {
|
formatterArgsDefault: {
|
||||||
type: String,
|
type: Object,
|
||||||
default: () => ''
|
default() {
|
||||||
},
|
return {
|
||||||
cellValue: {
|
name: 'key',
|
||||||
type: [String, Number],
|
hasShow: true,
|
||||||
default: ''
|
hasDownload: true,
|
||||||
},
|
hasCopy: true,
|
||||||
hasShow: {
|
defaultShow: false
|
||||||
type: Boolean,
|
}
|
||||||
default: true
|
}
|
||||||
},
|
|
||||||
hasCopy: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentValue: this.switchShowValue()
|
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs || {}),
|
||||||
|
isShow: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
iValue() {
|
hasShow: function() { return this.formatterArgs.hasShow },
|
||||||
return this.value || this.cellValue
|
hasDownload: function() { return this.formatterArgs.hasDownload },
|
||||||
|
hasCopy: function() { return this.formatterArgs.hasCopy },
|
||||||
|
name: function() { return this.formatterArgs.name },
|
||||||
|
currentValue() {
|
||||||
|
if (this.isShow) {
|
||||||
|
return this.cellValue
|
||||||
|
} else {
|
||||||
|
return '******'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.isShow = this.formatterArgs.defaultShow
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
switchShowValue() {
|
|
||||||
const value = this.value || this.cellValue
|
|
||||||
return value ? '******' + value.replace(/[\s\S]/g, '') : ''
|
|
||||||
},
|
|
||||||
onShow() {
|
onShow() {
|
||||||
const { currentValue, switchShowValue } = this
|
this.isShow = !this.isShow
|
||||||
this.currentValue = currentValue === this.iValue ? switchShowValue() : this.iValue
|
|
||||||
},
|
},
|
||||||
onCopy: _.throttle(function() {
|
onCopy: _.throttle(function() {
|
||||||
const inputDom = document.createElement('input')
|
const inputDom = document.createElement('input')
|
||||||
inputDom.id = 'createInputDom'
|
inputDom.id = 'createInputDom'
|
||||||
inputDom.value = this.iValue
|
inputDom.value = this.cellValue
|
||||||
document.body.appendChild(inputDom)
|
document.body.appendChild(inputDom)
|
||||||
inputDom.select()
|
inputDom.select()
|
||||||
document?.execCommand('copy')
|
document?.execCommand('copy')
|
||||||
@@ -75,7 +90,10 @@ export default {
|
|||||||
duration: 1400
|
duration: 1400
|
||||||
})
|
})
|
||||||
document.body.removeChild(inputDom)
|
document.body.removeChild(inputDom)
|
||||||
}, 1800)
|
}, 1800),
|
||||||
|
onDownload() {
|
||||||
|
downloadText(this.cellValue, this.name + '.txt')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -84,19 +102,26 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
//white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
line-height: 1.3;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
//white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
float: right;
|
float: right;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
.el-icon-view, .el-icon-copy-document {
|
margin-left: 5px;
|
||||||
|
|
||||||
|
.fa {
|
||||||
|
margin-right: 10px;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ export default {
|
|||||||
},
|
},
|
||||||
tableData: {
|
tableData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ({})
|
default: () => ([])
|
||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
<el-row :gutter="24" style="margin: 0 auto;">
|
<el-row :gutter="24" style="margin: 0 auto;">
|
||||||
<el-col :md="24" :sm="24">
|
<el-col :md="24" :sm="24">
|
||||||
<el-alert
|
<el-alert
|
||||||
:title="this.$t('auth.ReLoginTitle')"
|
:title="this.$tc('auth.ReLoginTitle')"
|
||||||
type="info"
|
type="info"
|
||||||
center
|
center
|
||||||
:closable="false"
|
:closable="false"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
:title="this.$t('common.updateSelected')"
|
:title="this.$tc('common.updateSelected')"
|
||||||
:visible.sync="iVisible"
|
:visible.sync="iVisible"
|
||||||
width="70%"
|
width="70%"
|
||||||
top="1vh"
|
top="1vh"
|
||||||
|
@@ -2,17 +2,17 @@
|
|||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<ul class="navbar-right">
|
<ul class="navbar-right">
|
||||||
<li class="header-item header-icon">
|
<li class="header-item header-icon">
|
||||||
<el-tooltip effect="dark" :content="this.$t('route.SiteMessageList')">
|
<el-tooltip effect="dark" :content="this.$tc('route.SiteMessageList')">
|
||||||
<SiteMessages />
|
<SiteMessages />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</li>
|
</li>
|
||||||
<li v-perms="['rbac.view_webterminal']" class="header-item header-icon">
|
<li v-perms="['rbac.view_webterminal']" class="header-item header-icon">
|
||||||
<el-tooltip effect="dark" :content="this.$t('route.WebTerminal')">
|
<el-tooltip effect="dark" :content="this.$tc('route.WebTerminal')">
|
||||||
<WebTerminal />
|
<WebTerminal />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</li>
|
</li>
|
||||||
<li v-perms="'settings.view_setting'" class="header-item header-icon">
|
<li v-perms="'settings.view_setting'" class="header-item header-icon">
|
||||||
<el-tooltip effect="dark" :content="this.$t('route.SystemSetting')">
|
<el-tooltip effect="dark" :content="this.$tc('route.SystemSetting')">
|
||||||
<SystemSetting />
|
<SystemSetting />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -316,7 +316,7 @@ export { BASE_URL }
|
|||||||
* @param {String} content
|
* @param {String} content
|
||||||
* @param {String} fileName
|
* @param {String} fileName
|
||||||
*/
|
*/
|
||||||
export function downloadFile(content, filename) {
|
export function downloadText(content, filename) {
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
const blob = new Blob([content])
|
const blob = new Blob([content])
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
v-if="iVisible"
|
v-if="iVisible"
|
||||||
:title="this.$t('assets.AddAccount')"
|
:title="this.$tc('assets.AddAccount')"
|
||||||
:visible.sync="iVisible"
|
:visible.sync="iVisible"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:show-cancel="false"
|
:show-cancel="false"
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
<Dialog
|
<Dialog
|
||||||
v-if="dialogVisible"
|
v-if="dialogVisible"
|
||||||
:title="this.$t('assets.TestGatewayTestConnection')"
|
:title="this.$tc('assets.TestGatewayTestConnection')"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="40%"
|
width="40%"
|
||||||
top="35vh"
|
top="35vh"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
<Dialog v-if="relationDialog.show" :visible.sync="relationDialog.show" :title="this.$t('audits.Hosts')" :show-cancel="false" :show-confirm="false">
|
<Dialog v-if="relationDialog.show" :visible.sync="relationDialog.show" :title="this.$tc('audits.Hosts')" :show-cancel="false" :show-confirm="false">
|
||||||
<ListTable :table-config="relationDialog.tableConfig" :header-actions="relationDialog.headerActions" />
|
<ListTable :table-config="relationDialog.tableConfig" :header-actions="relationDialog.headerActions" />
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
<Dialog
|
<Dialog
|
||||||
:visible.sync="dialogLicenseImport"
|
:visible.sync="dialogLicenseImport"
|
||||||
top="20vh"
|
top="20vh"
|
||||||
:title="this.$t('setting.ImportLicense')"
|
:title="this.$tc('setting.ImportLicense')"
|
||||||
@cancel="dialogLicenseImport = false"
|
@cancel="dialogLicenseImport = false"
|
||||||
@confirm="importLicense"
|
@confirm="importLicense"
|
||||||
>
|
>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
v-if="setting.InviteDialogVisible"
|
v-if="setting.InviteDialogVisible"
|
||||||
:title="this.$t('users.InviteUserInOrg')"
|
:title="this.$tc('users.InviteUserInOrg')"
|
||||||
:visible.sync="setting.InviteDialogVisible"
|
:visible.sync="setting.InviteDialogVisible"
|
||||||
:show-cancel="false"
|
:show-cancel="false"
|
||||||
:show-confirm="false"
|
:show-confirm="false"
|
||||||
|
Reference in New Issue
Block a user