You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by zh...@apache.org on 2022/09/17 04:10:50 UTC

[incubator-seatunnel] branch dev updated: [Feat][UI] Update script service in the project. (#2763)

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 46cf8393b [Feat][UI] Update script service in the project. (#2763)
46cf8393b is described below

commit 46cf8393b1577d58f2d82fb482525a8867117a6e
Author: songjianet <17...@qq.com>
AuthorDate: Sat Sep 17 12:10:45 2022 +0800

    [Feat][UI] Update script service in the project. (#2763)
---
 seatunnel-ui/src/service/script/index.ts | 70 ++++++++++++++------------------
 seatunnel-ui/src/service/script/types.ts | 26 ++----------
 2 files changed, 33 insertions(+), 63 deletions(-)

diff --git a/seatunnel-ui/src/service/script/index.ts b/seatunnel-ui/src/service/script/index.ts
index d9525f89f..a39d1ba5c 100644
--- a/seatunnel-ui/src/service/script/index.ts
+++ b/seatunnel-ui/src/service/script/index.ts
@@ -18,76 +18,66 @@
 import { axios } from '@/service/service'
 import type {
   ScriptList,
-  ScriptPublish,
-  ScriptAdd,
-  ScriptContentUpdate,
-  ScriptParamUpdate
+  ScriptAdd
 } from '@/service/script/types'
 
-export function scriptList(scriptListReq: ScriptList): any {
+export function scriptList(params: ScriptList): any {
   return axios({
-    url: '/script/list',
-    method: 'post',
-    data: { scriptListReq }
+    url: '/script',
+    method: 'get',
+    params
   })
 }
 
-export function scriptPublish(req: ScriptPublish): any {
+export function scriptAdd(data: ScriptAdd): any {
   return axios({
-    url: '/script/publish',
-    method: 'put',
-    data: { req }
+    url: '/script',
+    method: 'post',
+    data
   })
 }
 
-export function scriptDelete(id: number): any {
+export function scriptDelete(scriptId: number): any {
   return axios({
-    url: '/script/script',
-    method: 'delete',
-    data: { id }
+    url: `/script/${scriptId}`,
+    method: 'delete'
   })
 }
 
-export function scriptAdd(addEmptyScriptReq: ScriptAdd): any {
+export function scriptContent(scriptId: number): any {
   return axios({
-    url: '/script/script',
-    method: 'post',
-    data: { addEmptyScriptReq }
+    url: `/script/${scriptId}/content`,
+    method: 'get'
   })
 }
 
-export function scriptContent(id: number): any {
+export function scriptContentUpdate(scriptId: number, content: string): any {
   return axios({
-    url: '/script/scriptContent',
-    method: 'get',
-    data: { id }
+    url: `/script/${scriptId}/content`,
+    method: 'put',
+    data: {
+      content
+    }
   })
 }
 
-export function scriptContentUpdate(
-  updateScriptContentReq: ScriptContentUpdate
-): any {
+export function scriptParam(scriptId: number): any {
   return axios({
-    url: '/script/scriptContent',
-    method: 'put',
-    data: { updateScriptContentReq }
+    url: `/script/${scriptId}/param`,
+    method: 'get'
   })
 }
 
-export function scriptParam(id: number): any {
+export function scriptParamUpdate(scriptId: number): any {
   return axios({
-    url: '/script/scriptParam',
-    method: 'get',
-    data: { id }
+    url: `/script/${scriptId}/param`,
+    method: 'put'
   })
 }
 
-export function scriptParamUpdate(
-  updateScriptParamReq: ScriptParamUpdate
-): any {
+export function scriptPublish(scriptId: number): any {
   return axios({
-    url: '/script/scriptParam',
-    method: 'put',
-    data: { updateScriptParamReq }
+    url: `/script/${scriptId}/publish`,
+    method: 'patch'
   })
 }
diff --git a/seatunnel-ui/src/service/script/types.ts b/seatunnel-ui/src/service/script/types.ts
index 985563e72..dca0cd3ab 100644
--- a/seatunnel-ui/src/service/script/types.ts
+++ b/seatunnel-ui/src/service/script/types.ts
@@ -16,38 +16,18 @@
  */
 
 interface ScriptList {
-  name: string
+  name?: string
   pageNo: number
   pageSize: number
-  status: string
-}
-
-interface ScriptPublish {
-  operatorId: number
-  scriptId: number
+  status?: string
 }
 
 interface ScriptAdd {
-  creatorId: number
   name: string
   type: string
 }
 
-interface ScriptContentUpdate {
-  content: string
-  id: number
-  menderId: number
-}
-
-interface ScriptParamUpdate {
-  params: object
-  scriptId: number
-}
-
 export {
   ScriptList,
-  ScriptPublish,
-  ScriptAdd,
-  ScriptContentUpdate,
-  ScriptParamUpdate
+  ScriptAdd
 }