mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-10 11:02:16 +00:00
perf: 批量添加账号 模版添加 样式修改
This commit is contained in:
parent
a1906fd925
commit
cc7dd80a8a
@ -37,11 +37,14 @@ export default {
|
|||||||
encryptPassword: {
|
encryptPassword: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
addTemplate: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedTemplate: false,
|
|
||||||
loading: true,
|
loading: true,
|
||||||
usernameChanged: false,
|
usernameChanged: false,
|
||||||
defaultPrivilegedAccounts: ['root', 'administrator'],
|
defaultPrivilegedAccounts: ['root', 'administrator'],
|
||||||
@ -82,6 +85,7 @@ export default {
|
|||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
component: Select2,
|
component: Select2,
|
||||||
|
rules: [Required],
|
||||||
el: {
|
el: {
|
||||||
multiple: false,
|
multiple: false,
|
||||||
ajax: {
|
ajax: {
|
||||||
@ -92,17 +96,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.platform || this.asset
|
return this.platform || this.asset || !this.addTemplate
|
||||||
},
|
|
||||||
on: {
|
|
||||||
change: ([event]) => {
|
|
||||||
this.selectedTemplate = !!event
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_invalid: {
|
on_invalid: {
|
||||||
rules: [Required],
|
rules: [Required],
|
||||||
label: this.$t('ops.RunasPolicy'),
|
label: this.$t('accounts.AccountPolicy'),
|
||||||
helpText: this.$t('accounts.BulkCreateStrategy'),
|
helpText: this.$t('accounts.BulkCreateStrategy'),
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.platform || this.asset
|
return this.platform || this.asset
|
||||||
@ -124,7 +123,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.selectedTemplate
|
return this.addTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
username: {
|
username: {
|
||||||
@ -143,12 +142,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.selectedTemplate
|
return this.addTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
privileged: {
|
privileged: {
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.selectedTemplate
|
return this.addTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
su_from: {
|
su_from: {
|
||||||
@ -170,51 +169,46 @@ export default {
|
|||||||
secret: {
|
secret: {
|
||||||
label: this.$t('assets.Password'),
|
label: this.$t('assets.Password'),
|
||||||
component: UpdateToken,
|
component: UpdateToken,
|
||||||
hidden: (formValue) => formValue.secret_type !== 'password' || this.selectedTemplate
|
hidden: (formValue) => formValue.secret_type !== 'password' || this.addTemplate
|
||||||
},
|
},
|
||||||
ssh_key: {
|
ssh_key: {
|
||||||
label: this.$t('assets.PrivateKey'),
|
label: this.$t('assets.PrivateKey'),
|
||||||
component: UploadSecret,
|
component: UploadSecret,
|
||||||
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || this.selectedTemplate
|
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || this.addTemplate
|
||||||
},
|
},
|
||||||
passphrase: {
|
passphrase: {
|
||||||
label: this.$t('assets.Passphrase'),
|
label: this.$t('assets.Passphrase'),
|
||||||
component: UpdateToken,
|
component: UpdateToken,
|
||||||
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || this.selectedTemplate
|
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || this.addTemplate
|
||||||
},
|
},
|
||||||
token: {
|
token: {
|
||||||
label: this.$t('assets.Token'),
|
label: this.$t('assets.Token'),
|
||||||
component: UploadSecret,
|
component: UploadSecret,
|
||||||
hidden: (formValue) => formValue.secret_type !== 'token' || this.selectedTemplate
|
hidden: (formValue) => formValue.secret_type !== 'token' || this.addTemplate
|
||||||
},
|
},
|
||||||
access_key: {
|
access_key: {
|
||||||
id: 'access_key',
|
id: 'access_key',
|
||||||
label: this.$t('assets.AccessKey'),
|
label: this.$t('assets.AccessKey'),
|
||||||
component: UploadSecret,
|
component: UploadSecret,
|
||||||
hidden: (formValue) => formValue.secret_type !== 'access_key' || this.selectedTemplate
|
hidden: (formValue) => formValue.secret_type !== 'access_key' || this.addTemplate
|
||||||
},
|
},
|
||||||
secret_type: {
|
secret_type: {
|
||||||
type: 'radio-group',
|
type: 'radio-group',
|
||||||
options: [],
|
options: [],
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.selectedTemplate
|
return this.addTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
push_now: {
|
push_now: {
|
||||||
helpText: this.$t('accounts.AccountPush.WindowsPushHelpText'),
|
helpText: this.$t('accounts.AccountPush.WindowsPushHelpText'),
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
const automation = this.iPlatform.automation || {}
|
const automation = this.iPlatform.automation || {}
|
||||||
return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('accounts.push_account')
|
return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('accounts.push_account') || this.addTemplate
|
||||||
}
|
|
||||||
},
|
|
||||||
is_active: {
|
|
||||||
hidden: () => {
|
|
||||||
return this.selectedTemplate
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
comment: {
|
comment: {
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return this.selectedTemplate
|
return this.addTemplate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
ref="form"
|
ref="form"
|
||||||
:account="account"
|
:account="account"
|
||||||
:asset="asset"
|
:asset="asset"
|
||||||
|
:add-template="addTemplate"
|
||||||
@add="addAccount"
|
@add="addAccount"
|
||||||
@edit="editAccount"
|
@edit="editAccount"
|
||||||
/>
|
/>
|
||||||
@ -37,6 +38,10 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
addTemplate: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
asset: {
|
asset: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
|
@ -22,6 +22,16 @@
|
|||||||
@add="addAccountSuccess"
|
@add="addAccountSuccess"
|
||||||
@bulk-create-done="showBulkCreateResult($event)"
|
@bulk-create-done="showBulkCreateResult($event)"
|
||||||
/>
|
/>
|
||||||
|
<AccountCreateUpdate
|
||||||
|
v-if="showAddTemplateDialog"
|
||||||
|
:account="account"
|
||||||
|
:asset="iAsset"
|
||||||
|
:add-template="true"
|
||||||
|
:title="accountCreateUpdateTitle"
|
||||||
|
:visible.sync="showAddTemplateDialog"
|
||||||
|
@add="addAccountSuccess"
|
||||||
|
@bulk-create-done="showBulkCreateResult($event)"
|
||||||
|
/>
|
||||||
<ResultDialog
|
<ResultDialog
|
||||||
v-if="showResultDialog"
|
v-if="showResultDialog"
|
||||||
:result="createAccountResults"
|
:result="createAccountResults"
|
||||||
@ -105,6 +115,7 @@ export default {
|
|||||||
showUpdateSecretDialog: false,
|
showUpdateSecretDialog: false,
|
||||||
showResultDialog: false,
|
showResultDialog: false,
|
||||||
showAddDialog: false,
|
showAddDialog: false,
|
||||||
|
showAddTemplateDialog: false,
|
||||||
createAccountResults: [],
|
createAccountResults: [],
|
||||||
accountCreateUpdateTitle: this.$t('assets.AddAccount'),
|
accountCreateUpdateTitle: this.$t('assets.AddAccount'),
|
||||||
iAsset: this.asset,
|
iAsset: this.asset,
|
||||||
@ -307,6 +318,24 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'add-template',
|
||||||
|
title: this.$t('common.TemplateAdd'),
|
||||||
|
type: 'primary',
|
||||||
|
has: !(this.platform || this.asset),
|
||||||
|
can: () => {
|
||||||
|
return vm.$hasPerm('accounts.add_account') && !this.$store.getters.currentOrgIsRoot
|
||||||
|
},
|
||||||
|
callback: async() => {
|
||||||
|
await this.getAssetDetail()
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.iAsset = this.asset
|
||||||
|
vm.account = {}
|
||||||
|
vm.accountCreateUpdateTitle = this.$t('assets.AddAccount')
|
||||||
|
vm.showAddTemplateDialog = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
...this.headerExtraActions
|
...this.headerExtraActions
|
||||||
],
|
],
|
||||||
extraMoreActions: [
|
extraMoreActions: [
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
|
"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",
|
||||||
"SameTypeAccountTip": "An account with the same user name and key type already exists",
|
"SameTypeAccountTip": "An account with the same user name and key type already exists",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
|
"AccountPolicy": "アカウントポリシー",
|
||||||
"BulkCreateStrategy": "作成時に要件を満たしていないアカウント(例:鍵タイプが規則に合わない、一意のキー制約がある、上記のポリシーを選択することができます)について。",
|
"BulkCreateStrategy": "作成時に要件を満たしていないアカウント(例:鍵タイプが規則に合わない、一意のキー制約がある、上記のポリシーを選択することができます)について。",
|
||||||
"HistoryDate": "历史日期",
|
"HistoryDate": "历史日期",
|
||||||
"SameTypeAccountTip": "同じユーザー名、鍵タイプのアカウントはすでに存在します",
|
"SameTypeAccountTip": "同じユーザー名、鍵タイプのアカウントはすでに存在します",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"": "",
|
"": "",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"AddAccountResult": "账号批量添加结果",
|
"AddAccountResult": "账号批量添加结果",
|
||||||
|
"AccountPolicy": "账号策略",
|
||||||
"BulkCreateStrategy": "创建时对于不符合要求的账号,如:密钥类型不合规,唯一键约束,可选择以上策略。",
|
"BulkCreateStrategy": "创建时对于不符合要求的账号,如:密钥类型不合规,唯一键约束,可选择以上策略。",
|
||||||
"AccountTemplate": "账号模版",
|
"AccountTemplate": "账号模版",
|
||||||
"HistoryDate": "日期",
|
"HistoryDate": "日期",
|
||||||
|
Loading…
Reference in New Issue
Block a user