Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Imporve] Support the display of Transforms description information #255

Merged
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
17 changes: 14 additions & 3 deletions seatunnel-ui/src/components/dynamic-form/dynamic-form-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const DynamicFormItem = defineComponent({
name: 'DynamicFormItem',
props,
setup(props) {
const { t } = useI18n()
const { t, te } = useI18n()

if (props.locales) {
useI18n().mergeLocaleMessage('zh_CN', {
Expand All @@ -70,8 +70,15 @@ const DynamicFormItem = defineComponent({
return value.map((v) => field === v).indexOf(false) < 0
}

const getTranslation = (name: string, label: string, suffix: string) => {
const key = `transforms.${name.toLowerCase()}.${label}_${suffix}`
return te(key) ? t(key) : ''
}

return {
t,
te,
getTranslation,
formatClass,
formItemDisabled
}
Expand All @@ -88,7 +95,7 @@ const DynamicFormItem = defineComponent({
)
: true) && (
<NFormItemGi
label={this.t(f.label)}
label={this.t(this.getTranslation(this.name, f.label, 'value') || this.t(f.label))}
path={f.field}
span={f.span || 24}
>
Expand All @@ -98,7 +105,11 @@ const DynamicFormItem = defineComponent({
this.name,
f.field
)}`}
placeholder={f.placeholder ? this.t(f.placeholder) : ''}
placeholder={
f.placeholder
? (this.getTranslation(this.name, f.label, 'placeholder') || this.t(f.placeholder))
: ''
}
v-model={[(this.model as any)[f.field], 'value']}
clearable={f.clearable}
type={f.inputType}
Expand Down
4 changes: 3 additions & 1 deletion seatunnel-ui/src/locales/en_US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import project from '@/locales/en_US/project'
import hook from '@/locales/en_US/hook'
import common from '@/locales/en_US/common'
import security from '@/locales/en_US/security'
import transforms from '@/locales/en_US/transforms'

export default {
security,
Expand All @@ -44,5 +45,6 @@ export default {
virtual_tables,
theme,
project,
hook
hook,
transforms
}
3 changes: 1 addition & 2 deletions seatunnel-ui/src/locales/en_US/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,10 +1095,9 @@ export default {
segmented_fields_placeholder: 'If two fields are separated, you can fill in field1, field2',
copy_field: 'Copy Field',
check_model: 'Please check the model information',
sql_content_label: 'sql',
sql_content_label: 'SQL',
sql_content_label_placeholder: 'please input the SQL statement',
query_validate: 'please input the SQL statement',

},
synchronization_instance: {
pipeline_id: 'Pipeline Id',
Expand Down
33 changes: 33 additions & 0 deletions seatunnel-ui/src/locales/en_US/transforms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

export default {
replace: {
replace_field_value: 'Replace Field',
replace_field_placeholder: 'Please enter the field to be replaced',
pattern_value: 'Pattern',
pattern_placeholder: 'Please enter the old string to be replaced',
replacement_value: 'Replacement',
replacement_placeholder: 'Please enter a new string for replacement',
is_regex_value: 'Is Regex'
},
jsonpath: {
columns_value: 'Columns',
columns_placeholder: 'Field array that needs to be parsed',
row_error_handle_way_value: 'Row Error Handle Way'
}
}
4 changes: 3 additions & 1 deletion seatunnel-ui/src/locales/zh_CN/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import project from '@/locales/zh_CN/project'
import hook from '@/locales/zh_CN/hook'
import common from '@/locales/zh_CN/common'
import security from '@/locales/zh_CN/security'
import transforms from '@/locales/zh_CN/transforms'

export default {
security,
Expand All @@ -44,5 +45,6 @@ export default {
virtual_tables,
theme,
project,
hook
hook,
transforms
}
6 changes: 3 additions & 3 deletions seatunnel-ui/src/locales/zh_CN/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,9 @@ export default {
segmented_fields_placeholder: '如分割出来两个字段,可以填写 field1, field2',
copy_field: '复制字段',
check_model: '请检查模型信息',
sql_content_label: 'sql',
sql_content_label_placeholder: '请输入sql语句',
query_validate: '请输入sql语句'
sql_content_label: 'SQL',
sql_content_label_placeholder: '请输入SQL语句',
query_validate: '请输入SQL语句'
},
synchronization_instance: {
pipeline_id: 'Pipeline ID',
Expand Down
33 changes: 33 additions & 0 deletions seatunnel-ui/src/locales/zh_CN/transforms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

export default {
replace: {
replace_field_value: '需要替换的字段',
replace_field_placeholder: '请输入要替换的字段',
pattern_value: '将被替换的旧字符串',
pattern_placeholder: '请输入要被替换的旧字符串',
replacement_value: '用于替换的新字符串',
replacement_placeholder: '请输入用于替换的新字符串',
is_regex_value: '是否使用正则匹配'
},
jsonpath: {
columns_value: '解析字段',
columns_placeholder: '需要解析的字段数组',
row_error_handle_way_value: '列发生错误时的处理方式'
}
}
Loading