This is an automated email from the ASF dual-hosted git repository.

songjian pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel-web.git


The following commit(s) were added to refs/heads/main by this push:
     new f77b5b38 [Feat][UI] Complete the kill interface of task.
f77b5b38 is described below

commit f77b5b389371b9f3d284164b9678807a37f3a5b9
Author: songjianet <1778651...@qq.com>
AuthorDate: Wed Mar 1 20:53:21 2023 +0800

    [Feat][UI] Complete the kill interface of task.
    
    * [Feat][UI] Write part of the interface logic.
    
    * [Feat][UI] Write part of the interface logic.
    
    * [Feat][UI] Write part of the interface logic.
    
    * [Feat][UI] Complete the kill interface of task.
---
 seatunnel-ui/src/locales/en_US/tasks.ts        |  1 +
 seatunnel-ui/src/service/task/types.ts         |  1 +
 seatunnel-ui/src/views/tasks/list/use-table.ts | 36 +++++++++++++++++++-------
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/seatunnel-ui/src/locales/en_US/tasks.ts 
b/seatunnel-ui/src/locales/en_US/tasks.ts
index 8dccb408..e059b942 100644
--- a/seatunnel-ui/src/locales/en_US/tasks.ts
+++ b/seatunnel-ui/src/locales/en_US/tasks.ts
@@ -36,5 +36,6 @@ export default {
   last_total_records: 'Last Total Records',
   rerun: 'Rerun',
   kill: 'Kill',
+  operation: 'Operation',
   view_log: 'View Log'
 }
diff --git a/seatunnel-ui/src/service/task/types.ts 
b/seatunnel-ui/src/service/task/types.ts
index 29c4104b..96267794 100644
--- a/seatunnel-ui/src/service/task/types.ts
+++ b/seatunnel-ui/src/service/task/types.ts
@@ -47,6 +47,7 @@ interface JobDetail {
   publish: boolean
   updateTime: string
   status?: string
+  instanceId?: number
 }
 
 export { TaskList, TaskJobList, TaskRecycle, TaskExecute, JobDetail }
diff --git a/seatunnel-ui/src/views/tasks/list/use-table.ts 
b/seatunnel-ui/src/views/tasks/list/use-table.ts
index 7b9f5a56..d033ec47 100644
--- a/seatunnel-ui/src/views/tasks/list/use-table.ts
+++ b/seatunnel-ui/src/views/tasks/list/use-table.ts
@@ -18,7 +18,7 @@
 import { useI18n } from 'vue-i18n'
 import { h, reactive, ref } from 'vue'
 import { NButton, NSpace, NTag } from 'naive-ui'
-import { taskInstanceList } from '@/service/task'
+import { taskInstanceList, taskInstanceKill } from '@/service/task'
 import type { ResponseTable } from '@/service/types'
 import type { JobDetail } from '@/service/task/types'
 
@@ -76,14 +76,23 @@ export function useTable() {
         render: (row: JobDetail) =>
           h(NSpace, null, {
             default: () => [
-              h(NButton, {
-                text: true,
-                disabled: row.status === 'RUNNING'
-              }, t('tasks.rerun')),
-              h(NButton, {
-                text: true,
-                disabled: row.status !== 'RUNNING'
-              }, t('tasks.kill')),
+              h(
+                NButton,
+                {
+                  text: true,
+                  disabled: row.status === 'RUNNING'
+                },
+                t('tasks.rerun')
+              ),
+              h(
+                NButton,
+                {
+                  text: true,
+                  disabled: row.status !== 'RUNNING',
+                  onClick: () => handleKill(row)
+                },
+                t('tasks.kill')
+              ),
               h(NButton, { text: true }, t('tasks.view_log'))
             ]
           })
@@ -105,6 +114,15 @@ export function useTable() {
     })
   }
 
+  const handleKill = (row: JobDetail) => {
+    taskInstanceKill(row.instanceId as number).then(() => {
+      getTableData({
+        pageSize: state.pageSize,
+        pageNo: state.pageNo
+      })
+    })
+  }
+
   return {
     state,
     createColumns,

Reply via email to