Skip to content

Commit

Permalink
commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
s7monk committed Jul 11, 2024
1 parent 1d4e874 commit 1be86f3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 34 deletions.
1 change: 1 addition & 0 deletions paimon-web-ui/src/api/models/job/types/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface JobSubmitDTO {
}
statements: string
streaming: boolean
maxRows?: number
}

export interface JobResultData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ export default defineComponent({
],
})

const handleSelect = () => {
}

const handleFormat = () => {
emit('handleFormat')
}
Expand Down Expand Up @@ -203,50 +200,55 @@ export default defineComponent({
}
}

const processJobSubmission = async (currentTab: any, maxRows?: number) => {
if (!currentTab.content) {
isSubmitting.value = false
return
}

const jobDataDTO: JobSubmitDTO = {
jobName: currentTab.tableName,
fileName: currentTab.key,
taskType: debuggerVariables.conditionValue,
clusterId: debuggerVariables.conditionValue2,
statements: currentTab.content,
streaming: debuggerVariables.conditionValue3 === 'Streaming',
maxRows,
}

try {
const response = await submitJob(jobDataDTO)
if (response.code === 200) {
message.success(t('playground.job_submission_successfully'))
mittBus.emit('jobResult', response.data)
}
else {
isSubmitting.value = false
message.error(`${t('playground.job_submission_failed')}`)
}
}
catch (error) {
isSubmitting.value = false
console.error('Failed to submit job:', error)
}
}

const handleSubmit = async () => {
const currentTab = tabData.value.panelsList.find((item: any) => item.key === tabData.value.chooseTab)

if (!currentTab)
return

if (jobStatus.value === 'RUNNING') {
handleStopJob()
await handleStopJob()
}
else {
isSubmitting.value = true
if (jobStore.getJobDetails(currentKey.value))
if (jobStore.getJobDetails(currentKey.value)) {
jobStore.resetJob(currentKey.value)

const currentSQL = currentTab.content
if (!currentSQL) {
isSubmitting.value = false
return
}

const jobDataDTO: JobSubmitDTO = {
jobName: currentTab.tableName,
fileName: currentTab.key,
taskType: debuggerVariables.conditionValue,
clusterId: debuggerVariables.conditionValue2,
statements: currentSQL,
streaming: debuggerVariables.conditionValue3 === 'Streaming',
}

try {
const response = await submitJob(jobDataDTO)
if (response.code === 200) {
message.success(t('playground.job_submission_successfully'))
mittBus.emit('jobResult', response.data)
}
else {
isSubmitting.value = false
message.error(`${t('playground.job_submission_failed')}`)
}
}
catch (error) {
isSubmitting.value = false
console.error('Failed to submit job:', error)
}
await processJobSubmission(currentTab)
}
}

Expand All @@ -255,6 +257,25 @@ export default defineComponent({
isSubmitting.value = false
})

const handleSelect = async (maxRows: number) => {
const currentTab = tabData.value.panelsList.find((item: any) => item.key === tabData.value.chooseTab)

if (!currentTab)
return

if (jobStatus.value === 'RUNNING') {
await handleStopJob()
}
else {
isSubmitting.value = true
if (jobStore.getJobDetails(currentKey.value)) {
jobStore.resetJob(currentKey.value)
}

await processJobSubmission(currentTab, maxRows)
}
}

return {
t,
...toRefs(debuggerVariables),
Expand Down

0 comments on commit 1be86f3

Please sign in to comment.