Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const getField = (
) => {
const { type = 'input' } = item
const renderTypeName = `render${upperFirst(camelCase(type))}`
if (type === 'custom') {
return item.widget || null
}
// TODO Support other widgets later
if (type === 'custom-parameters') {
let fieldRules: { [key: string]: FormItemRule }[] = []
Expand Down
3 changes: 3 additions & 0 deletions dolphinscheduler-ui-next/src/components/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type IType =
| 'checkbox'
| 'tree-select'
| 'multi-input'
| 'custom'

interface IOption extends SelectOption, TreeSelectOption {
label: string
Expand All @@ -46,6 +47,7 @@ interface IFormItem {
label?: string
widget: any
span?: number | Ref<number>
type?: 'custom'
}

interface IMeta extends Omit<FormProps, 'model'> {
Expand All @@ -65,6 +67,7 @@ interface IJsonItem {
children?: IJsonItem[]
slots?: object
span?: number | Ref<number>
widget?: any
}

export {
Expand Down
61 changes: 59 additions & 2 deletions dolphinscheduler-ui-next/src/locales/modules/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ const project = {
target_task_name: 'Target Task Name',
target_task_name_tips: 'Please enter the Pigeon task name',
datasource_type: 'Datasource types',
datasource: 'Datasource instances',
datasource_instances: 'Datasource instances',
sql_type: 'SQL Type',
sql_type_query: 'Query',
sql_type_non_query: 'Non Query',
Expand All @@ -688,7 +688,64 @@ const project = {
start: 'Start',
edit: 'Edit',
copy: 'Copy',
delete: 'Delete'
delete: 'Delete',
custom_job: 'Custom Job',
custom_script: 'Custom Script',
sqoop_job_name: 'Job Name',
sqoop_job_name_tips: 'Please enter Job Name(required)',
direct: 'Direct',
hadoop_custom_params: 'Hadoop Params',
sqoop_advanced_parameters: 'Sqoop Advanced Parameters',
data_source: 'Data Source',
type: 'Type',
datasource: 'Datasource',
datasource_tips: 'Please select the datasource',
model_type: 'ModelType',
form: 'Form',
table: 'Table',
table_tips: 'Please enter Mysql Table(required)',
column_type: 'ColumnType',
all_columns: 'All Columns',
some_columns: 'Some Columns',
column: 'Column',
column_tips: 'Please enter Columns (Comma separated)',
database: 'Database',
database_tips: 'Please enter Hive Database(required)',
hive_table_tips: 'Please enter Hive Table(required)',
hive_partition_keys: 'Hive partition Keys',
hive_partition_keys_tips: 'Please enter Hive Partition Keys',
hive_partition_values: 'Hive partition Values',
hive_partition_values_tips: 'Please enter Hive Partition Values',
export_dir: 'Export Dir',
export_dir_tips: 'Please enter Export Dir(required)',
sql_statement_tips: 'SQL Statement(required)',
map_column_hive: 'Map Column Hive',
map_column_java: 'Map Column Java',
data_target: 'Data Target',
create_hive_table: 'CreateHiveTable',
drop_delimiter: 'DropDelimiter',
over_write_src: 'OverWriteSrc',
hive_target_dir: 'Hive Target Dir',
hive_target_dir_tips: 'Please enter hive target dir',
replace_delimiter: 'ReplaceDelimiter',
replace_delimiter_tips: 'Please enter Replace Delimiter',
target_dir: 'Target Dir',
target_dir_tips: 'Please enter Target Dir(required)',
delete_target_dir: 'DeleteTargetDir',
compression_codec: 'CompressionCodec',
file_type: 'FileType',
fields_terminated: 'FieldsTerminated',
fields_terminated_tips: 'Please enter Fields Terminated',
lines_terminated: 'LinesTerminated',
lines_terminated_tips: 'Please enter Lines Terminated',
is_update: 'IsUpdate',
update_key: 'UpdateKey',
update_key_tips: 'Please enter Update Key',
update_mode: 'UpdateMode',
only_update: 'OnlyUpdate',
allow_insert: 'AllowInsert',
concurrency: 'Concurrency',
concurrency_tips: 'Please enter Concurrency'
}
}

Expand Down
61 changes: 59 additions & 2 deletions dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ const project = {
target_task_name: '目标任务名',
target_task_name_tips: '请输入Pigeon任务名',
datasource_type: '数据源类型',
datasource: '数据源实例',
datasource_instances: '数据源实例',
sql_type: 'SQL类型',
sql_type_query: '查询',
sql_type_non_query: '非查询',
Expand All @@ -680,7 +680,64 @@ const project = {
start: '运行',
edit: '编辑',
copy: '复制节点',
delete: '删除'
delete: '删除',
custom_job: '自定义任务',
custom_script: '自定义脚本',
sqoop_job_name: '任务名称',
sqoop_job_name_tips: '请输入任务名称(必填)',
direct: '流向',
hadoop_custom_params: 'Hadoop参数',
sqoop_advanced_parameters: 'Sqoop参数',
data_source: '数据来源',
type: '类型',
datasource: '数据源',
datasource_tips: '请选择数据源',
model_type: '模式',
form: '表单',
table: '表名',
table_tips: '请输入Mysql表名(必填)',
column_type: '列类型',
all_columns: '全表导入',
some_columns: '选择列',
column: '列',
column_tips: '请输入列名,用 , 隔开',
database: '数据库',
database_tips: '请输入Hive数据库(必填)',
hive_table_tips: '请输入Hive表名(必填)',
hive_partition_keys: 'Hive 分区键',
hive_partition_keys_tips: '请输入分区键',
hive_partition_values: 'Hive 分区值',
hive_partition_values_tips: '请输入分区值',
export_dir: '数据源路径',
export_dir_tips: '请输入数据源路径(必填)',
sql_statement_tips: 'SQL语句(必填)',
map_column_hive: 'Hive类型映射',
map_column_java: 'Java类型映射',
data_target: '数据目的',
create_hive_table: '是否创建新表',
drop_delimiter: '是否删除分隔符',
over_write_src: '是否覆盖数据源',
hive_target_dir: 'Hive目标路径',
hive_target_dir_tips: '请输入Hive临时目录',
replace_delimiter: '替换分隔符',
replace_delimiter_tips: '请输入替换分隔符',
target_dir: '目标路径',
target_dir_tips: '请输入目标路径(必填)',
delete_target_dir: '是否删除目录',
compression_codec: '压缩类型',
file_type: '保存格式',
fields_terminated: '列分隔符',
fields_terminated_tips: '请输入列分隔符',
lines_terminated: '行分隔符',
lines_terminated_tips: '请输入行分隔符',
is_update: '是否更新',
update_key: '更新列',
update_key_tips: '请输入更新列',
update_mode: '更新类型',
only_update: '只更新',
allow_insert: '无更新便插入',
concurrency: '并发度',
concurrency_tips: '请输入并发度'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ export { useDatasourceType } from './use-datasource-type'
export { useDatasource } from './use-datasource'
export { useSqlType } from './use-sql-type'
export { useProcedure } from './use-procedure'
export { useCustomParams } from './use-custom-params'
export { useSourceType } from './use-sqoop-source-type'
export { useTargetType } from './use-sqoop-target-type'

export { useShell } from './use-shell'
export { useSpark } from './use-spark'
export { useMr } from './use-mr'
export { useFlink } from './use-flink'
export { useHttp } from './use-http'
export { useSql } from './use-sql'
export { useSqoop } from './use-sqoop'
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Ref } from 'vue'
import { useI18n } from 'vue-i18n'
import type { IJsonItem } from '../types'

export function useCustomParams({
model,
field,
isSimple,
name = 'custom_parameters',
span = 24
}: {
model: { [field: string]: any }
field: string
isSimple: boolean
name?: string
span?: Ref | number
}): IJsonItem[] {
const { t } = useI18n()

if (isSimple) {
return [
{
type: 'custom-parameters',
field: field,
name: t(`project.node.${name}`),
span,
children: [
{
type: 'input',
field: 'prop',
span: 10,
props: {
placeholder: t('project.node.prop_tips'),
maxLength: 256
},
validate: {
trigger: ['input', 'blur'],
required: true,
validator(validate: any, value: string) {
if (!value) {
return new Error(t('project.node.prop_tips'))
}

const sameItems = model.localParams.filter(
(item: { prop: string }) => item.prop === value
)

if (sameItems.length > 1) {
return new Error(t('project.node.prop_repeat'))
}
}
}
},
{
type: 'input',
field: 'value',
span: 10,
props: {
placeholder: t('project.node.value_tips'),
maxLength: 256
}
}
]
}
]
} else {
return [
{
type: 'custom-parameters',
field: field,
name: t(`project.node.${name}`),
span,
children: [
{
type: 'input',
field: 'prop',
span: 6,
props: {
placeholder: t('project.node.prop_tips'),
maxLength: 256
},
validate: {
trigger: ['input', 'blur'],
required: true,
validator(validate: any, value: string) {
if (!value) {
return new Error(t('project.node.prop_tips'))
}

const sameItems = model.localParams.filter(
(item: { prop: string }) => item.prop === value
)

if (sameItems.length > 1) {
return new Error(t('project.node.prop_repeat'))
}
}
}
},
{
type: 'select',
field: 'direct',
span: 4,
options: DIRECT_LIST,
value: 'IN'
},
{
type: 'select',
field: 'type',
span: 6,
options: TYPE_LIST,
value: 'VARCHAR'
},
{
type: 'input',
field: 'value',
span: 6,
props: {
placeholder: t('project.node.value_tips'),
maxLength: 256
}
}
]
}
]
}
}
export const TYPE_LIST = [
{
value: 'VARCHAR',
label: 'VARCHAR'
},
{
value: 'INTEGER',
label: 'INTEGER'
},
{
value: 'LONG',
label: 'LONG'
},
{
value: 'FLOAT',
label: 'FLOAT'
},
{
value: 'DOUBLE',
label: 'DOUBLE'
},
{
value: 'DATE',
label: 'DATE'
},
{
value: 'TIME',
label: 'TIME'
},
{
value: 'TIMESTAMP',
label: 'TIMESTAMP'
},
{
value: 'BOOLEAN',
label: 'BOOLEAN'
}
]

export const DIRECT_LIST = [
{
value: 'IN',
label: 'IN'
},
{
value: 'OUT',
label: 'OUT'
}
]
Loading