Skip to content

Commit 19cb333

Browse files
authored
[Improvement-17063][UI][DATASYNC] Improvement datasync json parameter validate (#17064)
1 parent ddd8e9c commit 19cb333

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

dolphinscheduler-ui/src/locales/en_US/project.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,8 @@ export default {
924924
spark_submit_parameters: 'spark submit parameters',
925925
spark_submit_parameters_tips: 'spark submit parameters',
926926
is_production: 'is production',
927-
is_production_tips: 'is production'
927+
is_production_tips: 'is production',
928+
json_format_tips: 'Json parameters format is abnormal'
928929
},
929930
menu: {
930931
fav: 'Favorites',

dolphinscheduler-ui/src/locales/zh_CN/project.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,8 @@ export default {
894894
spark_submit_parameters: 'spark submit parameters',
895895
spark_submit_parameters_tips: 'spark submit parameters',
896896
is_production: 'is production',
897-
is_production_tips: 'is production'
897+
is_production_tips: 'is production',
898+
json_format_tips: 'JSON参数格式异常'
898899
},
899900
menu: {
900901
fav: '收藏组件',

dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasync.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
import type { IJsonItem } from '../types'
1919
import { watch, ref } from 'vue'
2020
import { useCustomParams } from '.'
21+
import utils from '@/utils'
22+
import { useI18n } from 'vue-i18n'
2123

2224
export function useDatasync(model: { [field: string]: any }): IJsonItem[] {
2325
const jsonSpan = ref(0)
2426
const destinationLocationArnSpan = ref(0)
2527
const sourceLocationArnSpan = ref(0)
2628
const nameSpan = ref(0)
2729
const cloudWatchLogGroupArnSpan = ref(0)
30+
const { t } = useI18n()
2831

2932
const resetSpan = () => {
3033
jsonSpan.value = model.jsonFormat ? 24 : 0
@@ -54,7 +57,15 @@ export function useDatasync(model: { [field: string]: any }): IJsonItem[] {
5457
type: 'editor',
5558
field: 'json',
5659
name: 'json',
57-
span: jsonSpan
60+
span: jsonSpan,
61+
validate: {
62+
trigger: ['input', 'blur'],
63+
validator() {
64+
if (model.json && !utils.isJson(model.json)) {
65+
return new Error(t('project.node.json_format_tips'))
66+
}
67+
}
68+
}
5869
},
5970
{
6071
type: 'input',

0 commit comments

Comments
 (0)