diff --git a/seatunnel-ui/src/locales/en_US/project.ts b/seatunnel-ui/src/locales/en_US/project.ts index 77a1ec808..b6bc46a67 100644 --- a/seatunnel-ui/src/locales/en_US/project.ts +++ b/seatunnel-ui/src/locales/en_US/project.ts @@ -1098,7 +1098,9 @@ export default { sql_content_label: 'SQL', sql_content_label_placeholder: 'please input the SQL statement', query_validate: 'please input the SQL statement', - target_name_tips: 'Please enter or select table name' + target_name_tips: 'Please enter or select table name', + start_success: 'Start success', + start_failed: 'Start failed' }, synchronization_instance: { pipeline_id: 'Pipeline Id', diff --git a/seatunnel-ui/src/locales/zh_CN/project.ts b/seatunnel-ui/src/locales/zh_CN/project.ts index 774b6187e..3e059f188 100644 --- a/seatunnel-ui/src/locales/zh_CN/project.ts +++ b/seatunnel-ui/src/locales/zh_CN/project.ts @@ -1066,7 +1066,9 @@ export default { sql_content_label: 'SQL', sql_content_label_placeholder: '请输入SQL语句', query_validate: '请输入SQL语句', - target_name_tips: '请输入或选择表名(必填)' + target_name_tips: '请输入或选择表名(必填)', + start_success: '启动成功', + start_failed: '启动失败' }, synchronization_instance: { pipeline_id: 'Pipeline ID', diff --git a/seatunnel-ui/src/views/task/synchronization-definition/use-table.ts b/seatunnel-ui/src/views/task/synchronization-definition/use-table.ts index 0d5da95f1..2c17209d1 100644 --- a/seatunnel-ui/src/views/task/synchronization-definition/use-table.ts +++ b/seatunnel-ui/src/views/task/synchronization-definition/use-table.ts @@ -29,6 +29,7 @@ import type { Router } from 'vue-router' import type { JobType } from './dag/types' import { COLUMN_WIDTH_CONFIG } from '@/common/column-width-config' import { useTableLink } from '@/hooks' +import { useMessage } from 'naive-ui' export function useTable() { const { t } = useI18n() @@ -52,6 +53,10 @@ export function useTable() { DATA_INTEGRATION: 'data_integration' } as { [key in JobType]: string } + const message = useMessage() + + const loadingStates = ref(new Map()) + const createColumns = (variables: any) => { variables.columns = [ { @@ -100,10 +105,12 @@ export function useTable() { }, icon: h(EditOutlined) }, - { text: t('project.synchronization_definition.start'), - onClick: (row: any) => void handleRun(row), + onClick: (row: any) => { + if (loadingStates.value.get(row.id)) return + handleRun(row) + }, icon: h(PlayCircleOutlined) }, { @@ -113,8 +120,7 @@ export function useTable() { popTips: t('security.token.delete_confirm') } ] - }, - + } ) ] } @@ -135,12 +141,21 @@ export function useTable() { } const handleRun = (row: any) => { - executeJob(row.id).then(() => { - getTableData({ - pageSize: variables.pageSize, - pageNo: variables.page, - searchName: variables.searchName + // Prevent duplicate task submissions + loadingStates.value.set(row.id, true) + + executeJob(row.id).then((res: any) => { + message.success(t('project.synchronization_definition.start_success')) + router.push({ + path: `/task/synchronization-instance/${row.id}`, + query: { + jobInstanceId: res, + taskName: row.name + } }) + }).catch((error) => { + message.error(t('project.synchronization_definition.start_failed')) + loadingStates.value.set(row.id, false) }) }