mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 06:19:51 +00:00
perf: 修改更新密文显示字段
This commit is contained in:
@@ -1,100 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Dialog
|
|
||||||
v-if="iVisible"
|
|
||||||
:destroy-on-close="true"
|
|
||||||
:show-cancel="false"
|
|
||||||
:show-confirm="false"
|
|
||||||
:title="title"
|
|
||||||
:visible.sync="iVisible"
|
|
||||||
top="35vh"
|
|
||||||
width="40%"
|
|
||||||
>
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :md="4" :sm="24">
|
|
||||||
<div style="line-height: 34px">{{ '密文' }}</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="14" :sm="24">
|
|
||||||
<el-input
|
|
||||||
v-model="secret"
|
|
||||||
:type="template.secret_type.value === 'password' ? 'text' : 'textarea'"
|
|
||||||
:rows="template.secret_type.value === 'password' ? 2 : 4"
|
|
||||||
/>
|
|
||||||
<span class="help-tips help-block">{{ '同时会修改通过模版所创建账号的密文' }}</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="4" :sm="24">
|
|
||||||
<el-button
|
|
||||||
:loading="loading"
|
|
||||||
size="mini"
|
|
||||||
style="line-height:20px "
|
|
||||||
type="primary"
|
|
||||||
@click="dialogConfirm"
|
|
||||||
>
|
|
||||||
{{ this.$t('common.Confirm') }}
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Dialog from '@/components/Dialog'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'AccountTemplateChangeSecretDialog',
|
|
||||||
components: {
|
|
||||||
Dialog
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
loading: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
secret: {
|
|
||||||
type: String,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
template: {
|
|
||||||
type: Object,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
sw: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
console.log('this.template', this.template)
|
|
||||||
return {
|
|
||||||
title: '更新密文'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
iVisible: {
|
|
||||||
get() {
|
|
||||||
return this.visible
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.$emit('update:visible', val)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
dialogConfirm() {
|
|
||||||
this.$axios.patch(
|
|
||||||
`/api/v1/accounts/account-templates/${this.template['id']}/sync-update-secret/`,
|
|
||||||
{ secret: this.secret }
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
this.$message.success(this.$tc('common.updateSuccessMsg'))
|
|
||||||
}).finally(() => {
|
|
||||||
this.iVisible = false
|
|
||||||
this.secret = null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
|
"UpdateSecret": "Update secret",
|
||||||
"AccountPolicy": "Account policy",
|
"AccountPolicy": "Account policy",
|
||||||
"BulkCreateStrategy": "When creating accounts that do not meet the requirements, such as key type non-compliance and unique key constraints, the above policies can be selected.",
|
"BulkCreateStrategy": "When creating accounts that do not meet the requirements, such as key type non-compliance and unique key constraints, the above policies can be selected.",
|
||||||
"HistoryDate": "History date",
|
"HistoryDate": "History date",
|
||||||
@@ -347,7 +348,7 @@
|
|||||||
"PasswordSelector": "Password Input Box Selector",
|
"PasswordSelector": "Password Input Box Selector",
|
||||||
"SubmitSelector": "Submit Button Selector",
|
"SubmitSelector": "Submit Button Selector",
|
||||||
"PlatformProtocolConfig": "Platform protocol config",
|
"PlatformProtocolConfig": "Platform protocol config",
|
||||||
"InheritPlatformConfig": "Inherited from the platform configuration. If you need to change, please change the configuration in the platform",
|
"InheritPlatformConfig": "The account list displays accounts created through templates. When updating ciphertext, the ciphertext of the account created through the template will be updated.",
|
||||||
"CollectHardwareInfo": "Enable collection of hardware information",
|
"CollectHardwareInfo": "Enable collection of hardware information",
|
||||||
"DomainEnabled": "Enable domain",
|
"DomainEnabled": "Enable domain",
|
||||||
"ProtocolsEnabled": "Enable protocol",
|
"ProtocolsEnabled": "Enable protocol",
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
|
"UpdateSecret": "機密の更新",
|
||||||
"AccountPolicy": "アカウントポリシー",
|
"AccountPolicy": "アカウントポリシー",
|
||||||
"BulkCreateStrategy": "作成時に要件を満たしていないアカウント(例:鍵タイプが規則に合わない、一意のキー制約がある、上記のポリシーを選択することができます)について。",
|
"BulkCreateStrategy": "作成時に要件を満たしていないアカウント(例:鍵タイプが規則に合わない、一意のキー制約がある、上記のポリシーを選択することができます)について。",
|
||||||
"HistoryDate": "历史日期",
|
"HistoryDate": "历史日期",
|
||||||
@@ -340,7 +341,7 @@
|
|||||||
"PasswordSelector": "パスワード入力ボックスセレクタ",
|
"PasswordSelector": "パスワード入力ボックスセレクタ",
|
||||||
"SubmitSelector": "コミットボタンセレクタ",
|
"SubmitSelector": "コミットボタンセレクタ",
|
||||||
"PlatformProtocolConfig": "プラットフォームプロトコルの構成",
|
"PlatformProtocolConfig": "プラットフォームプロトコルの構成",
|
||||||
"InheritPlatformConfig": "プラットフォーム構成から継承します。変更する場合は、プラットフォームの構成を変更してください",
|
"InheritPlatformConfig": "アカウントリストには、テンプレートで作成されたアカウントが表示されます。暗号文を更新すると、テンプレートで作成されたアカウントの暗号文が更新されます。",
|
||||||
"CollectHardwareInfo": "ハードウェア情報の収集を有効にする",
|
"CollectHardwareInfo": "ハードウェア情報の収集を有効にする",
|
||||||
"DomainEnabled": "ドメインを有効化",
|
"DomainEnabled": "ドメインを有効化",
|
||||||
"ProtocolsEnabled": "プロトコルの有効化",
|
"ProtocolsEnabled": "プロトコルの有効化",
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
|
"UpdateSecret": "更新密文",
|
||||||
"AddAccountResult": "账号批量添加结果",
|
"AddAccountResult": "账号批量添加结果",
|
||||||
"AccountPolicy": "账号策略",
|
"AccountPolicy": "账号策略",
|
||||||
"BulkCreateStrategy": "创建时对于不符合要求的账号,如:密钥类型不合规,唯一键约束,可选择以上策略。",
|
"BulkCreateStrategy": "创建时对于不符合要求的账号,如:密钥类型不合规,唯一键约束,可选择以上策略。",
|
||||||
@@ -358,7 +359,7 @@
|
|||||||
"PasswordSelector": "密码输入框选择器",
|
"PasswordSelector": "密码输入框选择器",
|
||||||
"SubmitSelector": "提交按钮选择器",
|
"SubmitSelector": "提交按钮选择器",
|
||||||
"PlatformProtocolConfig": "平台协议配置",
|
"PlatformProtocolConfig": "平台协议配置",
|
||||||
"InheritPlatformConfig": "继承自平台配置,如需更改,请更改平台中的配置",
|
"InheritPlatformConfig": "账号列表展示通过模版创建的账号。更新密文时,会更新通过模版所创建账号的密文。",
|
||||||
"CollectHardwareInfo": "启用收集硬件信息",
|
"CollectHardwareInfo": "启用收集硬件信息",
|
||||||
"DomainEnabled": "启用网域",
|
"DomainEnabled": "启用网域",
|
||||||
"ProtocolsEnabled": "启用协议",
|
"ProtocolsEnabled": "启用协议",
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
/>
|
/>
|
||||||
<AccountTemplateChangeSecretDialog
|
<AccountTemplateChangeSecretDialog
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
:template="object"
|
:object="object"
|
||||||
/>
|
/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import GenericListTable from '@/layout/components/GenericListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
import QuickActions from '@/components/QuickActions'
|
import QuickActions from '@/components/QuickActions'
|
||||||
import AccountTemplateChangeSecretDialog from '@/components/AccountTemplateChangeSecretDialog'
|
import AccountTemplateChangeSecretDialog from './AccountTemplateChangeSecretDialog'
|
||||||
import { ActionsFormatter, DetailFormatter } from '@/components/TableFormatters'
|
import { ActionsFormatter, DetailFormatter } from '@/components/TableFormatters'
|
||||||
import ViewSecret from '@/components/AccountListTable/ViewSecret'
|
import ViewSecret from '@/components/AccountListTable/ViewSecret'
|
||||||
|
|
||||||
@@ -58,12 +58,10 @@ export default {
|
|||||||
showViewSecretDialog: false,
|
showViewSecretDialog: false,
|
||||||
quickActions: [
|
quickActions: [
|
||||||
{
|
{
|
||||||
// title: this.$t('assets.TestAssetsConnective'),
|
title: this.$t('accounts.UpdateSecret'),
|
||||||
title: '更新密文',
|
|
||||||
attrs: {
|
attrs: {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
// label: this.$t('assets.Test')
|
label: this.$t('common.Update')
|
||||||
label: '更新'
|
|
||||||
},
|
},
|
||||||
callbacks: Object.freeze({
|
callbacks: Object.freeze({
|
||||||
click: () => {
|
click: () => {
|
@@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog
|
||||||
|
v-if="iVisible"
|
||||||
|
:visible.sync="iVisible"
|
||||||
|
:title="$tc('accounts.UpdateSecret')"
|
||||||
|
width="50%"
|
||||||
|
:show-cancel="false"
|
||||||
|
:show-confirm="false"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
>
|
||||||
|
<AutoDataForm
|
||||||
|
:form="form"
|
||||||
|
v-bind="config"
|
||||||
|
@submit="onSubmit"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { AutoDataForm, Dialog } from '@/components'
|
||||||
|
import { templateFieldsMeta } from '../const.js'
|
||||||
|
import { encryptPassword } from '@/utils/crypto'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AccountTemplateChangeSecretDialog',
|
||||||
|
components: {
|
||||||
|
Dialog,
|
||||||
|
AutoDataForm
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
object: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: this.object,
|
||||||
|
secretType: this.object?.secret_type?.value,
|
||||||
|
config: {
|
||||||
|
hasSaveContinue: false,
|
||||||
|
url: '/api/v1/accounts/account-templates/',
|
||||||
|
fields: [
|
||||||
|
['', [
|
||||||
|
'secret_type', 'secret', 'ssh_key', 'token',
|
||||||
|
'access_key', 'passphrase'
|
||||||
|
]]
|
||||||
|
],
|
||||||
|
fieldsMeta: {
|
||||||
|
...templateFieldsMeta(this),
|
||||||
|
secret_type: {
|
||||||
|
disabled: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
iVisible: {
|
||||||
|
get() {
|
||||||
|
return this.visible
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:visible', val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSubmit(form) {
|
||||||
|
const { object, secretType } = this
|
||||||
|
const currentSecretType = secretType === 'password' ? form?.['secret'] : form?.[secretType]
|
||||||
|
const params = {
|
||||||
|
secret: currentSecretType ? encryptPassword(currentSecretType) : '',
|
||||||
|
is_sync_account: true,
|
||||||
|
...(secretType === 'ssh_key' && { passphrase: encryptPassword(form?.['passphrase']) })
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$axios.patch(
|
||||||
|
`/api/v1/accounts/account-templates/${object.id}/sync-update-secret/`,
|
||||||
|
params
|
||||||
|
).then(() => {
|
||||||
|
this.$message.success(this.$tc('common.updateSuccessMsg'))
|
||||||
|
}).finally(() => {
|
||||||
|
this.iVisible = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@@ -14,14 +14,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import { GenericDetailPage, TabPage } from '@/layout/components'
|
import { GenericDetailPage, TabPage } from '@/layout/components'
|
||||||
import Detail from './Detail.vue'
|
import Detail from './Detail.vue'
|
||||||
import AccountTemplateChangeSecret from './AccountTemplateChangeSecret/index'
|
import Account from './Account'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
GenericDetailPage,
|
GenericDetailPage,
|
||||||
TabPage,
|
TabPage,
|
||||||
Detail,
|
Detail,
|
||||||
AccountTemplateChangeSecret
|
Account
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -36,7 +36,7 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('assets.Accounts'),
|
title: this.$t('assets.Accounts'),
|
||||||
name: 'AccountTemplateChangeSecret',
|
name: 'Account',
|
||||||
hidden: () => !this.$hasPerm('accounts.change_accounttemplate')
|
hidden: () => !this.$hasPerm('accounts.change_accounttemplate')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user