Skip to content

Commit a2ad6fb

Browse files
author
wuchao
committed
Improvement datax json parameter validate
1 parent f5535dc commit a2ad6fb

File tree

1 file changed

+13
-1
lines changed
  • dolphinscheduler-ui/src/views/projects/task/components/node/fields

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ref, onMounted, watch } from 'vue'
1818
import { useI18n } from 'vue-i18n'
1919
import { useCustomParams, useDatasource, useResources } from '.'
2020
import type { IJsonItem } from '../types'
21+
import utils from '@/utils'
2122

2223
export function useDataX(model: { [field: string]: any }): IJsonItem[] {
2324
const { t } = useI18n()
@@ -175,7 +176,18 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
175176
validate: {
176177
trigger: ['input', 'trigger'],
177178
required: true,
178-
message: t('project.node.sql_empty_tips')
179+
validator() {
180+
if (
181+
model.json === '' ||
182+
model.json === undefined ||
183+
model.json === null
184+
) {
185+
return new Error(t('project.node.sql_empty_tips'))
186+
}
187+
if (!utils.isJson(model.json)) {
188+
return new Error(t('project.node.json_format_tips'))
189+
}
190+
}
179191
}
180192
},
181193
useResources(useResourcesSpan),

0 commit comments

Comments
 (0)