mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-10 19:50:53 +08:00
feat: 编辑应用 cpu 和内存限制增加校验 (#1205)
This commit is contained in:
parent
763f450f43
commit
2207711400
2 changed files with 8 additions and 4 deletions
|
|
@ -100,7 +100,7 @@ import { reactive, ref } from 'vue';
|
||||||
import Header from '@/components/drawer-header/index.vue';
|
import Header from '@/components/drawer-header/index.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { FormInstance } from 'element-plus';
|
import { FormInstance } from 'element-plus';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { canEditPort } from '@/global/business';
|
import { canEditPort } from '@/global/business';
|
||||||
|
|
@ -128,6 +128,8 @@ const paramModel = ref<any>({
|
||||||
});
|
});
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
params: {},
|
params: {},
|
||||||
|
cpuQuota: [Rules.requiredInput, checkNumberRange(0, 99999)],
|
||||||
|
memoryLimit: [Rules.requiredInput, checkNumberRange(0, 9999999999)],
|
||||||
});
|
});
|
||||||
const submitModel = ref<any>({});
|
const submitModel = ref<any>({});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
:placeholder="$t('app.containerNameHelper')"
|
:placeholder="$t('app.containerNameHelper')"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('container.cpuQuota')" prop="cpuQuota">
|
<el-form-item :label="$t('container.cpuQuota')" prop="appinstall.cpuQuota">
|
||||||
<el-input
|
<el-input
|
||||||
type="number"
|
type="number"
|
||||||
style="width: 40%"
|
style="width: 40%"
|
||||||
|
|
@ -213,7 +213,7 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
<span class="input-help">{{ $t('container.limitHelper') }}</span>
|
<span class="input-help">{{ $t('container.limitHelper') }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('container.memoryLimit')" prop="memoryLimit">
|
<el-form-item :label="$t('container.memoryLimit')" prop="appinstall.memoryLimit">
|
||||||
<el-input style="width: 40%" v-model.number="website.appinstall.memoryLimit" maxlength="10">
|
<el-input style="width: 40%" v-model.number="website.appinstall.memoryLimit" maxlength="10">
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-select
|
<el-select
|
||||||
|
|
@ -302,7 +302,7 @@ import {
|
||||||
CheckAppInstalled,
|
CheckAppInstalled,
|
||||||
} from '@/api/modules/app';
|
} from '@/api/modules/app';
|
||||||
import { CreateWebsite, PreCheck } from '@/api/modules/website';
|
import { CreateWebsite, PreCheck } from '@/api/modules/website';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { ElForm, FormInstance } from 'element-plus';
|
import { ElForm, FormInstance } from 'element-plus';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
|
@ -358,6 +358,8 @@ const rules = ref<any>({
|
||||||
name: [Rules.appName],
|
name: [Rules.appName],
|
||||||
appId: [Rules.requiredSelectBusiness],
|
appId: [Rules.requiredSelectBusiness],
|
||||||
params: {},
|
params: {},
|
||||||
|
cpuQuota: [Rules.requiredInput, checkNumberRange(0, 99999)],
|
||||||
|
memoryLimit: [Rules.requiredInput, checkNumberRange(0, 9999999999)],
|
||||||
},
|
},
|
||||||
proxyType: [Rules.requiredSelect],
|
proxyType: [Rules.requiredSelect],
|
||||||
port: [Rules.port],
|
port: [Rules.port],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue