feat: 更新限制端口范围

pull/192/head
zhengkunwang223 2023-03-08 22:28:21 +08:00 committed by zhengkunwang223
parent 64d8dd5979
commit 8e76c9603a
3 changed files with 31 additions and 9 deletions

View File

@ -108,11 +108,11 @@ const checkVolumeName = (rule: any, value: any, callback: any) => {
const checkLinuxName = (rule: any, value: any, callback: any) => { const checkLinuxName = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) { if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?"<>|']))); callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?\'"<>|'])));
} else { } else {
const reg = /^((?!\\|\/|:|\*|\?|<|>|\||'|%).){1,30}$/; const reg = /^[^/\\\"'|<>?*]{1,30}$/;
if (!reg.test(value) && value !== '') { if (!reg.test(value) && value !== '') {
callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?"<>|']))); callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?\'"<>|'])));
} else { } else {
callback(); callback();
} }
@ -186,6 +186,19 @@ const checkParamUrlAndPort = (rule: any, value: any, callback: any) => {
} }
}; };
const checkPort = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.port')));
} else {
const reg = /^([1-9](\d{0,3}))$|^([1-5]\d{4})$|^(6[0-4]\d{3})$|^(65[0-4]\d{2})$|^(655[0-2]\d)$|^(6553[0-5])$/;
if (!reg.test(value) && value !== '') {
callback(new Error(i18n.global.t('commons.rule.port')));
} else {
callback();
}
}
};
const checkDoc = (rule: any, value: any, callback: any) => { const checkDoc = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) { if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.nginxDoc'))); callback(new Error(i18n.global.t('commons.rule.nginxDoc')));
@ -343,10 +356,7 @@ export const Rules: CommonRule = {
paramPort: { paramPort: {
required: true, required: true,
trigger: 'blur', trigger: 'blur',
min: 1, validator: checkPort,
max: 65535,
type: 'number',
message: i18n.global.t('commons.rule.port'),
}, },
paramExtUrl: { paramExtUrl: {
required: true, required: true,

View File

@ -9,7 +9,7 @@
:disabled="p.disabled" :disabled="p.disabled"
></el-input> ></el-input>
<el-input <el-input
v-model.number="form[p.envKey]" v-model="form[p.envKey]"
v-if="p.type == 'number'" v-if="p.type == 'number'"
:type="p.type" :type="p.type"
@change="updateParam" @change="updateParam"

View File

@ -23,7 +23,7 @@
> >
<el-button <el-button
:class="website.type === item.value ? 'active-button' : ''" :class="website.type === item.value ? 'active-button' : ''"
@click="website.type = item.value" @click="changeType(item.value)"
:type="website.type === item.value ? '' : 'info'" :type="website.type === item.value ? '' : 'info'"
:plain="website.type === item.value" :plain="website.type === item.value"
:text="website.type !== item.value" :text="website.type !== item.value"
@ -257,6 +257,18 @@ const handleClose = () => {
em('close', false); em('close', false);
}; };
const changeType = (type: string) => {
if (type == 'deployemnt') {
if (appInstalles.value && appInstalles.value.length > 0) {
website.value.appInstallId = appInstalles.value[0].id;
console.log(website.value);
}
} else {
website.value.appInstallId = undefined;
}
website.value.type = type;
};
const searchAppInstalled = () => { const searchAppInstalled = () => {
GetAppInstalled({ type: 'website', unused: true }).then((res) => { GetAppInstalled({ type: 'website', unused: true }).then((res) => {
appInstalles.value = res.data; appInstalles.value = res.data;