mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
perf: 修改 添加 account
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
|
||||
<script>
|
||||
import AutoDataForm from '@/components/AutoDataForm'
|
||||
import { UpdateToken } from '@/components/FormFields'
|
||||
import { UploadKey } from '@/components'
|
||||
import { UpdateToken, UploadKey } from '@/components/FormFields'
|
||||
export default {
|
||||
name: 'AccountCreateForm',
|
||||
components: {
|
||||
@@ -14,7 +13,7 @@ export default {
|
||||
props: {
|
||||
protocols: {
|
||||
type: Array,
|
||||
default: () => ['ssh', 'rdp']
|
||||
default: () => ([])
|
||||
},
|
||||
accounts: {
|
||||
type: Array,
|
||||
@@ -30,16 +29,16 @@ export default {
|
||||
url: '/api/v1/assets/accounts/',
|
||||
form: this.account || { protocol: this.protocols[0] },
|
||||
fields: [
|
||||
'protocol', 'type', 'username', 'password',
|
||||
'type', 'username', 'password',
|
||||
'private_key', 'passphrase', 'comment'
|
||||
],
|
||||
fieldsMeta: {
|
||||
protocol: {
|
||||
type: 'radio-group',
|
||||
label: this.$t('assets.Protocol'),
|
||||
default: this.protocols[0],
|
||||
default: this.protocols[0].name,
|
||||
options: this.protocols.map((item) => {
|
||||
return { label: item.toUpperCase(), value: item }
|
||||
return { label: item.name.toUpperCase(), value: item.name }
|
||||
})
|
||||
},
|
||||
password: {
|
||||
@@ -55,6 +54,9 @@ export default {
|
||||
hasSaveContinue: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log('protocols: ', this.protocols)
|
||||
},
|
||||
methods: {
|
||||
confirm(form) {
|
||||
if (this.account && this.account._id) {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ActionsFormatter, DetailFormatter, DisplayFormatter } from '@/components/TableFormatters'
|
||||
import { ActionsFormatter, DetailFormatter } from '@/components/TableFormatters'
|
||||
import ShowSecretInfo from '../AccountListTable/ShowSecretInfo'
|
||||
import { GenericListPage } from '@/layout/components'
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
resource: 'authbook'
|
||||
},
|
||||
columns: [
|
||||
'hostname', 'ip', 'username', 'version',
|
||||
'asset_name', 'ip', 'username', 'version',
|
||||
'systemuser', 'date_created', 'date_updated', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
@@ -60,9 +60,9 @@ export default {
|
||||
default: ['hostname', 'ip', 'username', 'version', 'actions']
|
||||
},
|
||||
columnsMeta: {
|
||||
hostname: {
|
||||
prop: 'hostname',
|
||||
label: this.$t('assets.Hostname'),
|
||||
asset_name: {
|
||||
prop: 'asset_name',
|
||||
label: this.$t('assets.Name'),
|
||||
showOverflowTooltip: true,
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
@@ -81,9 +81,6 @@ export default {
|
||||
username: {
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
systemuser: {
|
||||
formatter: DisplayFormatter
|
||||
},
|
||||
version: {
|
||||
width: '70px'
|
||||
},
|
||||
|
@@ -40,7 +40,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
account: {
|
||||
hostname: '',
|
||||
name: '',
|
||||
username: '',
|
||||
password: '',
|
||||
private_key: ''
|
||||
@@ -49,7 +49,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
protocols() {
|
||||
return this.asset ? this.asset.protocols.map((item) => item.split('/')[0]) : []
|
||||
return this.asset ? this.asset.protocol : []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@@ -17,8 +17,8 @@
|
||||
>
|
||||
<div>
|
||||
<el-form label-position="right" label-width="80px" :model="authInfo">
|
||||
<el-form-item :label="this.$t('assets.Hostname')">
|
||||
<el-input v-model="account.hostname" readonly />
|
||||
<el-form-item :label="this.$t('assets.Name')">
|
||||
<el-input v-model="account['asset_name']" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('assets.Username')">
|
||||
<el-input v-model="account['username']" readonly />
|
||||
|
@@ -9,8 +9,8 @@
|
||||
v-on="$listeners"
|
||||
>
|
||||
<el-form label-position="right" label-width="90px">
|
||||
<el-form-item :label="this.$t('assets.Hostname')">
|
||||
<el-input v-model="account.hostname" readonly />
|
||||
<el-form-item :label="this.$t('assets.Name')">
|
||||
<el-input v-model="account['asset_name']" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('assets.Username')">
|
||||
<el-input v-model="account['username']" readonly />
|
||||
|
@@ -88,17 +88,17 @@ export default {
|
||||
this.items.push({ ...this.remainProtocols[0] })
|
||||
},
|
||||
handleProtocolChange(evt, item) {
|
||||
const selected = this.protocols.find(item => item.name === evt)
|
||||
const selected = this.choices.find(item => item.name === evt)
|
||||
item.name = selected.name
|
||||
item.port = selected.port
|
||||
},
|
||||
setDefaultItems(choices) {
|
||||
if (!this.value) {
|
||||
if (choices.length !== 0) {
|
||||
this.items = [choices[0]]
|
||||
}
|
||||
} else {
|
||||
if (this.value && this.value.length > 0) {
|
||||
this.items = [...this.value]
|
||||
return
|
||||
}
|
||||
if (choices.length !== 0) {
|
||||
this.items = [choices[0]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ export default {
|
||||
ajax: {
|
||||
url: '/api/v1/assets/assets/?platform__base=Windows',
|
||||
transformOption: (item) => {
|
||||
return { label: item.hostname, value: item.id }
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ export default {
|
||||
return {
|
||||
initial: {},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['hostname', 'ip', 'platform', 'domain']]
|
||||
[this.$t('common.Basic'), ['name', 'ip', 'platform', 'domain']]
|
||||
// [this.$t('assets.Protocol'), ['protocols']],
|
||||
// [this.$t('assets.Node'), ['nodes']],
|
||||
// this.$route.params.id ? null : [this.$t('assets.Account'), ['accounts']],
|
||||
|
@@ -24,7 +24,12 @@
|
||||
|
||||
<script>
|
||||
import GenericTreeListPage from '@/layout/components/GenericTreeListPage/index'
|
||||
import { DetailFormatter, ActionsFormatter, TagsFormatter, NestedObjectFormatter } from '@/components/TableFormatters'
|
||||
import {
|
||||
DetailFormatter,
|
||||
ActionsFormatter,
|
||||
TagsFormatter,
|
||||
NestedObjectFormatter
|
||||
} from '@/components/TableFormatters'
|
||||
import $ from '@/utils/jquery-vendor'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { connectivityMeta } from '@/components/AccountListTable/const'
|
||||
@@ -61,7 +66,7 @@ export default {
|
||||
url: '/api/v1/assets/assets/',
|
||||
hasTree: true,
|
||||
columns: [
|
||||
'hostname', 'ip', 'protocols',
|
||||
'name', 'ip', 'protocols',
|
||||
'category', 'type', 'platform',
|
||||
'labels', 'nodes',
|
||||
'is_active', 'connectivity',
|
||||
|
@@ -15,9 +15,11 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
platform: {},
|
||||
initial: { labels: [] },
|
||||
initial: {
|
||||
labels: []
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['hostname', 'ip', 'platform', 'domain']],
|
||||
[this.$t('common.Basic'), ['name', 'ip', 'platform', 'domain']],
|
||||
[this.$t('assets.Protocols'), ['protocols']],
|
||||
[this.$t('assets.Node'), ['nodes']],
|
||||
this.$route.params.id ? null : [this.$t('assets.Account'), ['accounts']],
|
||||
@@ -45,13 +47,12 @@ export default {
|
||||
const initial = {
|
||||
is_active: true,
|
||||
platform: parseInt(platformId),
|
||||
protocols: this.platform.protocols_default || ['ssh/22'],
|
||||
protocols: this.platform.protocols_default,
|
||||
nodes: nodesInitial,
|
||||
domain: this.platform['domain_default'],
|
||||
admin_user: this.platform['admin_user_default']
|
||||
domain: this.platform.domain_default
|
||||
}
|
||||
const limits = this.platform['type_limits']
|
||||
this.fieldsMeta.protocols.el.choices = limits['protocols_limit']
|
||||
const constraints = this.platform['type_constraints']
|
||||
this.fieldsMeta.protocols.el.choices = constraints['protocols']
|
||||
this.initial = initial
|
||||
this.loading = false
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
initial: {
|
||||
comment: 'Hello world',
|
||||
comment: '',
|
||||
charset: 'utf8',
|
||||
category_type: ['host', 'linux'],
|
||||
domain_enabled: false,
|
||||
@@ -106,20 +106,16 @@ export default {
|
||||
},
|
||||
protocols_enabled: {
|
||||
el: {
|
||||
disabled: false,
|
||||
value: false
|
||||
},
|
||||
value: false
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
protocols_default: {
|
||||
...assetMeta.protocols,
|
||||
hidden: (formValue) => {
|
||||
console.log('formValue', formValue)
|
||||
return !formValue['protocols_enabled']
|
||||
}
|
||||
},
|
||||
domain_enabled: {
|
||||
value: true,
|
||||
el: {
|
||||
disabled: false
|
||||
}
|
||||
|
Reference in New Issue
Block a user