mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: 修改 base model
This commit is contained in:
@@ -118,7 +118,7 @@ export default {
|
||||
return { name: proto[0], port: proto[1] }
|
||||
})
|
||||
const protocolsNames = this.protocols.map(item => item.name)
|
||||
items = items.filter(item => protocolsNames[item.name])
|
||||
items = items.filter(item => protocolsNames.indexOf(item.name) > -1)
|
||||
}
|
||||
if (items.length === 0) {
|
||||
items.push({ ...this.protocols[0] })
|
||||
|
||||
@@ -496,3 +496,8 @@ a {
|
||||
.el-input-group__append, .el-input-group__prepend {
|
||||
color: $--color-primary
|
||||
}
|
||||
|
||||
.el-input.is-disabled .el-input__inner {
|
||||
color: $--color-text-primary;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
@@ -12,17 +12,8 @@ export default {
|
||||
GenericCreateUpdatePage
|
||||
},
|
||||
data() {
|
||||
const nodesInitial = []
|
||||
if (this.$route.query['node']) {
|
||||
nodesInitial.push(this.$route.query.node)
|
||||
}
|
||||
return {
|
||||
initial: {
|
||||
is_active: true,
|
||||
platform: 'Linux',
|
||||
protocols: ['ssh/22'],
|
||||
nodes: nodesInitial
|
||||
},
|
||||
initial: {},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['hostname', 'ip', 'platform', 'public_ip', 'domain']],
|
||||
[this.$t('assets.Protocols'), ['protocols']],
|
||||
@@ -36,6 +27,32 @@ export default {
|
||||
createSuccessNextRoute: { name: 'AssetDetail' },
|
||||
hasDetailInMsg: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.setPlatformInitial()
|
||||
},
|
||||
methods: {
|
||||
async setPlatformInitial() {
|
||||
const nodesInitial = []
|
||||
if (this.$route.query['node']) {
|
||||
nodesInitial.push(this.$route.query.node)
|
||||
}
|
||||
const platformId = this.$route.query['platform'] || 1
|
||||
const url = `/api/v1/assets/platforms/${platformId}/`
|
||||
this.platform = await this.$axios.get(url)
|
||||
const initial = {
|
||||
is_active: true,
|
||||
platform: parseInt(platformId),
|
||||
protocols: this.platform.protocols_default || ['ssh/22'],
|
||||
nodes: nodesInitial,
|
||||
domain: this.platform['domain_default'],
|
||||
admin_user: this.platform['admin_user_default']
|
||||
}
|
||||
const limits = this.platform['type_limits']
|
||||
this.fieldsMeta.protocols.el.choices = limits['protocols_limit']
|
||||
this.initial = initial
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -48,9 +48,11 @@ export default {
|
||||
platform: parseInt(platformId),
|
||||
protocols: this.platform.protocols_default || ['ssh/22'],
|
||||
nodes: nodesInitial,
|
||||
domain: this.platform['domain_default'],
|
||||
admin_user: this.platform['admin_user_default']
|
||||
}
|
||||
this.fieldsMeta.protocols.el.choices = this.platform
|
||||
const limits = this.platform['type_limits']
|
||||
this.fieldsMeta.protocols.el.choices = limits['protocols_limit']
|
||||
this.initial = initial
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user