1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

fix: 主机分组设置增加默认分组

This commit is contained in:
ssongliu 2023-03-07 10:19:12 +08:00 committed by ssongliu
parent e36060d3ea
commit e3c78fd57d
5 changed files with 15 additions and 6 deletions

View File

@ -33,7 +33,7 @@ var AddTableHost = &gormigrate.Migration{
return err return err
} }
group := model.Group{ group := model.Group{
Name: "default", Type: "host", Name: "default", Type: "host", IsDefault: true,
} }
if err := tx.Create(&group).Error; err != nil { if err := tx.Create(&group).Error; err != nil {
return err return err

View File

@ -10,10 +10,13 @@
</template> </template>
<el-table-column :label="$t('commons.table.name')" prop="name"> <el-table-column :label="$t('commons.table.name')" prop="name">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="!row.edit"> <div v-if="!row.edit">
{{ row.name }} <span v-if="row.name === 'default'">
{{ $t('website.default') }}
</span>
<span v-if="row.name !== 'default'">{{ row.name }}</span>
<span v-if="row.isDefault">({{ $t('website.default') }})</span> <span v-if="row.isDefault">({{ $t('website.default') }})</span>
</span> </div>
<el-input v-if="row.edit" v-model="row.name"></el-input> <el-input v-if="row.edit" v-model="row.name"></el-input>
</template> </template>
</el-table-column> </el-table-column>

View File

@ -126,7 +126,7 @@ export default {
imageName: 'Support English, Chinese, numbers, :.-_, length 1-30', imageName: 'Support English, Chinese, numbers, :.-_, length 1-30',
volumeName: 'Support English, numbers, .-_, length 1-30', volumeName: 'Support English, numbers, .-_, length 1-30',
complexityPassword: complexityPassword:
'Please enter a password with more than 8 characters and at least two combinations of letters, numbers, and special symbols', 'Enter a password that is longer than eight characters and contains at least two letters, digits, and special characters',
commonPassword: 'Please enter a password with more than 6 characters', commonPassword: 'Please enter a password with more than 6 characters',
email: 'Email format error', email: 'Email format error',
number: 'Please enter the correct number', number: 'Please enter the correct number',

View File

@ -130,7 +130,7 @@ export default {
dbName: '支持英文中文数字.-_,长度1-16', dbName: '支持英文中文数字.-_,长度1-16',
imageName: '支持英文中文数字:.-_,长度1-30', imageName: '支持英文中文数字:.-_,长度1-30',
volumeName: '支持英文数字.-和_,长度1-30', volumeName: '支持英文数字.-和_,长度1-30',
complexityPassword: '请输入 8 位以上必须含有字母数字特殊符号至少两种组合的密码', complexityPassword: '请输入长度大于 8 位且包含字母数字特殊字符至少两项的密码组合',
commonPassword: '请输入 6 位以上长度密码', commonPassword: '请输入 6 位以上长度密码',
linuxName: '长度1-30名称不能含有{0}等符号', linuxName: '长度1-30名称不能含有{0}等符号',
email: '请输入正确的邮箱', email: '请输入正确的邮箱',

View File

@ -120,6 +120,12 @@ const rules = reactive({
const loadGroups = async () => { const loadGroups = async () => {
const res = await GetGroupList({ type: 'host' }); const res = await GetGroupList({ type: 'host' });
groupList.value = res.data; groupList.value = res.data;
for (const item of groupList.value) {
if (item.isDefault) {
dialogData.value.rowData.groupID = item.id;
break;
}
}
}; };
const submitAddHost = (formEl: FormInstance | undefined, ops: string) => { const submitAddHost = (formEl: FormInstance | undefined, ops: string) => {