in dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sea-tunnel.ts [22:157]
export function useSeaTunnel(model: { [field: string]: any }): IJsonItem[] {
const { t } = useI18n()
const configEditorSpan = computed(() => (model.useCustom ? 24 : 0))
const resourceEditorSpan = computed(() => (model.useCustom ? 0 : 24))
const flinkSpan = computed(() =>
model.startupScript.includes('flink') ? 24 : 0
)
const deployModeSpan = computed(() =>
model.startupScript.includes('spark') ||
model.startupScript === 'seatunnel.sh'
? 24
: 0
)
const masterSpan = computed(() =>
model.startupScript.includes('spark') && model.deployMode !== 'local'
? 12
: 0
)
const masterUrlSpan = computed(() =>
model.startupScript.includes('spark') &&
model.deployMode !== 'local' &&
(model.master === 'SPARK' || model.master === 'MESOS')
? 12
: 0
)
const showClient = computed(() => model.startupScript.includes('spark'))
const showLocal = computed(() => model.startupScript === 'seatunnel.sh')
const othersSpan = computed(() =>
model.startupScript.includes('flink') ||
model.startupScript === 'seatunnel.sh'
? 24
: 0
)
return [
{
type: 'select',
field: 'startupScript',
span: 15,
name: t('project.node.startup_script'),
options: STARTUP_SCRIPT,
validate: {
trigger: ['input', 'blur'],
required: true,
message: t('project.node.startup_script_tips')
},
props: {
'on-update:value': (value: boolean) => {
if (value) {
if (model.startupScript === 'seatunnel.sh') {
model.deployMode = 'local'
}
if (model.startupScript.includes('spark')) {
model.deployMode = 'client'
}
}
}
}
},
// SeaTunnel flink parameter
{
type: 'select',
field: 'runMode',
name: t('project.node.run_mode'),
options: FLINK_RUN_MODE,
value: model.runMode,
span: flinkSpan
},
{
type: 'input',
field: 'others',
name: t('project.node.option_parameters'),
span: othersSpan,
props: {
type: 'textarea',
placeholder: t('project.node.option_parameters_tips')
}
},
// SeaTunnel spark parameter
useDeployMode(deployModeSpan, showClient, ref(true), showLocal),
{
type: 'select',
field: 'master',
name: t('project.node.sea_tunnel_master'),
options: masterTypeOptions,
value: model.master,
span: masterSpan
},
{
type: 'input',
field: 'masterUrl',
name: t('project.node.sea_tunnel_master_url'),
value: model.masterUrl,
span: masterUrlSpan,
props: {
placeholder: t('project.node.sea_tunnel_master_url_tips')
},
validate: {
trigger: ['input', 'blur'],
required: masterUrlSpan.value !== 0,
validator(validate: any, value: string) {
if (masterUrlSpan.value !== 0 && !value) {
return new Error(t('project.node.sea_tunnel_master_url_tips'))
}
}
}
},
// SeaTunnel config parameter
{
type: 'switch',
field: 'useCustom',
name: t('project.node.custom_config')
},
{
type: 'editor',
field: 'rawScript',
name: t('project.node.script'),
span: configEditorSpan,
validate: {
trigger: ['input', 'trigger'],
required: model.useCustom,
validator(validate: any, value: string) {
if (model.useCustom && !value) {
return new Error(t('project.node.script_tips'))
}
}
}
},
useResources(resourceEditorSpan, true, 1),
...useCustomParams({ model, field: 'localParams', isSimple: true })
]
}