Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][scaleph-workspace-seatunnel] update seatunnel module and web #691

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@
import cn.sliew.scaleph.api.annotation.Logging;
import cn.sliew.scaleph.common.exception.ScalephException;
import cn.sliew.scaleph.dag.xflow.dnd.DndDTO;
import cn.sliew.scaleph.workspace.flink.cdc.service.FlinkCDCDagService;
import cn.sliew.scaleph.workspace.flink.cdc.service.FlinkCDCJobService;
import cn.sliew.scaleph.workspace.flink.cdc.service.dto.WsFlinkArtifactCDCDTO;
import cn.sliew.scaleph.workspace.flink.cdc.service.param.WsFlinkArtifactCDCAddParam;
import cn.sliew.scaleph.workspace.flink.cdc.service.param.WsFlinkArtifactCDCListParam;
import cn.sliew.scaleph.workspace.flink.cdc.service.param.WsFlinkArtifactCDCSelectListParam;
import cn.sliew.scaleph.workspace.flink.cdc.service.param.WsFlinkArtifactCDCUpdateParam;
import cn.sliew.scaleph.plugin.framework.exception.PluginException;
import cn.sliew.scaleph.system.model.ResponseVO;
import cn.sliew.scaleph.workspace.flink.cdc.service.FlinkCDCDagService;
import cn.sliew.scaleph.workspace.flink.cdc.service.WsArtifactFlinkCDCService;
import cn.sliew.scaleph.workspace.flink.cdc.service.dto.WsArtifactFlinkCDCDTO;
import cn.sliew.scaleph.workspace.flink.cdc.service.param.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand All @@ -42,77 +38,93 @@
import javax.validation.Valid;
import java.util.List;

@Tag(name = "Flink CDC")
@Tag(name = "Artifact管理-Flink-CDC")
@RestController
@RequestMapping(path = "/api/flink-cdc")
public class WsFlinkCDCController {
@RequestMapping(path = "/api/artifact/flink/cdc")
public class WsArtifactFlinkCDCController {

@Autowired
private FlinkCDCDagService flinkCDCDagService;
@Autowired
private FlinkCDCJobService flinkCDCJobService;

@Logging
@GetMapping("/dag/dnd")
@Operation(summary = "查询DAG节点元信息", description = "后端统一返回节点信息")
public ResponseEntity<ResponseVO<List<DndDTO>>> loadNodeMeta() throws PluginException {
List<DndDTO> dnds = flinkCDCDagService.getDnds();
return new ResponseEntity<>(ResponseVO.success(dnds), HttpStatus.OK);
}
private WsArtifactFlinkCDCService wsArtifactFlinkCDCService;

@Logging
@GetMapping
@Operation(summary = "查询 fink cdc 列表", description = "分页查询 fink cdc 列表")
public ResponseEntity<Page<WsFlinkArtifactCDCDTO>> listJob(@Valid WsFlinkArtifactCDCListParam param) {
Page<WsFlinkArtifactCDCDTO> page = flinkCDCJobService.listByPage(param);
public ResponseEntity<Page<WsArtifactFlinkCDCDTO>> list(@Valid WsArtifactFlinkCDCListParam param) {
Page<WsArtifactFlinkCDCDTO> page = wsArtifactFlinkCDCService.list(param);
return new ResponseEntity<>(page, HttpStatus.OK);
}

@Logging
@GetMapping("/history")
@Operation(summary = "根据 artifact 分页查询 fink cdc 列表", description = "根据 artifact 分页查询 fink cdc 列表")
public ResponseEntity<Page<WsArtifactFlinkCDCDTO>> listByArtifact(@Valid WsArtifactFlinkCDCArtifactParam param) {
Page<WsArtifactFlinkCDCDTO> result = wsArtifactFlinkCDCService.listByArtifact(param);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@GetMapping("/all")
@Operation(summary = "查询 fink cdc 列表", description = "查询 fink cdc 列表")
public ResponseEntity<List<WsFlinkArtifactCDCDTO>> listAll(@Valid WsFlinkArtifactCDCSelectListParam param) {
List<WsFlinkArtifactCDCDTO> result = flinkCDCJobService.listAll(param);
public ResponseEntity<List<WsArtifactFlinkCDCDTO>> listAll(@Valid WsArtifactFlinkCDCSelectListParam param) {
List<WsArtifactFlinkCDCDTO> result = wsArtifactFlinkCDCService.listAll(param);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@GetMapping("/{id}")
@Operation(summary = "查询 flink cdc 详情", description = "查询 flink cdc 详情")
public ResponseEntity<WsArtifactFlinkCDCDTO> selectOne(@PathVariable("id") Long id) {
WsArtifactFlinkCDCDTO result = wsArtifactFlinkCDCService.selectOne(id);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@PutMapping
@Operation(summary = "新增 fink cdc", description = "新增 fink cdc,不涉及 DAG")
public ResponseEntity<ResponseVO<WsFlinkArtifactCDCDTO>> simpleAddJob(@Validated @RequestBody WsFlinkArtifactCDCAddParam param) {
WsFlinkArtifactCDCDTO wsFlinkArtifactCDCDTO = flinkCDCJobService.insert(param);
public ResponseEntity<ResponseVO<WsArtifactFlinkCDCDTO>> insert(@Validated @RequestBody WsArtifactFlinkCDCAddParam param) {
WsArtifactFlinkCDCDTO wsFlinkArtifactCDCDTO = wsArtifactFlinkCDCService.insert(param);
return new ResponseEntity<>(ResponseVO.success(wsFlinkArtifactCDCDTO), HttpStatus.CREATED);
}

@Logging
@PostMapping
@Operation(summary = "修改 fink cdc", description = "只修改 fink cdc 属性,不涉及 DAG")
public ResponseEntity<ResponseVO> simpleEditJob(@Validated @RequestBody WsFlinkArtifactCDCUpdateParam param) {
flinkCDCJobService.update(param);
public ResponseEntity<ResponseVO> update(@Validated @RequestBody WsArtifactFlinkCDCUpdateParam param) {
wsArtifactFlinkCDCService.update(param);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@DeleteMapping("{id}")
@Operation(summary = "删除 fink cdc", description = "删除 fink cdc")
public ResponseEntity<ResponseVO> deleteJob(@PathVariable("id") Long id) throws ScalephException {
flinkCDCJobService.delete(id);
wsArtifactFlinkCDCService.delete(id);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@DeleteMapping("batch")
@Operation(summary = "批量删除 fink cdc", description = "批量删除 fink cdc")
public ResponseEntity<ResponseVO> deleteBatch(@RequestBody List<Long> ids) throws ScalephException {
flinkCDCJobService.deleteBatch(ids);
wsArtifactFlinkCDCService.deleteBatch(ids);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@DeleteMapping("all")
@Operation(summary = "批量删除 fink cdc", description = "批量删除 fink cdc")
public ResponseEntity<ResponseVO> deleteAll(@RequestParam("flinkArtifactId") Long flinkArtifactId) throws ScalephException {
flinkCDCJobService.deleteAll(flinkArtifactId);
@DeleteMapping("artifact/{artifactId}")
@Operation(summary = "删除 artifact", description = "删除 artifact")
public ResponseEntity<ResponseVO> deleteArtifact(@PathVariable("artifactId") Long artifactId) throws ScalephException {
wsArtifactFlinkCDCService.deleteArtifact(artifactId);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@GetMapping("/dag/dnd")
@Operation(summary = "查询DAG节点元信息", description = "后端统一返回节点信息")
public ResponseEntity<ResponseVO<List<DndDTO>>> loadNodeMeta() {
List<DndDTO> dnds = flinkCDCDagService.getDnds();
return new ResponseEntity<>(ResponseVO.success(dnds), HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@Tag(name = "Artifact管理-Flink-Jar")
@RestController
@RequestMapping(path = "/api/artifact/flink/jar")
public class WsArtifactJarController {
public class WsArtifactFlinkJarController {

@Autowired
private WsArtifactFlinkJarService wsArtifactFlinkJarService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Tag(name = "Artifact管理-Flink-Sql")
@RestController
@RequestMapping(path = "/api/artifact/flink/sql")
public class WsArtifactSqlController {
public class WsArtifactFlinkSqlController {

@Autowired
private WsArtifactFlinkSqlService wsArtifactFlinkSqlService;
Expand Down Expand Up @@ -108,8 +108,8 @@ public ResponseEntity<ResponseVO> delete(@PathVariable("id") Long id) {

@Logging
@DeleteMapping("/artifact/{artifactId}")
@Operation(summary = "删除所有 flink sql", description = "删除所有 flink sql")
public ResponseEntity<ResponseVO> deleteAll(@PathVariable("artifactId") Long artifactId) {
@Operation(summary = "删除 artifact", description = "删除 artifactl")
public ResponseEntity<ResponseVO> deleteArtifact(@PathVariable("artifactId") Long artifactId) {
wsArtifactFlinkSqlService.deleteArtifact(artifactId);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.scaleph.api.controller.ws;

import cn.sliew.scaleph.api.annotation.Logging;
import cn.sliew.scaleph.common.dict.seatunnel.SeaTunnelEngineType;
import cn.sliew.scaleph.dag.xflow.dnd.DndDTO;
import cn.sliew.scaleph.plugin.framework.exception.PluginException;
import cn.sliew.scaleph.system.model.ResponseVO;
import cn.sliew.scaleph.workspace.seatunnel.service.SeaTunnelDagService;
import cn.sliew.scaleph.workspace.seatunnel.service.WsArtifactSeaTunnelService;
import cn.sliew.scaleph.workspace.seatunnel.service.dto.WsArtifactSeaTunnelDTO;
import cn.sliew.scaleph.workspace.seatunnel.service.param.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Tag(name = "Artifact管理-SeaTunnel")
@RestController
@RequestMapping(path = "/api/artifact/seatunnel")
public class WsArtifactSeaTunnelController {

@Autowired
private WsArtifactSeaTunnelService wsArtifactSeaTunnelService;
@Autowired
private SeaTunnelDagService seaTunnelDagService;

@Logging
@GetMapping
@Operation(summary = "查询 seatunnel 列表", description = "查询 seatunnel 列表")
public ResponseEntity<Page<WsArtifactSeaTunnelDTO>> list(@Valid WsArtifactSeaTunnelListParam param) {
Page<WsArtifactSeaTunnelDTO> result = wsArtifactSeaTunnelService.list(param);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@GetMapping("/history")
@Operation(summary = "根据 artifact 分页查询 seatunnel 列表", description = "根据 artifact 分页查询 seatunnel 列表")
public ResponseEntity<Page<WsArtifactSeaTunnelDTO>> listByArtifact(@Valid WsArtifactSeaTunnelArtifactParam param) {
Page<WsArtifactSeaTunnelDTO> result = wsArtifactSeaTunnelService.listByArtifact(param);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@GetMapping("/all")
@Operation(summary = "查询 seatunnel 列表", description = "查询 seatunnel 列表")
public ResponseEntity<List<WsArtifactSeaTunnelDTO>> listAll(@Valid WsArtifactSeaTunnelSelectListParam param) {
List<WsArtifactSeaTunnelDTO> result = wsArtifactSeaTunnelService.listAll(param);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@GetMapping("/{id}")
@Operation(summary = "查询 seatunnel 详情", description = "查询 seatunnel 详情")
public ResponseEntity<WsArtifactSeaTunnelDTO> selectOne(@PathVariable("id") Long id) {
WsArtifactSeaTunnelDTO result = wsArtifactSeaTunnelService.selectOne(id);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@Logging
@PutMapping
@Operation(summary = "新增 seatunnel", description = "新增 seatunnel")
public ResponseEntity<ResponseVO<WsArtifactSeaTunnelDTO>> insert(@RequestBody @Valid WsArtifactSeaTunnelAddParam param) {
WsArtifactSeaTunnelDTO dto = wsArtifactSeaTunnelService.insert(param);
return new ResponseEntity<>(ResponseVO.success(dto), HttpStatus.OK);
}

@Logging
@PostMapping
@Operation(summary = "修改 seatunnel", description = "修改 seatunnel")
public ResponseEntity<ResponseVO> update(@RequestBody @Valid WsArtifactSeaTunnelUpdateParam param) {
wsArtifactSeaTunnelService.update(param);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@PostMapping("graph")
@Operation(summary = "修改 seatunnel graph", description = "修改 seatunnel graph")
public ResponseEntity<ResponseVO> updateGraph(@RequestBody @Valid WsArtifactSeaTunnelGraphParam param) {
wsArtifactSeaTunnelService.updateGraph(param);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@DeleteMapping("/{id}")
@Operation(summary = "删除 seatunnel", description = "删除 seatunnel")
public ResponseEntity<ResponseVO> delete(@PathVariable("id") Long id) {
wsArtifactSeaTunnelService.delete(id);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@DeleteMapping("/artifact/{artifactId}")
@Operation(summary = "删除 artifact", description = "删除 artifactl")
public ResponseEntity<ResponseVO> deleteArtifact(@PathVariable("artifactId") Long artifactId) {
wsArtifactSeaTunnelService.deleteArtifact(artifactId);
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK);
}

@Logging
@GetMapping("/dag/dnd/{type}")
@Operation(summary = "查询DAG节点元信息", description = "后端统一返回节点信息")
public ResponseEntity<ResponseVO<List<DndDTO>>> loadNodeMeta(@PathVariable("type") SeaTunnelEngineType type) throws PluginException {
List<DndDTO> dnds = seaTunnelDagService.getDnds(type);
return new ResponseEntity<>(ResponseVO.success(dnds), HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
package cn.sliew.scaleph.api.controller.ws;

import cn.sliew.scaleph.api.annotation.Logging;
import cn.sliew.scaleph.common.dict.seatunnel.SeaTunnelEngineType;
import cn.sliew.scaleph.common.exception.ScalephException;
import cn.sliew.scaleph.system.model.ResponseVO;
import cn.sliew.scaleph.workspace.seatunnel.service.SeatunnelJobService;
import cn.sliew.scaleph.workspace.seatunnel.service.WsDiJobService;
import cn.sliew.scaleph.workspace.seatunnel.service.dto.DagPanelDTO;
import cn.sliew.scaleph.workspace.seatunnel.service.dto.WsDiJobDTO;
import cn.sliew.scaleph.workspace.seatunnel.service.param.*;
import cn.sliew.scaleph.workspace.seatunnel.service.vo.DiJobAttrVO;
import cn.sliew.scaleph.plugin.framework.exception.PluginException;
import cn.sliew.scaleph.system.model.ResponseVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down Expand Up @@ -159,13 +156,4 @@ public ResponseEntity<ResponseVO> previewJob(@PathVariable("id") Long id) throws
String conf = seatunnelJobService.preview(id);
return new ResponseEntity<>(ResponseVO.success(conf), HttpStatus.OK);
}

@Logging
@GetMapping("/node/meta/{type}")
@Operation(summary = "查询DAG节点元信息", description = "后端统一返回节点信息")
@PreAuthorize("@svs.validate(T(cn.sliew.scaleph.common.constant.PrivilegeConstants).DATADEV_JOB_SELECT)")
public ResponseEntity<List<DagPanelDTO>> loadNodeMeta(@PathVariable("type") SeaTunnelEngineType type) throws PluginException {
List<DagPanelDTO> list = seatunnelJobService.loadDndPanelInfo(type);
return new ResponseEntity<>(list, HttpStatus.OK);
}
}

This file was deleted.

Loading
Loading