This commit is contained in:
jhnine 2022-12-06 17:06:28 +08:00
parent 90f9af892a
commit 32cf33e859
4 changed files with 24 additions and 11 deletions

View File

@ -6,7 +6,8 @@
</el-steps>
<el-form v-show="stepNum===0" ref="editInfoForm" :rules="rules" :model="editInfoForm" label-width="180px" class="base-form">
<el-form-item prop="clusterName" label="集群名称">
<el-input v-model="editInfoForm.clusterName" :maxlength="100" />
<el-input v-model="editInfoForm.clusterName" :maxlength="63" />
<span class="tips">最长 63 个字符只能包含小写字母数字及分隔符("-")且必须以小写字母开头, 字母或数字结尾</span>
</el-form-item>
<el-form-item prop="version" label="K8S版本">
<el-select v-model="editInfoForm.version" placeholder="请选择">
@ -21,7 +22,7 @@
</el-form>
<NodeCreate v-show="stepNum===1" v-model="editInfoForm" />
<div slot="footer" class="dialog-footer">
<el-button @click="createFormVisible = false;transformYaml()"> </el-button>
<el-button @click="createFormVisible = false;"> </el-button>
<el-button v-if="stepNum!==0" type="primary" @click="prev">上一步</el-button>
<el-button v-if="stepNum!==1" type="primary" @click="next">下一步</el-button>
<el-button v-else type="primary" :loading="loading" @click="createWorkload">创建</el-button>
@ -48,7 +49,11 @@ export default {
editInfoForm: {},
rules: {
clusterName: [
{ required: true, message: '请输入' }
{ required: true, message: '请输入' },
{
pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
message: '名称格式不合法。'
}
],
version: [
{ required: true, message: '请选择' }

View File

@ -10,6 +10,7 @@
:columns="columns"
height="250"
:table-list-data="listData"
:default-sort="{prop: 'existTime', order: 'ascending'}"
:pagination="false"
@selection-change="(val) => currentChange(val, 'master')"
/>
@ -24,6 +25,7 @@
height="250"
:table-list-data="listData2"
:pagination="false"
:default-sort="{prop: 'existTime', order: 'ascending'}"
@selection-change="(val) => currentChange(val, 'worker')"
/>
</el-form-item>
@ -51,16 +53,22 @@ export default {
columns: [
{ type: 'selection', selectable: (row) => !this.memberNodes.includes(row.ipAddress) },
{ prop: 'name', label: '配置名称' },
{ prop: 'cpu', label: 'CPU' },
{ prop: 'memory', label: '内存' },
{ prop: 'ipAddress', label: '网络资源' }
{ prop: 'cpu', width: '100', label: 'CPU' },
{ prop: 'memory', width: '100', label: '内存' },
{ prop: 'ipAddress', width: '180', label: '网络资源' },
{ prop: 'existTime', width: '1', label: '', sortable: true, formatter: (row) => {
return ''
} }
],
columns2: [
{ type: 'selection', selectable: (row) => !this.masterNodes.includes(row.ipAddress) },
{ prop: 'name', label: '配置名称' },
{ prop: 'cpu', label: 'CPU' },
{ prop: 'memory', label: '内存' },
{ prop: 'ipAddress', label: '网络资源' }
{ prop: 'cpu', width: '100', label: 'CPU' },
{ prop: 'memory', width: '100', label: '内存' },
{ prop: 'ipAddress', width: '180', label: '网络资源' },
{ prop: 'existTime', width: '1', label: '', sortable: true, formatter: (row) => {
return ''
} }
]
}
},

View File

@ -317,7 +317,7 @@ export default {
if (!this.disableConfig) {
this.allComponents.push('VMImage')
this.allNetworkCard.push({
name: 'default', type: 'masquerade', model: 'virtio', networkName: 'management Network'
name: 'default', type: 'bridge', model: 'virtio', networkName: 'management Network'
})
}
this.getSSHKeys()

View File

@ -112,7 +112,7 @@ export default {
getImages().then(res => {
this.imageList = res.data
if (this.formData.imageId === '') {
this.formData.imageId = res.data?.[0].id || ''
this.formData.imageId = res.data?.[7]?.id || ''
}
})
},