You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by di...@apache.org on 2023/03/03 09:07:46 UTC
[incubator-seatunnel-web] branch main updated: [Feat][UI] Add to execute and rerun interfaces. (#37)
This is an automated email from the ASF dual-hosted git repository.
dijiekstra 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 cf5248c1 [Feat][UI] Add to execute and rerun interfaces. (#37)
cf5248c1 is described below
commit cf5248c1791c25b0966e22f29961aa338d43823a
Author: songjianet <17...@qq.com>
AuthorDate: Fri Mar 3 17:07:41 2023 +0800
[Feat][UI] Add to execute and rerun interfaces. (#37)
---
seatunnel-ui/src/service/task/index.ts | 4 +--
seatunnel-ui/src/service/task/types.ts | 1 +
seatunnel-ui/src/views/data-pipes/create/index.tsx | 9 -------
seatunnel-ui/src/views/data-pipes/detail/index.tsx | 19 --------------
seatunnel-ui/src/views/data-pipes/edit/index.tsx | 4 ++-
.../data-pipes/list/components/publish-modal.tsx | 4 ++-
seatunnel-ui/src/views/data-pipes/list/index.tsx | 7 ++----
.../src/views/data-pipes/list/use-table.ts | 29 ++++++++++++++++++++--
seatunnel-ui/src/views/jobs/list/use-table.ts | 3 ++-
seatunnel-ui/src/views/tasks/list/use-table.ts | 17 +++++++++++--
10 files changed, 55 insertions(+), 42 deletions(-)
diff --git a/seatunnel-ui/src/service/task/index.ts b/seatunnel-ui/src/service/task/index.ts
index 5efd7aab..2955cefc 100644
--- a/seatunnel-ui/src/service/task/index.ts
+++ b/seatunnel-ui/src/service/task/index.ts
@@ -34,9 +34,9 @@ export function taskJobList(params: TaskList): any {
})
}
-export function taskExecute(scriptId: number, data: TaskExecute): any {
+export function taskExecute(id: number, data: TaskExecute): any {
return axios({
- url: `/task/${scriptId}/execute`,
+ url: `/task/${id}/execute`,
method: 'post',
data
})
diff --git a/seatunnel-ui/src/service/task/types.ts b/seatunnel-ui/src/service/task/types.ts
index 96267794..daa86ab7 100644
--- a/seatunnel-ui/src/service/task/types.ts
+++ b/seatunnel-ui/src/service/task/types.ts
@@ -34,6 +34,7 @@ interface TaskRecycle {
interface TaskExecute {
objectType: number
+ executeType: number
}
interface JobDetail {
diff --git a/seatunnel-ui/src/views/data-pipes/create/index.tsx b/seatunnel-ui/src/views/data-pipes/create/index.tsx
index ff2c242b..de3a9061 100644
--- a/seatunnel-ui/src/views/data-pipes/create/index.tsx
+++ b/seatunnel-ui/src/views/data-pipes/create/index.tsx
@@ -127,15 +127,6 @@ const DataPipesCreate = defineComponent({
<NCard>
<NSpace vertical>
<NSpace justify='end'>
- <NButton secondary type='success'>
- {this.t('data_pipes.execute')}
- </NButton>
- <NButton secondary type='error'>
- {this.t('data_pipes.kill')}
- </NButton>
- <NButton secondary type='warning'>
- {this.t('data_pipes.stop')}
- </NButton>
<NDropdown
trigger='click'
options={[
diff --git a/seatunnel-ui/src/views/data-pipes/detail/index.tsx b/seatunnel-ui/src/views/data-pipes/detail/index.tsx
index daae6e9e..cf01bb73 100644
--- a/seatunnel-ui/src/views/data-pipes/detail/index.tsx
+++ b/seatunnel-ui/src/views/data-pipes/detail/index.tsx
@@ -19,7 +19,6 @@ import { defineComponent } from 'vue'
import {
NSpace,
NCard,
- NButton,
NBreadcrumb,
NBreadcrumbItem,
NTabs,
@@ -55,24 +54,6 @@ const DataPipesDetail = defineComponent({
</NBreadcrumbItem>
<NBreadcrumbItem>user-order-tables-10</NBreadcrumbItem>
</NBreadcrumb>
- <div
- class={['w-3', 'h-3', 'rounded-full', 'bg-green-400']}
- ></div>
- <span
- style={{
- fontSize: 'var(--n-font-size)',
- color: 'var(--n-item-text-color-active)'
- }}
- >
- {this.t('data_pipes.stop')}
- </span>
- </NSpace>
- ),
- 'header-extra': () => (
- <NSpace>
- <NButton secondary type='success'>{this.t('data_pipes.execute')}</NButton>
- <NButton secondary type='error'>{this.t('data_pipes.kill')}</NButton>
- <NButton secondary type='warning'>{this.t('data_pipes.stop')}</NButton>
</NSpace>
)
}}
diff --git a/seatunnel-ui/src/views/data-pipes/edit/index.tsx b/seatunnel-ui/src/views/data-pipes/edit/index.tsx
index 28f33bb0..d5f9111f 100644
--- a/seatunnel-ui/src/views/data-pipes/edit/index.tsx
+++ b/seatunnel-ui/src/views/data-pipes/edit/index.tsx
@@ -61,7 +61,9 @@ const DataPipesEdit = defineComponent({
'header-extra': () => (
<NSpace>
<NButton secondary>{this.t('data_pipes.cancel')}</NButton>
- <NButton secondary>{this.t('data_pipes.save')}</NButton>
+ <NButton secondary type='primary'>
+ {this.t('data_pipes.save')}
+ </NButton>
</NSpace>
)
}}
diff --git a/seatunnel-ui/src/views/data-pipes/list/components/publish-modal.tsx b/seatunnel-ui/src/views/data-pipes/list/components/publish-modal.tsx
index abfce10c..b4eddeb6 100644
--- a/seatunnel-ui/src/views/data-pipes/list/components/publish-modal.tsx
+++ b/seatunnel-ui/src/views/data-pipes/list/components/publish-modal.tsx
@@ -41,7 +41,9 @@ const PublishModal = defineComponent({
ctx.emit('cancelModal', props.showModal)
}
- const handleConfirm = () => {}
+ const handleConfirm = () => {
+ ctx.emit('confirmModal')
+ }
return { t, handleCancel, handleConfirm }
},
diff --git a/seatunnel-ui/src/views/data-pipes/list/index.tsx b/seatunnel-ui/src/views/data-pipes/list/index.tsx
index c42492e5..53775995 100644
--- a/seatunnel-ui/src/views/data-pipes/list/index.tsx
+++ b/seatunnel-ui/src/views/data-pipes/list/index.tsx
@@ -32,7 +32,8 @@ const DataPipesList = defineComponent({
state,
createColumns,
getTableData,
- handleConfirmDeleteModal
+ handleConfirmDeleteModal,
+ handleConfirmPublishModal
} = useTable()
const requestData = () => {
@@ -50,10 +51,6 @@ const DataPipesList = defineComponent({
state.showPublishModal = false
}
- const handleConfirmPublishModal = () => {
- state.showPublishModal = false
- }
-
const handleCreate = () => {
router.push({ path: '/data-pipes/create' })
}
diff --git a/seatunnel-ui/src/views/data-pipes/list/use-table.ts b/seatunnel-ui/src/views/data-pipes/list/use-table.ts
index 8391553d..ae52e1ae 100644
--- a/seatunnel-ui/src/views/data-pipes/list/use-table.ts
+++ b/seatunnel-ui/src/views/data-pipes/list/use-table.ts
@@ -18,7 +18,8 @@
import { reactive, ref, h } from 'vue'
import { useI18n } from 'vue-i18n'
import { NSpace, NButton, NTag } from 'naive-ui'
-import { scriptList, scriptDelete } from '@/service/script'
+import { scriptList, scriptDelete, scriptPublish } from '@/service/script'
+import { taskExecute } from '@/service/task'
import { useRouter } from 'vue-router'
import { getTableColumn } from '@/common/table'
import type { ResponseTable } from '@/service/types'
@@ -91,7 +92,8 @@ export function useTable() {
NButton,
{
text: true,
- disabled: row.status !== 'published'
+ disabled: row.status !== 'published',
+ onClick: () => handleExecute(row)
},
t('data_pipes.execute')
),
@@ -151,6 +153,28 @@ export function useTable() {
state.row = row
}
+ const handleConfirmPublishModal = () => {
+ scriptPublish((state.row as ScriptDetail).id as number).then(() => {
+ state.showPublishModal = false
+ getTableData({
+ pageSize: state.pageSize,
+ pageNo: state.pageNo
+ })
+ })
+ }
+
+ const handleExecute = (row: ScriptDetail) => {
+ taskExecute(row.id, {
+ objectType: 0,
+ executeType: 0
+ }).then(() => {
+ getTableData({
+ pageSize: state.pageSize,
+ pageNo: state.pageNo
+ })
+ })
+ }
+
const getTableData = (params: any) => {
if (state.loading) return
state.loading = true
@@ -165,6 +189,7 @@ export function useTable() {
state,
createColumns,
handleConfirmDeleteModal,
+ handleConfirmPublishModal,
getTableData
}
}
diff --git a/seatunnel-ui/src/views/jobs/list/use-table.ts b/seatunnel-ui/src/views/jobs/list/use-table.ts
index 9bbc9bbd..72bfd456 100644
--- a/seatunnel-ui/src/views/jobs/list/use-table.ts
+++ b/seatunnel-ui/src/views/jobs/list/use-table.ts
@@ -98,7 +98,8 @@ export function useTable() {
const handleExecute = (id: number) => {
taskExecute(id, {
- objectType: 1
+ objectType: 1,
+ executeType: 0
}).then(() => {
getTableData({
pageSize: state.pageSize,
diff --git a/seatunnel-ui/src/views/tasks/list/use-table.ts b/seatunnel-ui/src/views/tasks/list/use-table.ts
index 127268bb..2f4decf4 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, taskInstanceKill } from '@/service/task'
+import { taskInstanceList, taskInstanceKill, taskExecute } from '@/service/task'
import { getTableColumn } from '@/common/table'
import type { ResponseTable } from '@/service/types'
import type { JobDetail } from '@/service/task/types'
@@ -87,7 +87,8 @@ export function useTable() {
NButton,
{
text: true,
- disabled: row.status === 'RUNNING'
+ disabled: row.status === 'RUNNING',
+ onClick: () => handleRerun(row)
},
t('tasks.rerun')
),
@@ -139,6 +140,18 @@ export function useTable() {
state.row = row
}
+ const handleRerun = (row: JobDetail) => {
+ taskExecute(row.instanceId as number, {
+ objectType: 2,
+ executeType: 3
+ }).then(() => {
+ getTableData({
+ pageSize: state.pageSize,
+ pageNo: state.pageNo
+ })
+ })
+ }
+
return {
state,
createColumns,