You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/05/20 07:19:49 UTC
[dolphinscheduler] branch dev updated: [Fix][UI] Limit task group resource capacity to only positive integers. (#10158)
This is an automated email from the ASF dual-hosted git repository.
songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new c07339b07d [Fix][UI] Limit task group resource capacity to only positive integers. (#10158)
c07339b07d is described below
commit c07339b07dea2182bf6a3ba1ff0bcc1fe1f4af55
Author: songjianet <17...@qq.com>
AuthorDate: Fri May 20 15:19:43 2022 +0800
[Fix][UI] Limit task group resource capacity to only positive integers. (#10158)
---
dolphinscheduler-ui/src/locales/modules/en_US.ts | 3 +--
dolphinscheduler-ui/src/locales/modules/zh_CN.ts | 2 +-
.../src/views/resource/task-group/option/components/form-modal.tsx | 6 ++++--
.../src/views/resource/task-group/option/use-form.ts | 6 ++++++
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dolphinscheduler-ui/src/locales/modules/en_US.ts b/dolphinscheduler-ui/src/locales/modules/en_US.ts
index d095723900..60d1f02d69 100644
--- a/dolphinscheduler-ui/src/locales/modules/en_US.ts
+++ b/dolphinscheduler-ui/src/locales/modules/en_US.ts
@@ -308,8 +308,6 @@ const resource = {
name: 'Task group name',
project_name: 'Project name',
resource_pool_size: 'Resource pool size',
- resource_pool_size_be_a_number:
- 'The size of the task group resource pool should be more than 1',
resource_used_pool_size: 'Used resource',
desc: 'Task group desc',
status: 'Task group status',
@@ -319,6 +317,7 @@ const resource = {
please_enter_desc: 'Please enter task group description',
please_enter_resource_pool_size:
'Please enter task group resource pool size',
+ positive_integer_tips: 'should be a positive integer',
please_select_project: 'Please select a project',
create_time: 'Create time',
update_time: 'Update time',
diff --git a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
index e0ce9dcc12..33a0c2a7d6 100644
--- a/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
+++ b/dolphinscheduler-ui/src/locales/modules/zh_CN.ts
@@ -314,7 +314,7 @@ const resource = {
please_enter_name: '请输入任务组名称',
please_enter_desc: '请输入任务组描述',
please_enter_resource_pool_size: '请输入资源容量大小',
- resource_pool_size_be_a_number: '资源容量大小必须大于等于1的数值',
+ positive_integer_tips: '应为正整数',
please_select_project: '请选择项目',
create_time: '创建时间',
update_time: '更新时间',
diff --git a/dolphinscheduler-ui/src/views/resource/task-group/option/components/form-modal.tsx b/dolphinscheduler-ui/src/views/resource/task-group/option/components/form-modal.tsx
index 47be759f58..259d0a361e 100644
--- a/dolphinscheduler-ui/src/views/resource/task-group/option/components/form-modal.tsx
+++ b/dolphinscheduler-ui/src/views/resource/task-group/option/components/form-modal.tsx
@@ -16,7 +16,7 @@
*/
import { defineComponent, PropType, toRefs, onMounted, ref, Ref } from 'vue'
-import { NForm, NFormItem, NInput, NSelect } from 'naive-ui'
+import { NForm, NFormItem, NInput, NSelect, NInputNumber } from 'naive-ui'
import { useForm } from '../use-form'
import Modal from '@/components/modal'
import { createTaskGroup, updateTaskGroup } from '@/service/modules/task-group'
@@ -133,8 +133,10 @@ const FormModal = defineComponent({
label={t('resource.task_group_option.resource_pool_size')}
path='groupSize'
>
- <NInput
+ <NInputNumber
v-model:value={this.formData.groupSize}
+ style={{width: '100%'}}
+ min={1}
placeholder={t(
'resource.task_group_option.please_enter_resource_pool_size'
)}
diff --git a/dolphinscheduler-ui/src/views/resource/task-group/option/use-form.ts b/dolphinscheduler-ui/src/views/resource/task-group/option/use-form.ts
index 6f6f0e69c3..b5a77cf199 100644
--- a/dolphinscheduler-ui/src/views/resource/task-group/option/use-form.ts
+++ b/dolphinscheduler-ui/src/views/resource/task-group/option/use-form.ts
@@ -53,6 +53,12 @@ export function useForm() {
t('resource.task_group_option.please_enter_resource_pool_size')
)
}
+ if (!/^[1-9]\d*$/.test(state.formData.groupSize)) {
+ return new Error(
+ t('resource.task_group_option.resource_pool_size') +
+ t('resource.task_group_option.positive_integer_tips')
+ )
+ }
}
},
projectCode: {