Browse Source

[Fix][UI] Limit task group resource capacity to only positive integers. (#10158)

3.1.0-release
songjianet 3 years ago committed by GitHub
parent
commit
c07339b07d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dolphinscheduler-ui/src/locales/modules/en_US.ts
  2. 2
      dolphinscheduler-ui/src/locales/modules/zh_CN.ts
  3. 6
      dolphinscheduler-ui/src/views/resource/task-group/option/components/form-modal.tsx
  4. 6
      dolphinscheduler-ui/src/views/resource/task-group/option/use-form.ts

3
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',

2
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: '更新时间',

6
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'
)}

6
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: {

Loading…
Cancel
Save