1
0
mirror of https://github.com/jumpserver/lina.git synced 2025-05-09 08:36:36 +00:00

perf: 修改 accounts 创建

This commit is contained in:
ibuler 2024-03-13 18:53:19 +08:00
parent 6b87a2ad31
commit dc94ff58c3
10 changed files with 35 additions and 17 deletions
src
components
Apps
AccountCreateUpdateForm
AccountListTable
Form/DataForm
components/el-form-renderer/components
index.vue
Table/ListTable/TableAction
i18n/langs
styles
views/assets/Platform

View File

@ -2,6 +2,7 @@
<AutoDataForm
v-if="!loading"
ref="AutoDataForm"
:class="addTemplate? '': 'account-add'"
v-bind="$data"
@submit="confirm"
/>
@ -58,9 +59,8 @@ export default {
form: Object.assign({ 'on_invalid': 'error' }, this.account || {}),
encryptedFields: ['secret'],
fields: [
[this.$t('Asset'), ['assets']],
[this.$t('AccountTemplate'), ['template']],
[this.$t('Basic'), ['name', 'username', 'privileged', 'su_from', 'su_from_username']],
[this.$t('Basic'), ['assets', 'name', 'username', 'privileged', 'su_from', 'su_from_username']],
[this.$t('Secret'), [
'secret_type', 'password', 'ssh_key', 'token',
'access_key', 'passphrase', 'api_key'
@ -145,5 +145,21 @@ export default {
}
</script>
<style scoped>
<style lang='scss' scoped>
.account-add {
>>> .el-form-item {
margin-bottom: 5px;
.help-block {
margin-bottom: 5px;
}
}
>>> .form-group-header {
.hr-line-dashed {
margin: 5px 0;
}
h3 {
margin-bottom: 5px;
}
}
}
</style>

View File

@ -53,7 +53,7 @@ export default {
title: {
type: String,
default: function() {
return this.$t('Add')
return this.$t('AddAccount')
}
}
},

View File

@ -139,7 +139,7 @@ export default {
showAddDialog: false,
showAddTemplateDialog: false,
createAccountResults: [],
accountCreateUpdateTitle: this.$t('Create'),
accountCreateUpdateTitle: this.$t('AddAccount'),
iAsset: this.asset,
account: {},
secretUrl: '',
@ -316,6 +316,7 @@ export default {
name: 'add',
title: this.$t('Create'),
type: 'primary',
icon: 'plus',
can: () => {
return vm.$hasPerm('accounts.add_account') && !this.$store.getters.currentOrgIsRoot
},

View File

@ -1,7 +1,7 @@
<template>
<el-form-item
v-show="_show"
:class="'el-form-item-' + data.prop"
:class="'el-form-item-' + data.prop + ' ' + data.attrs.class || ''"
:label="data.label"
:prop="prop"
:rules="_show && Array.isArray(data.rules) ? data.rules : []"

View File

@ -161,6 +161,7 @@ export default {
.el-form ::v-deep .el-form-item__content {
width: 75%;
line-height: 35px;
}
.mobile.el-form ::v-deep .el-form-item__content {
@ -169,6 +170,7 @@ export default {
.el-form ::v-deep .el-form-item__label {
padding: 0 30px 0 0;
line-height: 35px;
}
.el-form ::v-deep .el-form-item__error {

View File

@ -151,7 +151,6 @@ export default {
},
actions() {
const actions = [...this.defaultActions, ...this.extraActions]
console.log('Moreactions: ', this.defaultActions)
return cleanActions(actions, true, {
selectedRows: this.selectedRows,
reloadTable: this.reloadTable

View File

@ -1,6 +1,4 @@
{
"FieldRequiredError": "This field is required.",
"SystemRoleHelpMsg": "System roles are roles that apply universally across all organizations within the platform. These roles allow you to define specific permissions and access levels for users across the entire system. Changes made to system roles will affect all organizations using the platform.",
"OrgRoleHelpMsg": "Organization roles are roles tailored to individual organizations within the platform. These roles are assigned when inviting users to join a particular organization and dictate their permissions and access levels within that organization. Unlike system roles, organization roles are customizable and apply only within the scope of the organization they are assigned to.",
"VirtualAccountHelpMsg": "Virtual accounts are specialized accounts with specific purposes when connecting assets."
"ServerError": "An error occurred while processing your request. Please try again later."
}

View File

@ -359,6 +359,7 @@ button, input, optgroup, select, textarea {
.el-form .el-form-item__content {
font-size: 13px;
line-height: 35px;
}
.el-tabs__item > span {
@ -385,6 +386,7 @@ button, input, optgroup, select, textarea {
word-break: break-word;
}
}
.form-group-header {
text-align: left;
}

View File

@ -44,11 +44,11 @@ export default {
},
fields: [
[this.$t('Basic'), [
'name', 'category_type', 'charset',
'domain_enabled'
'name', 'category_type'
]],
[this.$t('Config'), [
'protocols', 'su_enabled', 'su_method'
'protocols', 'su_enabled', 'su_method',
'domain_enabled', 'charset'
]],
[this.$t('Automations'), ['automation']],
[this.$t('Other'), ['comment']]
@ -174,7 +174,7 @@ export default {
}
}
>>> .itemMethodKey.el-form-item {
>>> .item-method.el-form-item {
display: inline-block;
width: 100%;
.el-form-item__content {
@ -185,7 +185,7 @@ export default {
}
}
>>> .itemParamsKey.el-form-item {
>>> .item-params.el-form-item {
display: inline-block;
position: absolute;
right: 20px;

View File

@ -130,7 +130,7 @@ export const setAutomations = (vm) => {
return !formValue[itemEnabledKey] || !formValue['ansible_enabled']
})
// 设置 enableMethod className
_.set(autoFieldsMeta, `${itemMethodKey}.attrs.class`, 'itemMethodKey')
_.set(autoFieldsMeta, `${itemMethodKey}.attrs.class`, 'item-method')
// 设置 enableParams Hidden
_.set(autoFieldsMeta, `${itemParamsKey}.hidden`, (formValue) => {
return !formValue[itemEnabledKey] || !formValue['ansible_enabled']
@ -148,7 +148,7 @@ export const setAutomations = (vm) => {
// 设置 enableParams label
_.set(autoFieldsMeta, `${itemParamsKey}.label`, '')
// 设置 enableParams className
_.set(autoFieldsMeta, `${itemParamsKey}.attrs.class`, 'itemParamsKey')
_.set(autoFieldsMeta, `${itemParamsKey}.attrs.class`, 'item-params')
_.set(autoFieldsMeta, `${itemParamsKey}.component`, AutomationParamsSetting)
_.set(autoFieldsMeta, `${itemParamsKey}.el.method`, initial[itemMethodKey])
// }