Skip to content

Commit

Permalink
Merge branch 'apache:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
fanxishu authored Jan 12, 2025
2 parents 8da87cc + f07fe97 commit 4ee2810
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ public List<JobMetrics> getMetricsByJobEngineId(@NonNull String jobEngineId) {
return new ArrayList<>();
}

JsonNode jsonNode =
JsonUtils.stringToJsonNode(seaTunnelEngineProxy.getMetricsContent(jobEngineId));
JsonNode jsonNode = JsonUtils.stringToJsonNode(metricsContent);
LinkedHashMap<Integer, JobMetrics> metricsMap =
extractMetrics(jobPipelineStatus, jsonNode);
return Arrays.asList(metricsMap.values().toArray(new JobMetrics[0]));
Expand Down
4 changes: 3 additions & 1 deletion seatunnel-ui/src/locales/en_US/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 3 additions & 1 deletion seatunnel-ui/src/locales/zh_CN/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 = [
{
Expand Down Expand Up @@ -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)
},
{
Expand All @@ -113,8 +120,7 @@ export function useTable() {
popTips: t('security.token.delete_confirm')
}
]
},

}
)
]
}
Expand All @@ -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)
})
}

Expand Down

0 comments on commit 4ee2810

Please sign in to comment.