mirror of https://github.com/1Panel-dev/1Panel
fix: 修改镜像构建名称校验规则
parent
05ef2373ef
commit
6f425a6a0e
|
@ -41,6 +41,19 @@ const checkName = (rule: any, value: any, callback: any) => {
|
|||
}
|
||||
};
|
||||
|
||||
const checkImageName = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.commonName')));
|
||||
} else {
|
||||
const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-z:A-Z0-9_.\u4e00-\u9fa5-]{0,30}$/;
|
||||
if (!reg.test(value) && value !== '') {
|
||||
callback(new Error(i18n.global.t('commons.rule.imageName')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const checkLinuxName = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.linuxName')));
|
||||
|
@ -59,6 +72,7 @@ interface CommonRule {
|
|||
requiredSelect: FormItemRule;
|
||||
requiredSelectBusiness: FormItemRule;
|
||||
name: FormItemRule;
|
||||
imageName: FormItemRule;
|
||||
linuxName: FormItemRule;
|
||||
password: FormItemRule;
|
||||
email: FormItemRule;
|
||||
|
@ -86,6 +100,11 @@ export const Rules: CommonRule = {
|
|||
message: i18n.global.t('commons.rule.requiredSelect'),
|
||||
trigger: 'change',
|
||||
},
|
||||
imageName: {
|
||||
required: true,
|
||||
validator: checkImageName,
|
||||
trigger: 'blur',
|
||||
},
|
||||
name: {
|
||||
required: true,
|
||||
validator: checkName,
|
||||
|
|
|
@ -99,6 +99,7 @@ export default {
|
|||
requiredInput: 'Please enter the required fields',
|
||||
requiredSelect: 'Please select the required fields',
|
||||
commonName: 'Support English, Chinese, numbers, .-_, length 1-30',
|
||||
imageName: 'Support English, Chinese, numbers, :.-_, length 1-30',
|
||||
complexityPassword:
|
||||
'Please enter a password with more than 8 characters and must contain letters, digits, and special symbols',
|
||||
commonPassword: 'Please enter a password with more than 6 characters',
|
||||
|
@ -636,6 +637,7 @@ export default {
|
|||
backup: 'Backup',
|
||||
noTypeForCreate: 'No backup type is currently created',
|
||||
serverDisk: 'Server disks',
|
||||
currentPath: 'Current path',
|
||||
OSS: 'Ali OSS',
|
||||
S3: 'Amazon S3',
|
||||
backupAccount: 'Backup account',
|
||||
|
|
|
@ -99,6 +99,7 @@ export default {
|
|||
requiredInput: '请填写必填项',
|
||||
requiredSelect: '请选择必选项',
|
||||
commonName: '支持英文、中文、数字、.-_,长度1-30',
|
||||
imageName: '支持英文、中文、数字、:.-_,长度1-30',
|
||||
complexityPassword: '请输入 8 位以上、必须含有字母、数字、特殊符号的密码',
|
||||
commonPassword: '请输入 6 位以上长度密码',
|
||||
linuxName: '支持英文、数字、.-_,长度1-30',
|
||||
|
@ -653,6 +654,7 @@ export default {
|
|||
backup: '备份',
|
||||
noTypeForCreate: '当前无可创建备份类型',
|
||||
serverDisk: '服务器磁盘',
|
||||
currentPath: '当前路径',
|
||||
OSS: '阿里云 OSS',
|
||||
S3: '亚马逊 S3 云存储',
|
||||
backupAccount: '备份账号',
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
placeholder="Wait for build output..."
|
||||
:indent-with-tab="true"
|
||||
:tabSize="4"
|
||||
style="max-height: 500px"
|
||||
style="max-height: 300px"
|
||||
:lineWrapping="true"
|
||||
:matchBrackets="true"
|
||||
theme="cobalt"
|
||||
|
@ -100,7 +100,7 @@ const varifyPath = (rule: any, value: any, callback: any) => {
|
|||
callback();
|
||||
};
|
||||
const rules = reactive({
|
||||
name: [Rules.requiredInput, Rules.name],
|
||||
name: [Rules.requiredInput, Rules.imageName],
|
||||
from: [Rules.requiredSelect],
|
||||
dockerfile: [Rules.requiredInput, { validator: varifyPath, trigger: 'change', required: true }],
|
||||
});
|
||||
|
@ -110,6 +110,7 @@ const acceptParams = async () => {
|
|||
form.dockerfile = '';
|
||||
form.tagStr = '';
|
||||
form.name = '';
|
||||
logInfo.value = '';
|
||||
};
|
||||
|
||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<el-table-column type="selection" fix />
|
||||
<el-table-column :label="$t('commons.table.name')" min-width="100" prop="name" fix />
|
||||
<el-table-column :label="$t('terminal.command')" min-width="300" show-overflow-tooltip prop="command" />
|
||||
<fu-table-operations type="icon" :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
||||
<fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
||||
</ComplexTable>
|
||||
</el-card>
|
||||
<el-dialog v-model="cmdVisiable" :title="$t('terminal.addHost')" width="30%">
|
||||
|
|
|
@ -106,6 +106,12 @@ const SaveSetting = async (formEl: FormInstance | undefined, key: string, val: a
|
|||
globalStore.setThemeConfig({ ...themeConfig.value, theme: val });
|
||||
switchDark();
|
||||
break;
|
||||
case 'SessionTimeout':
|
||||
if (Number(val) < 300) {
|
||||
ElMessage.error(i18n.t('setting.sessionTimeoutError'));
|
||||
search();
|
||||
return;
|
||||
}
|
||||
case 'PanelName':
|
||||
globalStore.setThemeConfig({ ...themeConfig.value, panelName: val });
|
||||
break;
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
<span style="font-size: 16px; font-weight: 500"> {{ loadBackupName(item.type) }}</span>
|
||||
<div style="float: right">
|
||||
<el-button @click="onEdit(item)">{{ $t('commons.button.edit') }}</el-button>
|
||||
<el-button @click="onBatchDelete(item)">
|
||||
<el-button v-if="item.type !== 'LOCAL'" @click="onBatchDelete(item)">
|
||||
{{ $t('commons.button.delete') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-position="left" label-width="130px">
|
||||
<el-form-item v-if="item.type === 'LOCAL'" label="Directory">
|
||||
<el-form-item v-if="item.type === 'LOCAL'" :label="$t('setting.currentPath')">
|
||||
{{ item.varsJson['dir'] }}
|
||||
</el-form-item>
|
||||
<el-form-item v-if="item.type === 'S3'" label="Region">
|
||||
|
@ -73,7 +73,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.type === 'LOCAL'"
|
||||
label="Directory"
|
||||
:label="$t('setting.currentPath')"
|
||||
prop="varsJson['dir']"
|
||||
:rules="Rules.requiredInput"
|
||||
>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
<el-form-item
|
||||
:label="$t('setting.sessionTimeout')"
|
||||
:rules="sessionTimeoutRules"
|
||||
:rules="Rules.number"
|
||||
prop="settingInfo.sessionTimeout"
|
||||
>
|
||||
<el-input v-model.number="form.settingInfo.sessionTimeout">
|
||||
|
@ -199,11 +199,6 @@ const passForm = reactive({
|
|||
retryPassword: '',
|
||||
});
|
||||
|
||||
const sessionTimeoutRules = [
|
||||
Rules.number,
|
||||
{ min: 300, type: 'number', message: i18n.global.t('setting.sessionTimeoutError'), trigger: 'blur' },
|
||||
];
|
||||
|
||||
interface Props {
|
||||
settingInfo: any;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue