Skip to content

Commit

Permalink
feat: 编辑应用 cpu 和内存限制增加校验 (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkunwang223 authored May 31, 2023
1 parent 763f450 commit 2207711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frontend/src/views/app-store/installed/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import { reactive, ref } from 'vue';
import Header from '@/components/drawer-header/index.vue';
import { useI18n } from 'vue-i18n';
import { FormInstance } from 'element-plus';
import { Rules } from '@/global/form-rules';
import { Rules, checkNumberRange } from '@/global/form-rules';
import { MsgSuccess } from '@/utils/message';
import i18n from '@/lang';
import { canEditPort } from '@/global/business';
Expand Down Expand Up @@ -128,6 +128,8 @@ const paramModel = ref<any>({
});
const rules = reactive({
params: {},
cpuQuota: [Rules.requiredInput, checkNumberRange(0, 99999)],
memoryLimit: [Rules.requiredInput, checkNumberRange(0, 9999999999)],
});
const submitModel = ref<any>({});
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/views/website/website/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
:placeholder="$t('app.containerNameHelper')"
></el-input>
</el-form-item>
<el-form-item :label="$t('container.cpuQuota')" prop="cpuQuota">
<el-form-item :label="$t('container.cpuQuota')" prop="appinstall.cpuQuota">
<el-input
type="number"
style="width: 40%"
Expand All @@ -213,7 +213,7 @@
</el-input>
<span class="input-help">{{ $t('container.limitHelper') }}</span>
</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">
<template #append>
<el-select
Expand Down Expand Up @@ -302,7 +302,7 @@ import {
CheckAppInstalled,
} from '@/api/modules/app';
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 { ElForm, FormInstance } from 'element-plus';
import { reactive, ref } from 'vue';
Expand Down Expand Up @@ -358,6 +358,8 @@ const rules = ref<any>({
name: [Rules.appName],
appId: [Rules.requiredSelectBusiness],
params: {},
cpuQuota: [Rules.requiredInput, checkNumberRange(0, 99999)],
memoryLimit: [Rules.requiredInput, checkNumberRange(0, 9999999999)],
},
proxyType: [Rules.requiredSelect],
port: [Rules.port],
Expand Down

0 comments on commit 2207711

Please sign in to comment.