From 009b5024cb08569bcd2f01e3dfa1c9f2a826b7d3 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 15 Oct 2024 10:34:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E6=BA=90):=20=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/en.ts | 32 ++++- core/core-frontend/src/locales/zh-CN.ts | 30 ++++- .../visualized/data/datasource/FinishPage.vue | 24 ++-- .../visualized/data/datasource/index.vue | 115 ++++++++++-------- 4 files changed, 136 insertions(+), 65 deletions(-) diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 7aa4b1f495..bac843f1cd 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -190,10 +190,38 @@ export default { cannot_be_empty_de_ruler: 'Rule condition cannot be empty' }, data_source: { + successfully_created: 'Successfully created', + continue_to_create: 'Continue to create', + data_source_list: 'Return to the data source list', + prompts_next_time: 'No more prompts next time', + also_want_to: 'You may also want to', + or_large_screen: 'Prepare for the next dashboard or large screen', + go_to_create: 'Go to create', + verification_successful: 'Verification successful', + verification_failed: 'Verification failed', + create_successfully: 'Create successfully', + by_creation_time: 'In ascending order by creation time', + by_creation_time_de: 'In descending order by creation time', + order_by_name: 'In ascending order by name', + order_by_name_de: 'In descending order by name', + operate_with_caution: + 'After deletion, all resources under this folder will be deleted, please operate with caution.', + confirm_to_delete: + 'A dataset is using this data source. After deletion, the dataset is unavailable. Confirm to delete?', + view_blood_relationship: 'View blood relationship', + no_data_source: 'No data source', + replace_data: 'Replace data', + append_data: 'Append data', + latest_update_status: 'Latest update status', + latest_update_time: 'Latest update time', + data_time: 'Data time:', + update_all: 'Update all', + on_the_left: 'Please select a data source on the left', + update_result: 'Update result', + failure_details: 'Failure details', the_request_address: 'Please enter the request address', name_already_exists: 'A parameter with the same name already exists:', name_already_exists_de: 'A parameter table with the same name already exists', - verification_failed: 'Verification failed', interface_parameters: 'Interface parameters', extract_parameters: 'Extract parameters', view_data_structure: 'View data structure', @@ -257,8 +285,6 @@ export default { the_previous_step: 'The filled in information will be cleared. Are you sure you want to return to the previous step?', add_data_table: 'Need to add data table', - replace_data: 'Replace data', - append_data: 'append data', copy_data_source: 'Copy data source', create_data_source: 'Create data source', want_to_exit: 'The current changes have not been saved. Are you sure you want to exit?', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index fad8602543..a27b6822e0 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -207,6 +207,33 @@ export default { cannot_be_empty_de_ruler: '规则条件不能为空' }, data_source: { + successfully_created: '创建成功', + continue_to_create: '继续创建', + data_source_list: '返回数据源列表', + prompts_next_time: '下次不再提示', + also_want_to: '您可能还想', + or_large_screen: '为下一步的仪表板或大屏做准备', + go_to_create: '去创建', + verification_successful: '校验成功', + verification_failed: '校验失败', + create_successfully: '新建成功', + by_creation_time: '按创建时间升序', + by_creation_time_de: '按创建时间降序', + order_by_name: '按照名称升序', + order_by_name_de: '按照名称降序', + operate_with_caution: '删除后,此文件夹下的所有资源都会被删除,请谨慎操作。', + confirm_to_delete: '有数据集正在使用此数据源,删除后数据集不可用,确认删除?', + view_blood_relationship: '查看血缘关系', + no_data_source: '暂无数据源', + replace_data: '替换数据', + append_data: '追加数据', + latest_update_status: '最近更新状态', + latest_update_time: '最近更新时间', + data_time: '数据时间:', + update_all: '全部更新', + on_the_left: '请在左侧选择数据源', + update_result: '更新结果', + failure_details: '失败详情', the_request_address: '请输入请求地址', name_already_exists: '已经存在同名参数:', name_already_exists_de: '已经存在同名的参数表', @@ -269,10 +296,7 @@ export default { cannot_be_empty_table: '数据表不能为空', the_previous_step: '填写的信息将会清空,确定返回上一步吗?', add_data_table: '需要添加数据表', - verification_failed: '校验失败', source_saved_successfully: '保存数据源成功', - replace_data: '替换数据', - append_data: '追加数据', copy_data_source: '复制数据源', create_data_source: '创建数据源', want_to_exit: '当前的更改尚未保存,确定退出吗?', diff --git a/core/core-frontend/src/views/visualized/data/datasource/FinishPage.vue b/core/core-frontend/src/views/visualized/data/datasource/FinishPage.vue index 8601de4930..3cd3335818 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/FinishPage.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/FinishPage.vue @@ -5,12 +5,14 @@ import { ref } from 'vue' import { propTypes } from '@/utils/propTypes' import { useCache } from '@/hooks/web/useCache' import { setShowFinishPage } from '@/api/datasource' +import { useI18n } from '@/hooks/web/useI18n' defineProps({ name: propTypes.string.def(''), disabled: propTypes.bool.def(false) }) +const { t } = useI18n() const { wsCache } = useCache() const emits = defineEmits(['createDataset', 'backToDatasourceList', 'continueCreating']) const checked = ref(false) @@ -39,27 +41,35 @@ const handleChange = (val: boolean) => { -
创建成功
+
{{ t('data_source.successfully_created') }}
- 继续创建 - 返回数据源列表 + + {{ t('data_source.continue_to_create') }} + + + {{ t('data_source.data_source_list') }} +
- +
-
您可能还想
+
{{ t('data_source.also_want_to') }}

{{ $t('auth.dataset') }}

-

为下一步的仪表板或大屏做准备

+

{{ t('data_source.or_large_screen') }}

- 去创建 + {{ t('data_source.go_to_create') }}
diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue index 5dc1c45adf..cd18f472f0 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue @@ -148,17 +148,17 @@ const datasourceEditor = ref() const activeTab = ref('') const menuList = [ { - label: '移动到', + label: t('data_set.move_to'), svgName: icon_intoItem_outlined, command: 'move' }, { - label: '重命名', + label: t('data_set.rename'), svgName: icon_rename_outlined, command: 'rename' }, { - label: '删除', + label: t('common.delete'), divided: true, svgName: icon_deleteTrash_outlined, command: 'delete' @@ -173,12 +173,12 @@ const typeMap = dsTypes.reduce((pre, next) => { const datasetTypeList = computed(() => { return [ { - label: '新建数据源', + label: t('datasource.create'), svgName: icon_dataset, command: 'datasource' }, { - label: '新建文件夹', + label: t('deDataset.new_folder'), divided: true, svgName: dvFolder, command: 'folder' @@ -285,12 +285,12 @@ const validateDS = () => { } } if (error === 0) { - ElMessage.success('校验成功') + ElMessage.success(t('data_source.verification_successful')) } else { - ElMessage.error('校验失败') + ElMessage.error(t('data_source.verification_failed')) } } else { - ElMessage.success('校验成功') + ElMessage.success(t('data_source.verification_successful')) } }) } @@ -321,7 +321,9 @@ const formatSimpleCron = (info?: SyncSetting) => { case 'SIMPLE_CRON': const type = t(`common.${simpleCronType}`) strArr.push( - `${t('dataset.simple_cron')}: ${t('common.every')}${simpleCronValue}${type}更新一次` + `${t('dataset.simple_cron')}: ${t('common.every')}${simpleCronValue}${type}${t( + 'data_source.update_once' + )}` ) strArr.push(`${t('dataset.start_time')}: ${start}`) strArr.push(`${t('dataset.end_time')}: ${end}`) @@ -413,21 +415,21 @@ const infoList = computed(() => { }) const saveDsFolder = (params, successCb, finallyCb, cmd) => { let method = move - let message = '移动成功' + let message = t('data_set.moved_successfully') switch (cmd) { case 'move': method = move - message = '移动成功' + message = t('data_set.moved_successfully') break case 'rename': method = reName - message = '重命名成功' + message = t('data_set.rename_successful') break default: method = createFolder - message = '新建成功' + message = t('data_source.create_successfully') break } method(params) @@ -496,20 +498,20 @@ const dfsDatasourceTree = (ds, id) => { const creatDsFolder = ref() const sortList = [ { - name: '按创建时间升序', + name: t('data_source.by_creation_time'), value: 'time_asc' }, { - name: '按创建时间降序', + name: t('data_source.by_creation_time_de'), value: 'time_desc', divided: true }, { - name: '按照名称升序', + name: t('data_source.order_by_name'), value: 'name_asc' }, { - name: '按照名称降序', + name: t('data_source.order_by_name_de'), value: 'name_desc' } ] @@ -755,7 +757,7 @@ const handleCopy = async data => { lastSyncTime }) datasource.id = '' - datasource.name = '复制数据源' + datasource.name = t('datasource.copy') if (datasource.type === 'API') { for (let i = 0; i < datasource.apiConfiguration.length; i++) { datasource.apiConfiguration[i].deTableName = '' @@ -790,7 +792,7 @@ const operation = (cmd: string, data: Tree, nodeType: string) => { showClose: false } if (!!data.children?.length) { - options.tip = '删除后,此文件夹下的所有资源都会被删除,请谨慎操作。' + options.tip = t('data_source.operate_with_caution') } else { delete options.tip } @@ -810,16 +812,16 @@ const operation = (cmd: string, data: Tree, nodeType: string) => { confirmButtonType: 'danger', type: 'warning', autofocus: false, - confirmButtonText: '确定', + confirmButtonText: t('common.sure'), showClose: false, dangerouslyUseHTMLString: true, message: h('div', null, [ - h('p', { style: 'margin-bottom: 8px;' }, '确定删除该数据源吗?'), - h('p', { class: 'tip' }, '有数据集正在使用此数据源,删除后数据集不可用,确认删除?'), + h('p', { style: 'margin-bottom: 8px;' }, t('datasource.this_data_source')), + h('p', { class: 'tip' }, t('data_source.confirm_to_delete')), h( ElButton, { text: true, onClick: onClick, style: 'margin-left: -4px;' }, - '查看血缘关系' + t('data_source.view_blood_relationship') ) ]) }).then(() => { @@ -847,15 +849,17 @@ const operation = (cmd: string, data: Tree, nodeType: string) => { } }) } else { - ElMessageBox.confirm('确定删除该文件夹吗', options as ElMessageBoxOptions).then(() => { - deleteById(data.id as number).then(() => { - if (data.id === nodeInfo.id) { - Object.assign(nodeInfo, cloneDeep(defaultInfo)) - } - listDs() - ElMessage.success(t('dataset.delete_success')) - }) - }) + ElMessageBox.confirm(t('data_set.delete_this_folder'), options as ElMessageBoxOptions).then( + () => { + deleteById(data.id as number).then(() => { + if (data.id === nodeInfo.id) { + Object.assign(nodeInfo, cloneDeep(defaultInfo)) + } + listDs() + ElMessage.success(t('dataset.delete_success')) + }) + } + ) } } else { creatDsFolder.value.createInit(nodeType, data, cmd) @@ -997,7 +1001,7 @@ const getMenuList = (val: boolean) => {
{{ t('datasource.datasource') }}
- + { }" > - 替换数据 + {{ t('data_source.replace_data') }} @@ -1221,7 +1225,7 @@ const getMenuList = (val: boolean) => { > - 追加数据 + {{ t('data_source.append_data') }} @@ -1230,7 +1234,7 @@ const getMenuList = (val: boolean) => { - 编辑 + {{ t('chart.edit') }}
@@ -1277,7 +1281,7 @@ const getMenuList = (val: boolean) => { key="status" prop="status" v-if="['api'].includes(nodeInfo.type.toLowerCase())" - label="最近更新状态" + :label="t('data_source.latest_update_status')" >