Unverified Commit 13ef7bac authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Refactor] Refactor datastudio contextmenu (#2211)

* refactor datastudio contextmenu * Spotless Apply * fix copy bug * refactor cut job and paste job * Spotless Apply * refactor datastudio contextmenu * Spotless Apply * mkdify packagejson --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent b6a541b4
...@@ -31,11 +31,13 @@ import org.dinky.service.CatalogueService; ...@@ -31,11 +31,13 @@ import org.dinky.service.CatalogueService;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -102,22 +104,29 @@ public class CatalogueController { ...@@ -102,22 +104,29 @@ public class CatalogueController {
@Log(title = "Insert Or Update Catalogue", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Insert Or Update Catalogue", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Insert Or Update Catalogue") @ApiOperation("Insert Or Update Catalogue")
public Result<Void> saveOrUpdateCatalogue(@RequestBody Catalogue catalogue) { public Result<Void> saveOrUpdateCatalogue(@RequestBody Catalogue catalogue) {
if (catalogueService.saveOrUpdate(catalogue)) { if (catalogueService.saveOrUpdateOrRename(catalogue)) {
return Result.succeed(Status.SAVE_SUCCESS); return Result.succeed(Status.SAVE_SUCCESS);
} else { } else {
return Result.failed(Status.SAVE_FAILED); return Result.failed(Status.SAVE_FAILED);
} }
} }
/** 获取所有目录 */ /**
* query catalogue tree data
* @return {@link Result}< {@link List}< {@link Catalogue}>>}
*/
@PostMapping("/getCatalogueTreeData") @PostMapping("/getCatalogueTreeData")
@ApiOperation("Get Catalogue Tree Data") @ApiOperation("Get Catalogue Tree Data")
public Result<List<Catalogue>> getCatalogueTreeData() { public Result<List<Catalogue>> getCatalogueTree() {
List<Catalogue> catalogues = catalogueService.getAllData(); List<Catalogue> catalogues = catalogueService.getCatalogueTree();
return Result.succeed(catalogues); return Result.succeed(catalogues);
} }
/** 创建节点和作业 */ /**
* create catalogue and task
* @param catalogueTaskDTO {@link CatalogueTaskDTO}
* @return {@link Result}< {@link Catalogue}>}
*/
@PutMapping("/createTask") @PutMapping("/createTask")
@Log(title = "Create Catalogue And Task", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Create Catalogue And Task", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Create Catalogue And Task") @ApiOperation("Create Catalogue And Task")
...@@ -130,30 +139,30 @@ public class CatalogueController { ...@@ -130,30 +139,30 @@ public class CatalogueController {
} }
} }
/** 重命名节点和作业 */ /**
@PutMapping("/toRename") * move catalogue
@Log(title = "Rename Catalogue And Task", businessType = BusinessType.UPDATE) * @param originCatalogueId origin catalogue id
@ApiOperation("Rename Catalogue And Task") * @param targetParentId target parent id
public Result<Void> toRename(@RequestBody Catalogue catalogue) { * @return {@link Result}< {@link Boolean}>}
if (catalogueService.toRename(catalogue)) { */
return Result.succeed(Status.RENAME_SUCCESS);
} else {
return Result.failed(Status.RENAME_FAILED);
}
}
/** 重命名节点和作业 */
@PutMapping("/moveCatalogue") @PutMapping("/moveCatalogue")
@Log(title = "Move Catalogue", businessType = BusinessType.UPDATE) @Log(title = "Move Catalogue", businessType = BusinessType.UPDATE)
@ApiOperation("Move Catalogue") @ApiOperation("Move Catalogue")
public Result<Boolean> moveCatalogue(@RequestBody Catalogue catalogue) { public Result<Boolean> moveCatalogue(
if (catalogueService.moveCatalogue(catalogue.getId(), catalogue.getParentId())) { @RequestParam("originCatalogueId") Integer originCatalogueId,
@RequestParam("targetParentId") Integer targetParentId) {
if (catalogueService.moveCatalogue(originCatalogueId, targetParentId)) {
return Result.succeed(true, Status.MOVE_SUCCESS); return Result.succeed(true, Status.MOVE_SUCCESS);
} else { } else {
return Result.failed(false, Status.MOVE_FAILED); return Result.failed(false, Status.MOVE_FAILED);
} }
} }
/**
* copy task
* @param catalogue {@link Catalogue}
* @return {@link Result}< {@link Catalogue}>}
*/
@PostMapping("/copyTask") @PostMapping("/copyTask")
@Log(title = "Copy Task", businessType = BusinessType.INSERT_OR_UPDATE) @Log(title = "Copy Task", businessType = BusinessType.INSERT_OR_UPDATE)
@ApiOperation("Copy Task") @ApiOperation("Copy Task")
...@@ -164,4 +173,16 @@ public class CatalogueController { ...@@ -164,4 +173,16 @@ public class CatalogueController {
return Result.failed(Status.COPY_FAILED); return Result.failed(Status.COPY_FAILED);
} }
} }
/**
* delete catalogue by id
* @param id catalogue id
* @return {@link Result}< {@link Void}>}
*/
@DeleteMapping("deleteCatalogueById")
@Log(title = "Delete Catalogue By Id", businessType = BusinessType.DELETE)
@ApiOperation("Delete Catalogue By Id")
public Result<Void> deleteCatalogueById(@RequestParam Integer id) {
return catalogueService.deleteCatalogueById(id);
}
} }
...@@ -35,6 +35,7 @@ import java.util.Set; ...@@ -35,6 +35,7 @@ import java.util.Set;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -65,7 +66,7 @@ public class UDFController { ...@@ -65,7 +66,7 @@ public class UDFController {
* *
* @return * @return
*/ */
@PostMapping("/tree") @GetMapping("/tree")
@ApiOperation("Build UDF Tree") @ApiOperation("Build UDF Tree")
public Result<List<Object>> listUdfTemplates() { public Result<List<Object>> listUdfTemplates() {
List<UDFTemplate> list = udfTemplateService.list(); List<UDFTemplate> list = udfTemplateService.list();
......
...@@ -21,6 +21,10 @@ package org.dinky.data.model; ...@@ -21,6 +21,10 @@ package org.dinky.data.model;
import org.dinky.mybatis.model.SuperEntity; import org.dinky.mybatis.model.SuperEntity;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
...@@ -48,6 +52,12 @@ public class Catalogue extends SuperEntity { ...@@ -48,6 +52,12 @@ public class Catalogue extends SuperEntity {
private Boolean isLeaf; private Boolean isLeaf;
@TableField(exist = false)
private List<Catalogue> children = new ArrayList<>();
@TableField(exist = false)
private Task task;
public Catalogue() {} public Catalogue() {}
public Catalogue(String name, Integer taskId, String type, Integer parentId, Boolean isLeaf) { public Catalogue(String name, Integer taskId, String type, Integer parentId, Boolean isLeaf) {
......
...@@ -21,6 +21,7 @@ package org.dinky.service; ...@@ -21,6 +21,7 @@ package org.dinky.service;
import org.dinky.data.dto.CatalogueTaskDTO; import org.dinky.data.dto.CatalogueTaskDTO;
import org.dinky.data.model.Catalogue; import org.dinky.data.model.Catalogue;
import org.dinky.data.result.Result;
import org.dinky.mybatis.service.ISuperService; import org.dinky.mybatis.service.ISuperService;
import java.util.List; import java.util.List;
...@@ -32,7 +33,7 @@ import java.util.List; ...@@ -32,7 +33,7 @@ import java.util.List;
*/ */
public interface CatalogueService extends ISuperService<Catalogue> { public interface CatalogueService extends ISuperService<Catalogue> {
List<Catalogue> getAllData(); List<Catalogue> getCatalogueTree();
Catalogue findByParentIdAndName(Integer parentId, String name); Catalogue findByParentIdAndName(Integer parentId, String name);
...@@ -42,9 +43,7 @@ public interface CatalogueService extends ISuperService<Catalogue> { ...@@ -42,9 +43,7 @@ public interface CatalogueService extends ISuperService<Catalogue> {
boolean toRename(Catalogue catalogue); boolean toRename(Catalogue catalogue);
List<String> removeCatalogueAndTaskById(Integer id); boolean moveCatalogue(Integer originCatalogueId, Integer targetParentId);
boolean moveCatalogue(Integer id, Integer parentId);
boolean copyTask(Catalogue catalogue); boolean copyTask(Catalogue catalogue);
...@@ -53,4 +52,8 @@ public interface CatalogueService extends ISuperService<Catalogue> { ...@@ -53,4 +52,8 @@ public interface CatalogueService extends ISuperService<Catalogue> {
void traverseFile(String sourcePath, Catalogue catalog); void traverseFile(String sourcePath, Catalogue catalog);
Catalogue getCatalogue(Integer parentId, String name); Catalogue getCatalogue(Integer parentId, String name);
Result<Void> deleteCatalogueById(Integer catalogueId);
Boolean saveOrUpdateOrRename(Catalogue catalogue);
} }
...@@ -19,22 +19,24 @@ ...@@ -19,22 +19,24 @@
package org.dinky.service.impl; package org.dinky.service.impl;
import static org.dinky.assertion.Asserts.isNotNull;
import static org.dinky.assertion.Asserts.isNull; import static org.dinky.assertion.Asserts.isNull;
import org.dinky.assertion.Asserts; import org.dinky.assertion.Asserts;
import org.dinky.data.dto.CatalogueTaskDTO; import org.dinky.data.dto.CatalogueTaskDTO;
import org.dinky.data.enums.JobLifeCycle; import org.dinky.data.enums.JobLifeCycle;
import org.dinky.data.enums.JobStatus; import org.dinky.data.enums.Status;
import org.dinky.data.model.Catalogue; import org.dinky.data.model.Catalogue;
import org.dinky.data.model.History; import org.dinky.data.model.History;
import org.dinky.data.model.JobHistory;
import org.dinky.data.model.JobInstance; import org.dinky.data.model.JobInstance;
import org.dinky.data.model.Statement; import org.dinky.data.model.Statement;
import org.dinky.data.model.Task; import org.dinky.data.model.Task;
import org.dinky.data.result.Result;
import org.dinky.mapper.CatalogueMapper; import org.dinky.mapper.CatalogueMapper;
import org.dinky.mybatis.service.impl.SuperServiceImpl; import org.dinky.mybatis.service.impl.SuperServiceImpl;
import org.dinky.service.CatalogueService; import org.dinky.service.CatalogueService;
import org.dinky.service.HistoryService; import org.dinky.service.HistoryService;
import org.dinky.service.JobHistoryService;
import org.dinky.service.JobInstanceService; import org.dinky.service.JobInstanceService;
import org.dinky.service.StatementService; import org.dinky.service.StatementService;
import org.dinky.service.TaskService; import org.dinky.service.TaskService;
...@@ -45,7 +47,8 @@ import java.io.InputStreamReader; ...@@ -45,7 +47,8 @@ import java.io.InputStreamReader;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.Comparator;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
...@@ -56,9 +59,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -56,9 +59,9 @@ import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -76,17 +79,102 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -76,17 +79,102 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
private final HistoryService historyService; private final HistoryService historyService;
private final JobHistoryService jobHistoryService;
private final StatementService statementService; private final StatementService statementService;
/**
* @return
*/
@Override @Override
public List<Catalogue> getAllData() { public List<Catalogue> getCatalogueTree() {
return this.list(); return buildCatalogueTree(this.list());
}
/**
* build catalogue tree
* @param catalogueList catalogue list
* @return catalogue tree
*/
public List<Catalogue> buildCatalogueTree(List<Catalogue> catalogueList) {
// sort
if (CollectionUtil.isNotEmpty(catalogueList)) {
catalogueList = catalogueList.stream()
.sorted(Comparator.comparing(Catalogue::getId))
.collect(Collectors.toList());
}
List<Catalogue> returnList = new ArrayList<>();
for (Iterator<Catalogue> iterator = catalogueList.iterator(); iterator.hasNext(); ) {
Catalogue menu = iterator.next();
// get all child menu of parent menu id , the -1 is root menu
if (menu.getParentId() == 0) {
recursionBuildCatalogueAndChildren(catalogueList, menu);
returnList.add(menu);
}
}
if (returnList.isEmpty()) {
returnList = catalogueList;
}
return returnList;
}
/**
* recursion build catalogue and children
* @param list
* @param catalogues
*/
private void recursionBuildCatalogueAndChildren(List<Catalogue> list, Catalogue catalogues) {
// 得到子节点列表
List<Catalogue> childList = getChildList(list, catalogues);
catalogues.setChildren(childList);
for (Catalogue tChild : childList) {
if (hasChild(list, tChild)) {
// Determine whether there are child nodes
for (Catalogue n : childList) {
if (n.getIsLeaf()) {
Task task = taskService.getById(n.getTaskId());
if (task != null) {
n.setTask(task);
}
}
recursionBuildCatalogueAndChildren(list, n);
}
}
}
}
/**
* Determine whether there are child nodes
* @param list
* @param menu
* @return
*/
private boolean hasChild(List<Catalogue> list, Catalogue menu) {
return getChildList(list, menu).size() > 0;
}
/**
* get child list
* @param list
* @param catalogue
* @return
*/
private List<Catalogue> getChildList(List<Catalogue> list, Catalogue catalogue) {
List<Catalogue> childList = new ArrayList<>();
for (Catalogue n : list) {
if (n.getParentId().longValue() == catalogue.getId().longValue()) {
childList.add(n);
}
}
return childList;
} }
@Override @Override
public Catalogue findByParentIdAndName(Integer parentId, String name) { public Catalogue findByParentIdAndName(Integer parentId, String name) {
return baseMapper.selectOne( return baseMapper.selectOne(new LambdaQueryWrapper<Catalogue>()
Wrappers.<Catalogue>query().eq("parent_id", parentId).eq("name", name)); .eq(Catalogue::getParentId, parentId)
.eq(Catalogue::getName, name));
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -102,7 +190,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -102,7 +190,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
task = taskService.getById(catalogue.getTaskId()); task = taskService.getById(catalogue.getTaskId());
} }
task.setName(catalogueTaskDTO.getName()); task.setName(catalogueTaskDTO.getName());
task.setDialect(catalogueTaskDTO.getDialect()); task.setDialect(catalogueTaskDTO.getType());
task.setConfigJson(Collections.singletonList(catalogueTaskDTO.getConfig())); task.setConfigJson(Collections.singletonList(catalogueTaskDTO.getConfig()));
taskService.saveOrUpdateTask(task); taskService.saveOrUpdateTask(task);
...@@ -110,7 +198,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -110,7 +198,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
catalogue.setName(catalogueTaskDTO.getName()); catalogue.setName(catalogueTaskDTO.getName());
catalogue.setIsLeaf(true); catalogue.setIsLeaf(true);
catalogue.setTaskId(task.getId()); catalogue.setTaskId(task.getId());
catalogue.setType(catalogueTaskDTO.getDialect()); catalogue.setType(catalogueTaskDTO.getType());
catalogue.setParentId(catalogueTaskDTO.getParentId()); catalogue.setParentId(catalogueTaskDTO.getParentId());
this.saveOrUpdate(catalogue); this.saveOrUpdate(catalogue);
return catalogue; return catalogue;
...@@ -150,50 +238,6 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -150,50 +238,6 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override
public List<String> removeCatalogueAndTaskById(Integer id) {
List<String> errors = new ArrayList<>();
Catalogue catalogue = this.getById(id);
if (isNull(catalogue)) {
errors.add(id + "不存在!");
} else {
if (isNotNull(catalogue.getTaskId())) {
Integer taskId = catalogue.getTaskId();
JobInstance job = jobInstanceService.getJobInstanceByTaskId(taskId);
if (job == null) {
taskService.removeById(taskId);
statementService.removeById(taskId);
this.removeById(id);
} else if (job != null && !JobStatus.RUNNING.getValue().equals(job.getStatus())) {
historyService.remove(new QueryWrapper<History>().eq("task_id", taskId));
jobInstanceService.remove(new QueryWrapper<JobInstance>().eq("task_id", taskId));
taskService.removeById(taskId);
statementService.removeById(taskId);
this.removeById(id);
} else {
errors.add(job.getName());
}
} else {
List<Catalogue> all = this.getAllData();
Set<Catalogue> del = new HashSet<>();
this.findAllCatalogueInDir(id, all, del);
List<String> actives = this.analysisActiveCatalogues(del);
if (actives.isEmpty()) {
for (Catalogue c : del) {
taskService.removeById(c.getTaskId());
statementService.removeById(c.getTaskId());
this.removeById(c.getId());
}
} else {
errors.addAll(actives);
}
}
}
return errors;
}
private void findAllCatalogueInDir(Integer id, List<Catalogue> all, Set<Catalogue> del) { private void findAllCatalogueInDir(Integer id, List<Catalogue> all, Set<Catalogue> del) {
List<Catalogue> relatedList = all.stream() List<Catalogue> relatedList = all.stream()
.filter(catalogue -> id.equals(catalogue.getId()) || id.equals(catalogue.getParentId())) .filter(catalogue -> id.equals(catalogue.getId()) || id.equals(catalogue.getParentId()))
...@@ -222,6 +266,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -222,6 +266,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean moveCatalogue(Integer id, Integer parentId) { public boolean moveCatalogue(Integer id, Integer parentId) {
Catalogue catalogue = this.getById(id); Catalogue catalogue = this.getById(id);
if (isNull(catalogue)) { if (isNull(catalogue)) {
...@@ -251,6 +296,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -251,6 +296,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
Task newTask = new Task(); Task newTask = new Task();
BeanUtil.copyProperties(oldTask, newTask); BeanUtil.copyProperties(oldTask, newTask);
newTask.setId(null); newTask.setId(null);
newTask.setType(oldTask.getType());
// 设置复制后的作业名称为:原名称+自增序列 // 设置复制后的作业名称为:原名称+自增序列
size = size + 1; size = size + 1;
newTask.setName(oldTask.getName() + "_" + size); newTask.setName(oldTask.getName() + "_" + size);
...@@ -264,14 +310,15 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -264,14 +310,15 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
statement.setId(newTask.getId()); statement.setId(newTask.getId());
statementService.save(statement); statementService.save(statement);
Catalogue one = Catalogue singleCatalogue =
this.getOne(new LambdaQueryWrapper<Catalogue>().eq(Catalogue::getTaskId, catalogue.getTaskId())); this.getOne(new LambdaQueryWrapper<Catalogue>().eq(Catalogue::getTaskId, catalogue.getTaskId()));
catalogue.setName(newTask.getName()); catalogue.setName(newTask.getName());
catalogue.setIsLeaf(one.getIsLeaf()); catalogue.setIsLeaf(singleCatalogue.getIsLeaf());
catalogue.setTaskId(newTask.getId()); catalogue.setTaskId(newTask.getId());
catalogue.setType(one.getType()); catalogue.setType(singleCatalogue.getType());
catalogue.setParentId(one.getParentId()); catalogue.setParentId(singleCatalogue.getParentId());
catalogue.setId(null);
return this.save(catalogue); return this.save(catalogue);
} }
...@@ -353,6 +400,73 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata ...@@ -353,6 +400,73 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
return subcata; return subcata;
} }
/**
* @param catalogueId
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Void> deleteCatalogueById(Integer catalogueId) {
List<Catalogue> catalogues = list(new LambdaQueryWrapper<Catalogue>().eq(Catalogue::getParentId, catalogueId));
if (catalogues.size() > 0) {
return Result.failed(Status.FOLDER_NOT_EMPTY);
}
// 获取 catalogue 表中的作业
Catalogue catalogue = getById(catalogueId);
// 如果是文件夹 , 且下边没有子文件夹 , 则删除
if (catalogue.getIsLeaf()) {
return removeById(catalogueId)
? Result.succeed(Status.DELETE_SUCCESS)
: Result.failed(Status.DELETE_FAILED);
}
// doing: cascade delete jobInstance && jobHistory && history && statement
// 获取 task 表中的作业
Task task = taskService.getById(catalogue.getTaskId());
// 获取 statement 表中的作业
Statement statement = statementService.getById(catalogue.getTaskId());
// 获取 job instance 表中的作业
List<JobInstance> jobInstanceList = jobInstanceService.list(
new LambdaQueryWrapper<JobInstance>().eq(JobInstance::getTaskId, catalogue.getTaskId()));
// 获取 history 表中的作业
List<History> historyList =
historyService.list(new LambdaQueryWrapper<History>().eq(History::getTaskId, catalogue.getTaskId()));
historyList.forEach(history -> {
// 查询 job history 表中的作业 通过 id 关联查询
JobHistory historyServiceById = jobHistoryService.getById(history.getId());
// 删除 job history 表中的作业
jobHistoryService.removeById(historyServiceById.getId());
// 删除 history 表中的作业
historyService.removeById(history.getId());
});
jobInstanceList.forEach(jobInstance -> {
// 删除 job instance 表中的作业
jobInstanceService.removeById(jobInstance.getId());
});
// 删除 task 表中的作业
taskService.removeById(task.getId());
// 删除 statement 表中的作业
statementService.removeById(statement.getId());
removeById(catalogueId);
return Result.succeed(Status.DELETE_SUCCESS);
}
/**
* <p>
* 1. save catalogue
* 2. save task
* 3. save statement
* 4. rename
* @param catalogue
* @return
*/
@Override
public Boolean saveOrUpdateOrRename(Catalogue catalogue) {
if (taskService.getById(catalogue.getTaskId()) != null) {
toRename(catalogue);
}
return saveOrUpdate(catalogue);
}
private CatalogueTaskDTO getCatalogueTaskDTO(String name, Integer parentId) { private CatalogueTaskDTO getCatalogueTaskDTO(String name, Integer parentId) {
CatalogueTaskDTO catalogueTaskDTO = new CatalogueTaskDTO(); CatalogueTaskDTO catalogueTaskDTO = new CatalogueTaskDTO();
catalogueTaskDTO.setName(UUID.randomUUID().toString().substring(0, 6) + name); catalogueTaskDTO.setName(UUID.randomUUID().toString().substring(0, 6) + name);
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<select id="queryAllSizeByName" resultType="java.lang.Integer"> <select id="queryAllSizeByName" resultType="java.lang.Integer">
SELECT count(*) SELECT count(*)
from dinky_task from dinky_task
where `name` REGEXP '${name}_[0-9]$' where `name` REGEXP concat(#{name}, '_[0-9]$')
</select> </select>
<select id="getTaskByNameAndTenantId" resultType="org.dinky.data.model.Task"> <select id="getTaskByNameAndTenantId" resultType="org.dinky.data.model.Task">
......
...@@ -223,6 +223,12 @@ public enum Status { ...@@ -223,6 +223,12 @@ public enum Status {
+ " or do not use LDAP to log in", + " or do not use LDAP to log in",
"当前用户登录模式不是LDAP,请联系管理员修改,或不使用LDAP登录"), "当前用户登录模式不是LDAP,请联系管理员修改,或不使用LDAP登录"),
/**
* datastudio about
*/
// 该目录下存在子目录/作业,无法删除
FOLDER_NOT_EMPTY(19001, "Folder Not Empty, Can Not Delete", "该目录下存在子目录/作业,无法删除"),
/** global exception */ /** global exception */
GLOBAL_PARAMS_CHECK_ERROR(90001, "Field: {0}, {1}", "字段: {0}, {1}"), GLOBAL_PARAMS_CHECK_ERROR(90001, "Field: {0}, {1}", "字段: {0}, {1}"),
GLOBAL_PARAMS_CHECK_ERROR_VALUE(90002, "Field: {0}, Illegal Value: {1}", "字段: {0}, 不合法的值: {1}"), GLOBAL_PARAMS_CHECK_ERROR_VALUE(90002, "Field: {0}, Illegal Value: {1}", "字段: {0}, 不合法的值: {1}"),
......
...@@ -8,10 +8,7 @@ ...@@ -8,10 +8,7 @@
"build": "max build", "build": "max build",
"deploy": "npm run build && npm run gh-pages", "deploy": "npm run build && npm run gh-pages",
"dev": "npm run start:dev", "dev": "npm run start:dev",
"gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "max setup", "postinstall": "max setup",
"jest": "jest",
"lint": "npm run lint:js && npm run lint:prettier && npm run tsc", "lint": "npm run lint:js && npm run lint:prettier && npm run tsc",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
...@@ -21,16 +18,11 @@ ...@@ -21,16 +18,11 @@
"openapi": "max openapi", "openapi": "max openapi",
"prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"preview": "npm run build && max preview --port 8000", "preview": "npm run build && max preview --port 8000",
"record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login",
"serve": "umi-serve", "serve": "umi-serve",
"start": "cross-env UMI_ENV=dev max dev", "start": "cross-env UMI_ENV=dev max dev",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev",
"start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev", "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
"start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
"start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev",
"test": "jest",
"test:coverage": "npm run jest -- --coverage",
"test:update": "npm run jest -- -u",
"tsc": "tsc --noEmit" "tsc": "tsc --noEmit"
}, },
"lint-staged": { "lint-staged": {
...@@ -82,7 +74,6 @@ ...@@ -82,7 +74,6 @@
"@types/classnames": "^2.3.1", "@types/classnames": "^2.3.1",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/history": "^5.0.0", "@types/history": "^5.0.0",
"@types/jest": "^29.2.1",
"@types/lodash": "^4.14.186", "@types/lodash": "^4.14.186",
"@types/react": "^18.0.28", "@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
...@@ -94,8 +85,6 @@ ...@@ -94,8 +85,6 @@
"express": "^4.18.2", "express": "^4.18.2",
"gh-pages": "^5.0.0", "gh-pages": "^5.0.0",
"husky": "^8", "husky": "^8",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"lint-staged": "^13", "lint-staged": "^13",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"prettier": "^2", "prettier": "^2",
......
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
'right.menu.open': 'Open', 'right.menu.open': 'Open',
'right.menu.submit': 'Sync Submit', 'right.menu.submit': 'Sync Submit',
'right.menu.addSub': 'Add Sub Item', 'right.menu.addSub': 'Add Sub Item',
'right.menu.addRoot': 'Add Root Menu', 'right.menu.createSubFolder': 'Create Sub Folder',
'right.menu.exportJson': 'Export JSON', 'right.menu.exportJson': 'Export JSON',
'right.menu.importJson': 'Import JSON', 'right.menu.importJson': 'Import JSON',
'right.menu.rename': 'Rename', 'right.menu.rename': 'Rename',
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
'right.menu.paste': 'Paste', 'right.menu.paste': 'Paste',
'right.menu.delete': 'Delete', 'right.menu.delete': 'Delete',
'right.menu.createCatalogue': 'Create Directory', 'right.menu.createCatalogue': 'Create Directory',
'right.menu.createRoot': 'Create Root Directory',
'right.menu.uploadZipToCreate': 'Upload Zip To Create', 'right.menu.uploadZipToCreate': 'Upload Zip To Create',
'right.menu.createTask': 'Create Task', 'right.menu.createTask': 'Create Task',
'right.menu.closeAll': 'Close All', 'right.menu.closeAll': 'Close All',
......
...@@ -1063,4 +1063,18 @@ export default { ...@@ -1063,4 +1063,18 @@ export default {
'datastudio.project.create.rootFolder': 'Create Root Folder', 'datastudio.project.create.rootFolder': 'Create Root Folder',
'datastudio.project.create.folder.name': 'Folder Name', 'datastudio.project.create.folder.name': 'Folder Name',
'datastudio.project.create.folder.name.placeholder': 'Please enter the folder name', 'datastudio.project.create.folder.name.placeholder': 'Please enter the folder name',
'datastudio.project.create.folder.tip': 'No job, please click the new directory in the upper left corner',
'datastudio.project.delete.job': 'Delete [{type}] Job [{name}]',
'datastudio.project.delete.job.confirm': 'This operation will delete the execution history of the task and all information of the task. \nPlease operate with caution! This operation is irreversible!!! \n\t\t\t\tConfirm to delete?',
'catalog.name': 'Job Name',
'catalog.name.placeholder': 'Please enter the job name',
'catalog.name.tip': 'This name can be used as the JobName of the FlinkSql task (pipeline.name configuration item)',
'catalog.type': 'Job Type',
'catalog.type.placeholder': 'Please select the job type',
'catalog.type.tip': 'The job type determines the execution method of the job, please choose carefully, once selected, it cannot be modified',
'catalog.udf.templateId': 'UDF Template',
'catalog.udf.templateId.placeholder': 'Please select UDF template',
'catalog.udf.className': 'Class/Method Name',
'catalog.udf.className.placeholder': 'Please enter the class or method name',
}; };
...@@ -79,6 +79,7 @@ export default { ...@@ -79,6 +79,7 @@ export default {
'right.menu.open': '打开', 'right.menu.open': '打开',
'right.menu.submit': '异步提交', 'right.menu.submit': '异步提交',
'right.menu.addSub': '添加子项', 'right.menu.addSub': '添加子项',
'right.menu.createSubFolder': '添加子目录',
'right.menu.exportJson': '导出 JSON', 'right.menu.exportJson': '导出 JSON',
'right.menu.importJson': '导入 JSON', 'right.menu.importJson': '导入 JSON',
'right.menu.rename': '重命名', 'right.menu.rename': '重命名',
...@@ -89,7 +90,7 @@ export default { ...@@ -89,7 +90,7 @@ export default {
'right.menu.paste': '粘贴', 'right.menu.paste': '粘贴',
'right.menu.delete': '删除', 'right.menu.delete': '删除',
'right.menu.createCatalogue': '创建目录', 'right.menu.createCatalogue': '创建目录',
'right.menu.createRootCatalogue': '创建根目录', 'right.menu.createRoot': '创建根目录',
'right.menu.uploadZipToCreate': '上传zip包创建工程', 'right.menu.uploadZipToCreate': '上传zip包创建工程',
'right.menu.createTask': '创建作业', 'right.menu.createTask': '创建作业',
'right.menu.closeAll': '关闭所有', 'right.menu.closeAll': '关闭所有',
......
...@@ -1076,6 +1076,21 @@ export default { ...@@ -1076,6 +1076,21 @@ export default {
'datastudio.project.create.rootFolder': '创建根目录', 'datastudio.project.create.rootFolder': '创建根目录',
'datastudio.project.create.folder.name': '目录名称', 'datastudio.project.create.folder.name': '目录名称',
'datastudio.project.create.folder.name.placeholder': '请输入目录名称', 'datastudio.project.create.folder.name.placeholder': '请输入目录名称',
'datastudio.project.create.folder.tip': '暂无作业,请点击左上角新建目录',
'datastudio.project.delete.job': '删除 [{type}] 作业 [{name}]',
'datastudio.project.delete.job.confirm': '此操作会将该任务的执行历史, 以及任务的所有信息全部删除.\n\t\t\t\t请谨慎操作! 该操作不可逆!!!\n\t\t\t\t\t确认删除吗?',
'catalog.name': '作业名称',
'catalog.name.placeholder': '请输入作业名称',
'catalog.name.tip': '此名称可作为 FlinkSql 任务的 JobName ([配置项: pipeline.name])',
'catalog.type': '作业类型',
'catalog.type.placeholder': '请选择作业类型',
'catalog.type.tip': '作业类型决定了作业的执行方式, 请谨慎选择, 一旦选择后不可修改',
'catalog.udf.templateId': 'UDF 模板',
'catalog.udf.templateId.placeholder': '请选择 UDF 模板',
'catalog.udf.className': '类或方法名',
'catalog.udf.className.placeholder': '请输入类或方法名',
}; };
{
"name": "Dinky",
"short_name": "Dinky",
"display": "standalone",
"start_url": "./?utm_source=homescreen",
"theme_color": "#002140",
"background_color": "#001529",
"icons": [
{
"src": "dinky.svg",
"sizes": "192x192"
},
{
"src": "dinky.svg",
"sizes": "128x128"
},
{
"src": "dinky.svg",
"sizes": "512x512"
}
]
}
...@@ -221,7 +221,7 @@ const MenuList: React.FC = () => { ...@@ -221,7 +221,7 @@ const MenuList: React.FC = () => {
type={'primary'} type={'primary'}
onClick={() => handleCreateRoot()} onClick={() => handleCreateRoot()}
> >
{l('right.menu.addRoot')} {l('right.menu.createRoot')}
</Button> </Button>
<Button <Button
size={'middle'} size={'middle'}
...@@ -241,7 +241,7 @@ const MenuList: React.FC = () => { ...@@ -241,7 +241,7 @@ const MenuList: React.FC = () => {
{(formValues.id && updateModalVisible) ? {(formValues.id && updateModalVisible) ?
l('menu.edit') : (!formValues.id && modalVisible && !isRootMenu) ? l('menu.edit') : (!formValues.id && modalVisible && !isRootMenu) ?
l('right.menu.addSub') : (!formValues.id && modalVisible && isRootMenu) ? l('right.menu.addSub') : (!formValues.id && modalVisible && isRootMenu) ?
l('right.menu.addRoot') : ''} l('right.menu.createRoot') : ''}
</> </>
} }
......
...@@ -21,11 +21,10 @@ import React from "react"; ...@@ -21,11 +21,10 @@ import React from "react";
import {ProForm, ProFormText} from "@ant-design/pro-components"; import {ProForm, ProFormText} from "@ant-design/pro-components";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
const JobForm = () => { const FolderForm = () => {
return <> return <>
<ProFormText <ProFormText
name="name" name="name"
width={'md'}
label={l('datastudio.project.create.folder.name')} label={l('datastudio.project.create.folder.name')}
placeholder={l('datastudio.project.create.folder.name.placeholder')} placeholder={l('datastudio.project.create.folder.name.placeholder')}
rules={[ {required: true, message: l('datastudio.project.create.folder.name.placeholder')} ]} rules={[ {required: true, message: l('datastudio.project.create.folder.name.placeholder')} ]}
...@@ -34,4 +33,4 @@ const JobForm = () => { ...@@ -34,4 +33,4 @@ const JobForm = () => {
}; };
export default JobForm; export default FolderForm;
\ No newline at end of file \ No newline at end of file
/*
*
* 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.
*
*/
import { ModalForm } from "@ant-design/pro-components";
import {Form} from "antd";
import React, {useEffect} from "react";
import {Catalogue} from "@/types/Studio/data";
import {FormContextValue} from "@/components/Context/FormContext";
import FolderForm from "@/pages/DataStudio/LeftContainer/Project/FolderModal/FolderForm";
type JobModalProps = {
onCancel: () => void
onSubmit: (values: Catalogue) => void
modalVisible: boolean
title: React.ReactNode
values: Partial<Catalogue>
}
const FolderModal:React.FC<JobModalProps> = ( props ) => {
const {onCancel, onSubmit, modalVisible,title,values} = props;
const [form] = Form.useForm<Catalogue>();
/**
* init form context
*/
const formContext = React.useMemo<FormContextValue>(
() => ({
resetForm: () => form.resetFields(), // 定义 resetForm 方法
}),
[form],
);
/**
* when modalVisible or values changed, set form values
*/
useEffect(() => {
if (modalVisible) form.resetFields();
form.setFieldsValue(values);
}, [open, values, form]);
/**
* handle cancel
*/
const handleCancel = () => {
onCancel();
formContext.resetForm();
};
/**
* submit form
*/
const submitForm = async (formData: Catalogue ) => {
await form.validateFields();
const newValue = await form.getFieldsValue();
onSubmit({...values, name: newValue.name} as Catalogue);
};
return <>
<ModalForm<Catalogue>
title={title}
form={form}
width={'30%'}
initialValues={values}
open={modalVisible}
layout={'horizontal'}
autoFocusFirstInput
modalProps={{destroyOnClose: true, maskClosable: false, onCancel: handleCancel}}
onFinish={async (values) => submitForm(values)}
>
<FolderForm />
</ModalForm>
</>
};
export default FolderModal;
\ No newline at end of file
...@@ -17,41 +17,140 @@ ...@@ -17,41 +17,140 @@
* *
*/ */
import { ModalForm } from "@ant-design/pro-components"; import {ModalForm, ProFormSelect, ProFormText} from "@ant-design/pro-components";
import {l} from "@/utils/intl";
import {Form} from "antd"; import {Form} from "antd";
import React from "react";
import JobForm from "@/pages/DataStudio/LeftContainer/Project/JobModal/JobForm";
import {Catalogue} from "@/types/Studio/data"; import {Catalogue} from "@/types/Studio/data";
import {l} from "@/utils/intl"; import React, {useEffect, useState} from "react";
import {FormContextValue} from "@/components/Context/FormContext";
import {JOB_TYPE} from "@/pages/DataStudio/LeftContainer/Project/constants";
import {isUDF} from "@/pages/DataStudio/LeftContainer/Project/function";
import {ProFormCascader} from "@ant-design/pro-form/lib";
import {queryDataByParams} from "@/services/BusinessCrud";
import {API_CONSTANTS} from "@/services/constants";
type JobModalProps = { type JobModalProps = {
onCancel: () => void onCancel: () => void
onSubmit: (values: Catalogue) => void onSubmit: (values: Catalogue) => void
modalVisible: boolean modalVisible: boolean
title: React.ReactNode
values: Partial<Catalogue>
} }
const JobModal:React.FC<JobModalProps> = ( props ) => { const JobModal: React.FC<JobModalProps> = (props) => {
const {onCancel, onSubmit, modalVisible, title, values} = props;
const [jobType, setJobType] = React.useState<string>(values.type || '');
const {onCancel, onSubmit, modalVisible} = props;
const [form] = Form.useForm<Catalogue>(); const [form] = Form.useForm<Catalogue>();
/**
* init form context
*/
const formContext = React.useMemo<FormContextValue>(
() => ({
resetForm: () => form.resetFields(), // 定义 resetForm 方法
}),
[form],
);
/**
* when modalVisible or values changed, set form values
*/
useEffect(() => {
if (modalVisible) form.resetFields();
form.setFieldsValue(values);
}, [open, values, form]);
/**
* handle cancel
*/
const handleCancel = () => {
onCancel();
formContext.resetForm();
};
/**
* form values change
* @param changedValues
* @param allValues
*/
const onValuesChange = (changedValues: any, allValues: any) => {
if (allValues.type) setJobType(allValues.type);
}
/**
* submit form
*/
const submitForm = async (formData: Catalogue) => {
await form.validateFields();
if(!formData.configJson.templateId) return
formData.configJson.templateId = formData.configJson.templateId.reverse().pop();
onSubmit({...values, ...formData} as Catalogue);
};
const renderForm = () => {
return <>
<ProFormSelect
name={'type'}
label={l('catalog.type')}
tooltip={l('catalog.type.tip')}
options={JOB_TYPE}
disabled={!!values.id}
placeholder={l('catalog.type.placeholder')}
rules={[{required: true, message: l('catalog.type.placeholder')}]}
/>
<ProFormText
name="name"
label={l('catalog.name')}
tooltip={l('catalog.name.tip')}
placeholder={l('catalog.name.placeholder')}
rules={[{required: true, message: l('catalog.name.placeholder')}]}
/>
{
isUDF(jobType) &&
<>
<ProFormCascader
name={['configJson', 'templateId']}
label={l('catalog.udf.templateId')}
placeholder={l('catalog.udf.templateId.placeholder')}
request={async () => await queryDataByParams(API_CONSTANTS.UDF_TEMPLATE_TREE)}
rules={[{required: true, message: l('catalog.udf.templateId.placeholder')}]}
/>
<ProFormText
name={['configJson', 'className']}
label={l('catalog.udf.className')}
placeholder={l('catalog.udf.className.placeholder')}
rules={[{required: true, message: l('catalog.udf.className.placeholder')}]}
/>
</>
}
</>
};
return <> return <>
<ModalForm<Catalogue> <ModalForm<Catalogue>
title={l('datastudio.project.create.rootFolder')} title={title}
form={form} form={form}
width={'30%'} width={'30%'}
initialValues={{...values}}
open={modalVisible} open={modalVisible}
layout={'inline'} layout={'horizontal'}
style={{display: 'flex', flexDirection: 'column', alignItems: 'center',}} autoFocusFirstInput onValuesChange={onValuesChange}
autoFocusFirstInput modalProps={{destroyOnClose: true, maskClosable: false, onCancel: handleCancel}}
modalProps={{destroyOnClose: true, maskClosable: false, onCancel: onCancel}} onFinish={async (values) => submitForm(values)}
onFinish={async (values) => onSubmit(values)}
> >
<JobForm /> {renderForm()}
</ModalForm> </ModalForm>
</> </>
}; };
export default JobModal
export default JobModal; \ No newline at end of file
\ No newline at end of file
...@@ -19,12 +19,16 @@ ...@@ -19,12 +19,16 @@
import React, {useState} from "react"; import React, {useState} from "react";
import {Empty, Tree} from "antd"; import {Empty, Tree} from "antd";
import {convertToTreeData, generateList, getParentKey, loop, TreeDataNode} from "@/pages/DataStudio/LeftContainer/Project/function"; import {
buildProjectTree, generateList, getParentKey,
} from "@/pages/DataStudio/LeftContainer/Project/function";
import {connect} from "@@/exports"; import {connect} from "@@/exports";
import {StateType} from "@/pages/DataStudio/model"; import {StateType} from "@/pages/DataStudio/model";
import {Key} from "@ant-design/pro-components"; import {Key} from "@ant-design/pro-components";
import {BtnRoute} from "@/pages/DataStudio/route"; import {BtnRoute} from "@/pages/DataStudio/route";
import Search from "antd/es/input/Search"; import Search from "antd/es/input/Search";
import {l} from "@/utils/intl";
import {Catalogue} from "@/types/Studio/data";
const {DirectoryTree} = Tree; const {DirectoryTree} = Tree;
...@@ -34,16 +38,18 @@ const {DirectoryTree} = Tree; ...@@ -34,16 +38,18 @@ const {DirectoryTree} = Tree;
* props * props
*/ */
type TreeProps = { type TreeProps = {
treeData: TreeDataNode[]; treeData: Catalogue[];
onNodeClick: (info: any) => void onNodeClick: (info: any) => void
onRightClick: (info: any) => void
style?: React.CSSProperties style?: React.CSSProperties
selectedKeys: Key[]
} }
const JobTree: React.FC<TreeProps & connect> = (props) => { const JobTree: React.FC<TreeProps & connect> = (props) => {
const {treeData, onNodeClick, style, height} = props; const {treeData, onNodeClick, style, height,onRightClick,selectedKeys} = props;
const [searchValue,setSearchValueValue] = useState(""); const [searchValue,setSearchValueValue] = useState("");
const data = loop(convertToTreeData(JSON.parse(JSON.stringify(treeData)), 0), searchValue); const data = buildProjectTree(treeData, searchValue);
const [expandedKeys, setExpandedKeys] = useState<Key[]>(); const [expandedKeys, setExpandedKeys] = useState<Key[]>();
const [autoExpandParent, setAutoExpandParent] = useState(true); const [autoExpandParent, setAutoExpandParent] = useState(true);
...@@ -73,29 +79,32 @@ const JobTree: React.FC<TreeProps & connect> = (props) => { ...@@ -73,29 +79,32 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
setExpandedKeys(expandedKeys); setExpandedKeys(expandedKeys);
}; };
const expandAll = () => { const expandAll = () => {
const map = (data as TreeDataNode[]).filter(x=>!x.isLeaf).map(x => x.key); const map = (data).filter((x: { isLeaf: any; })=>!x.isLeaf).map((x: { key: any; }) => x.key);
setExpandedKeys(map); setExpandedKeys(map);
} }
const btn = BtnRoute['menu.datastudio.project']; const btn = BtnRoute['menu.datastudio.project'];
btn[0].onClick = expandAll
btn[1].onClick = () => setExpandedKeys([]); btn[1].onClick = expandAll
btn[2].onClick = () => setExpandedKeys([]);
return <> return <>
<Search style={{margin:"8px 0px"}} placeholder="Search" onChange={onChangeSearch} allowClear={true}/> <Search style={{margin:"8px 0px"}} placeholder={l('global.search.text')} onChange={onChangeSearch} allowClear={true}/>
{ {
(treeData.length > 0) ? (treeData.length > 0) ?
<DirectoryTree <DirectoryTree
style={{...style, height: height-40-16,overflowY:'auto'}} style={{...style, height: height-40-16,overflowY:'auto'}}
// className={'treeList'} className={'treeList'}
onSelect={(_, info) => onNodeClick(info)} onSelect={(_, info) => onNodeClick(info)}
onRightClick={onRightClick}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
selectedKeys={selectedKeys}
onExpand={onExpand} onExpand={onExpand}
treeData={data} treeData={data}
autoExpandParent={autoExpandParent} autoExpandParent={autoExpandParent}
/> : <Empty className={'code-content-empty'} description={"暂无作业,请点击左上角新建目录"}/> /> : <Empty className={'code-content-empty'} description={l('datastudio.project.create.folder.tip')}/>
} }
</>; </>;
}; };
......
...@@ -21,13 +21,12 @@ import React, {useState} from "react"; ...@@ -21,13 +21,12 @@ import React, {useState} from "react";
import {Space} from "antd"; import {Space} from "antd";
import Title from "@/components/Front/Title"; import Title from "@/components/Front/Title";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import JobModal from "@/pages/DataStudio/LeftContainer/Project/JobModal";
import {connect} from "@umijs/max"; import {connect} from "@umijs/max";
import {StateType} from "@/pages/DataStudio/model"; import {StateType} from "@/pages/DataStudio/model";
import {Catalogue} from "@/types/Studio/data"; import {Catalogue} from "@/types/Studio/data";
import {handleAddOrUpdate} from "@/services/BusinessCrud"; import {handleAddOrUpdate} from "@/services/BusinessCrud";
import {PlusOutlined} from "@ant-design/icons"; import {BtnRoute} from "@/pages/DataStudio/route";
import {CircleBtn} from "@/components/CallBackButton/CircleBtn"; import FolderModal from "@/pages/DataStudio/LeftContainer/Project/FolderModal";
const ProjectTitle: React.FC<StateType & connect> = (props) => { const ProjectTitle: React.FC<StateType & connect> = (props) => {
...@@ -62,7 +61,10 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => { ...@@ -62,7 +61,10 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
handleCancelCreate(); handleCancelCreate();
dispatch({type: 'Studio/queryProject'}); dispatch({type: 'Studio/queryProject'});
}); });
} };
const btn = BtnRoute['menu.datastudio.project'];
btn[0].onClick = () => handleCreateClick();
/** /**
...@@ -73,9 +75,12 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => { ...@@ -73,9 +75,12 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
if (selectKey && selectKey === "menu.datastudio.project") { if (selectKey && selectKey === "menu.datastudio.project") {
return <Space> return <Space>
<Title>{l(selectKey)}</Title> <Title>{l(selectKey)}</Title>
<CircleBtn title={l("datastudio.project.create.rootFolder")} icon={<PlusOutlined/>} <FolderModal
onClick={() => handleCreateClick()}/> title={l('right.menu.createRoot')}
<JobModal modalVisible={createModalVisible} onCancel={handleCancelCreate} onSubmit={handleSubmit}/> modalVisible={createModalVisible}
onCancel={handleCancelCreate}
onSubmit={handleSubmit} values={{}}
/>
</Space> </Space>
} else { } else {
return <Title>{l(selectKey)}</Title> return <Title>{l(selectKey)}</Title>
......
/*
*
* 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.
*
*/
import {
CompassTwoTone,
CopyrightTwoTone,
CopyTwoTone,
CustomerServiceTwoTone,
DeleteTwoTone,
EditTwoTone, ExportOutlined,
PlusCircleTwoTone, UpCircleTwoTone, UploadOutlined
} from "@ant-design/icons";
import {l} from "@/utils/intl";
import {BackIcon} from "@/components/Icons/CustomIcons";
import React from "react";
import {MenuItemType} from "antd/es/menu/hooks/useItems";
import {DefaultOptionType} from "antd/es/select";
import {DIALECT} from "@/services/constants";
/**
* 目录级别:
* 新建子目录
* 新建作业
* 删除(删除时检测是否有下级)
* 重命名
* 粘贴
* 取消
* @type {({icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string})[]}
*/
export const FOLDER_RIGHT_MENU =(disabled = false) : MenuItemType[] =>[
{
key: 'addSubFolder',
icon: <PlusCircleTwoTone/>,
label: l('right.menu.createSubFolder'),
},
{
key: 'createTask',
icon: <PlusCircleTwoTone/>,
label: l('right.menu.createTask'),
},
{
key: 'delete',
icon: <DeleteTwoTone twoToneColor={'red'}/>,
label: l('button.delete'),
},
{
key: 'renameFolder',
icon: <EditTwoTone />,
label: l('right.menu.rename'),
},
{
key: 'paste',
icon: <CompassTwoTone />,
label: l('right.menu.paste'),
disabled: !disabled
},
];
/**
* 作业级别:
* 非目录(即任务)
* 导出 json
* 修改
* 复制
* 剪切
* 删除
* @type {({icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string} | {icon: JSX.Element, label: string, key: string})[]}
*/
export const JOB_RIGHT_MENU =(disabled = false) : MenuItemType[] => [
{
key: 'edit',
icon: <EditTwoTone />,
label: l('button.edit'),
},
{
key: 'exportJson',
icon: <UpCircleTwoTone />,
label: l('right.menu.exportJson'),
},
{
key: 'copy',
icon: <CopyTwoTone />,
label: l('right.menu.copy'),
},
{
key: 'cut',
icon: <CopyrightTwoTone />,
label: l('right.menu.cut'),
disabled: disabled
},
{
key: 'delete',
icon: <DeleteTwoTone twoToneColor={'red'}/>,
label: l('button.delete'),
},
];
/**
* 作业 方言类型
* @type {({options: ({label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string})[], label: string} | {options: ({label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string} | {label: string, value: string})[], label: string} | {options: ({label: string, value: string} | {label: string, value: string} | {label: string, value: string})[], label: string})[]}
*/
export const JOB_TYPE: DefaultOptionType[] = [
{
label: 'Flink Job Type',
options: [
{
value: 'FlinkSql',
label: 'FlinkSql',
},
{
value: 'FlinkJar',
label: 'FlinkJar',
},
{
value: 'FlinkSqlEnv',
label: 'FlinkSqlEnv',
},
{
value: 'KubernetesApplication',
label: 'KubernetesApplication',
}
]
},
{
label: 'Jdbc Query Type',
options: [
{
value: 'Sql',
label: 'Sql',
},
{
value: 'Mysql',
label: 'Mysql',
},
{
value: 'Oracle',
label: 'Oracle',
},
{
value: 'SqlServer',
label: 'SqlServer',
},
{
value: 'PostgreSql',
label: 'PostgreSql',
},
{
value: 'ClickHouse',
label: 'ClickHouse',
},
{
value: 'Doris',
label: 'Doris',
},
{
value: 'Hive',
label: 'Hive',
},
{
value: 'Phoenix',
label: 'Phoenix',
},
{
value: 'StarRocks',
label: 'StarRocks',
},
{
value: 'Presto',
label: 'Presto',
},
]
},
{
label: 'Other Type',
options: [
{
value: 'Java',
label: 'Java',
},
{
value: 'Scala',
label: 'Scala',
},
{
value: 'Python',
label: 'Python',
}
]
},
]
\ No newline at end of file
import { DataNode } from "antd/es/tree"; import {searchTreeNode} from "@/utils/function";
import {getIcon} from "@/utils/function";
import style from "./index.less";
import {getTabIcon} from "@/pages/DataStudio/MiddleContainer/function"; import {getTabIcon} from "@/pages/DataStudio/MiddleContainer/function";
import {SysMenu} from "@/types/RegCenter/data";
import {Catalogue} from "@/types/Studio/data";
import path from "path";
import {DIALECT} from "@/services/constants";
export interface TreeDataNode extends DataNode {
name:string;
type?:string;
id:number;
taskId:number;
parentId:number;
path:string[];
schema:string;
table:string;
}
export const generateList = (data: any, list: any[]) => { export const generateList = (data: any, list: any[]) => {
for (const element of data) { for (const element of data) {
...@@ -39,71 +31,48 @@ export const getParentKey = (key: number | string, tree: any): any => { ...@@ -39,71 +31,48 @@ export const getParentKey = (key: number | string, tree: any): any => {
} }
return parentKey; return parentKey;
}; };
export function convertToTreeData(data:TreeDataNode[], pid:number,path?:string[]) {
!path&&(path=[]);
const result:TreeDataNode[] = [];
let temp:TreeDataNode[] = []; /**
for (let i = 0; i < data?.length; i++) { * build menu tree
if (data[i].parentId === pid) { * @param {SysMenu[]} data
let obj = data[i]; * @param {string} searchValue
obj.title = obj.name; * @param path
obj.key = obj.id; * @returns {any}
obj.path = path.slice(); */
obj.path.push(obj.name);
temp = convertToTreeData(data, data[i].id,obj.path); export const buildProjectTree = (data: Catalogue[], searchValue: string = '', path?: string[]): any => data.filter((ca: Catalogue) => (ca.name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1)).map((item: Catalogue) => {
if (temp.length > 0) {
obj.children = temp // 使用 name 拼接 path todo: 有 bug ,需要修复
} if (path) {
result.push(obj) path.push(...path,item.name)
} }
return {
// isLeaf: (item.type && item.children.length === 0) ,
isLeaf: item.isLeaf ,
name: item.name,
parentId: item.parentId,
label: searchTreeNode(item.name, searchValue),
icon: (item.type && item.children.length === 0) && getTabIcon(item.type,20),
value: item.id,
path: path || [],
type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}</>,
fullInfo: item,
key: item.id,
id: item.id,
taskId: item.taskId,
children: buildProjectTree(item.children, searchValue , path),
} }
return result });
export const isUDF = (jobType: string) => {
return (jobType === 'Scala' || jobType === 'Python' || jobType === 'Java')
} }
export const loop:any= (data: TreeDataNode[],searchValue:string) => export const buildUDFTree = (data: []) => {
data?.map((item: any) => {
const index = item.title.indexOf(searchValue);
const beforeStr = item.name.substring(0, index);
const afterStr = item.name.substring(index + searchValue.length);
item.icon = getTabIcon(item.type,20); }
const title = \ No newline at end of file
index > -1 ? (
<span>
{beforeStr}
<span className={style['site-tree-search-value']}>{searchValue}</span>
{afterStr}
</span>
) : (
<div>
<span>{item.name}</span>
</div>
);
if (item.children) {
return {
isLeaf: item.isLeaf,
name: item.name,
id: item.id,
taskId: item.taskId,
type: item.type,
parentId: item.parentId,
path: item.path,
icon: item.isLeaf ? item.icon : '',
title,
key: item.key,
children: loop(item.children,searchValue)
};
}
return {
isLeaf: item.isLeaf,
name: item.name,
id: item.id,
taskId: item.taskId,
type: item.type,
parentId: item.parentId,
path: item.path,
icon: item.isLeaf ? item.icon : '',
title: title,
key: item.key,
};
});
...@@ -18,50 +18,384 @@ ...@@ -18,50 +18,384 @@
*/ */
import React, {useState} from "react"; import React, {Key, useEffect, useState} from "react";
import JobTree from "@/pages/DataStudio/LeftContainer/Project/JobTree"; import JobTree from "@/pages/DataStudio/LeftContainer/Project/JobTree";
import {connect} from "umi"; import {connect} from "umi";
import {StateType} from "@/pages/DataStudio/model"; import {StateType} from "@/pages/DataStudio/model";
import {getTaskDetails} from "@/pages/DataStudio/LeftContainer/Project/service"; import {getTaskDetails} from "@/pages/DataStudio/LeftContainer/Project/service";
import RightContextMenu from "@/components/RightContextMenu";
import {MenuInfo} from "rc-menu/es/interface";
import {FOLDER_RIGHT_MENU, JOB_RIGHT_MENU} from "@/pages/DataStudio/LeftContainer/Project/constants";
import {MenuItemType} from "antd/es/menu/hooks/useItems";
import {handleAddOrUpdate, handleOption, handlePutDataByParams, handleRemoveById} from "@/services/BusinessCrud";
import {Catalogue} from "@/types/Studio/data";
import {Modal, Typography} from "antd";
import {l} from "@/utils/intl";
import FolderModal from "@/pages/DataStudio/LeftContainer/Project/FolderModal";
import JobModal from "@/pages/DataStudio/LeftContainer/Project/JobModal";
import {SuccessMessage} from "@/utils/messages";
const {Text} = Typography;
const Project: React.FC = (props: connect) => { const Project: React.FC = (props: connect) => {
const {dispatch}=props const {dispatch} = props;
const [rightActiveKey, setRightActiveKey] = useState<string>('');
const onNodeClick = (info: any) => { const [cutId , setCutId] = useState<number>();
// 选中的key const [contextMenu, setContext] = useState<{
const {node: {isLeaf, name,type,parentId,path,key,taskId}} = info; visible: boolean;
if (isLeaf) { position: any;
// const queryParams = {id: selectDatabaseId , schemaName, tableName}; item: MenuItemType[];
getTaskDetails(taskId).then(res=>{ selectedKeys: Key[];
path.pop() isLeaf: boolean;
res['useResult']=true rightClickedNode?: any;
res['maxRowNum']=100 }>({
dispatch({ visible: false,
type: "Studio/addTab", position: {
payload: { position: 'fixed',
icon: type, cursor: 'context-menu',
id: parentId + name, width: '12vw',
breadcrumbLabel: path.join("/"), left: 0,
label: name , top: 0,
params:{taskId:taskId,taskData:res}, zIndex: 999, // 搞大点, 用来置顶
type: "project", },
subType: type.toLowerCase() isLeaf: false,
} item: [],
}) selectedKeys: [],
}) rightClickedNode: null,
});
const [modalAllVisible, setModalAllVisible] = useState<{
isCreateSub: boolean;
isEdit: boolean;
isRename: boolean;
isCreateTask: boolean;
isCut: boolean;
value: any;
}>({
isCreateSub: false,
isEdit: false,
isRename: false,
value: {},
isCreateTask: false,
isCut: false,
})
useEffect(() => {
setContext((prevState) => ({
...prevState,
item: prevState.isLeaf ? JOB_RIGHT_MENU(modalAllVisible.isCut && cutId !== undefined) : FOLDER_RIGHT_MENU(modalAllVisible.isCut && cutId !== undefined)
}))
}, [modalAllVisible.isCut,cutId])
/**
* the right click event
* @param info
*/
const handleRightClick = (info: any) => {
const {node: {isLeaf, key, fullInfo}, node, event} = info;
// 设置右键菜单
setContext((prevState) => ({
...prevState,
visible: true,
position: {
...prevState.position,
left: event.clientX + 10,
top: event.clientY + 5,
},
isLeaf: isLeaf,
selectedKeys: [key],
rightClickedNode: {...node, ...fullInfo},
item: isLeaf ? JOB_RIGHT_MENU(modalAllVisible.isCut) : FOLDER_RIGHT_MENU(modalAllVisible.isCut)
}))
setModalAllVisible((prevState) => ({...prevState, value: fullInfo}))
};
/**
* click the node event
* @param info
*/
const onNodeClick = (info: any) => {
// 选中的key
const {node: {isLeaf, name, type, parentId, path, key, taskId}} = info;
setContext((prevState) => ({
...prevState,
visible: false,
selectedKeys: [key],
}));
if (isLeaf) {
// const queryParams = {id: selectDatabaseId , schemaName, tableName};
getTaskDetails(taskId).then(res => {
path.pop()
dispatch({
type: "Studio/addTab",
payload: {
icon: type,
id: parentId + name,
breadcrumbLabel: path.join("/"),
label: name,
params: {taskId: taskId, taskData: {...res, useResult: true, maxRowNum: 100}},
type: "project",
subType: type.toLowerCase()
}
})
})
}
};
const handleContextCancel = () => {
setContext((prevState) => ({
...prevState,
visible: false,
}));
};
/**
* create or update sub folder
*/
const handleCreateSubFolder = () => {
setModalAllVisible((prevState) => ({...prevState, isCreateSub: true,}));
handleContextCancel();
};
/**
* 创建目录, 并刷新目录树
* @param {Catalogue} values
* @returns {Promise<void>}
*/
const handleSubmit = async (values: Catalogue) => {
let options = {
url: '',
isLeaf: modalAllVisible.isCreateSub ? false : modalAllVisible.value.isLeaf,
parentId: modalAllVisible.isCreateSub ? contextMenu.selectedKeys[0] : modalAllVisible.value.parentId,
}
if (rightActiveKey === 'createTask') {
options.url = '/api/catalogue/createTask'
options.parentId = modalAllVisible.isCreateTask && modalAllVisible.value.id
} else {
options.url = '/api/catalogue/saveOrUpdateCatalogue'
}
await handleAddOrUpdate(options.url, {
...values,
isLeaf: options.isLeaf,
parentId: options.parentId,
}, () => {
setModalAllVisible((prevState) => ({...prevState, isCreateSub: false, isRename: false, isEdit: false,isCreateTask: false,isCut: false}));
dispatch({type: 'Studio/queryProject'});
if (modalAllVisible.isRename) {
// todo: 如果是重命名/修改(修改了名字), 则需要 更新 tab 的 label
}
});
};
/**
* 删除目录, 并刷新目录树
* @param {MenuInfo} node
* @returns {Promise<void>}
*/
const handleDeleteSubmit = async () => {
const {key, isLeaf, name, type,taskId} = contextMenu.rightClickedNode;
handleContextCancel();
if (!isLeaf) {
await handleRemoveById('/api/catalogue/deleteCatalogueById', key, () => {
dispatch({type: 'Studio/queryProject'});
// TODO: 如果打开的 tag 中包含了这个 key 则更新 dav 的 tag 数据 删除此项 && 有一个 bug Dinky/src/pages/DataStudio/RightContainer/JobInfo/index.tsx:55 -> Cannot read properties of undefined (reading 'id')
});
} else {
const renderContent = () => {
return <>
<Text className={'needWrap'} type="danger">
{l('datastudio.project.delete.job.confirm')}
</Text>
</>
};
Modal.confirm({
title: l('datastudio.project.delete.job','',{type,name}),
width: '30%',
content: renderContent(),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
await handleRemoveById('/api/catalogue/deleteCatalogueById', key, () => {
// TODO: 如果打开的 tag 中包含了这个 key 则更新 dav 的 tag 数据 删除此项
dispatch({type: 'Studio/removeTag', payload: taskId});
dispatch({type: 'Studio/queryProject'});
});
},
});
}
} }
}
return ( /**
<div style={{paddingInline: 5}}> * rename handle
<JobTree onNodeClick={(info:any) => onNodeClick(info)} treeData={props.data}/> * @returns {Promise<void>}
</div> */
) const handleRename = async () => {
setModalAllVisible(prevState => ({...prevState, isRename: true}));
handleContextCancel();
}
/**
* create task handle
*/
const handleCreateTask = () => {
setModalAllVisible(prevState => ({...prevState, isCreateTask: true}));
handleContextCancel();
};
/**
* edit task handle
*/
const handleEdit = () => {
setModalAllVisible(prevState => ({...prevState, isEdit: true}));
handleContextCancel();
}
/**
* copy task handle and submit to server and refresh the tree
* @returns {Promise<void>}
*/
const handleCopy = async () => {
await handleOption('/api/catalogue/copyTask', l('right.menu.copy'),{
...modalAllVisible.value,
},()=>{
dispatch({type: 'Studio/queryProject'});
});
handleContextCancel();
}
/**
* cut task handle
* @returns {Promise<void>}
*/
const handleCut = async () => {
setModalAllVisible(prevState => ({...prevState, isCut: true}));
setCutId(contextMenu.rightClickedNode.key);
handleContextCancel();
}
/**
* paste task handle and submit to server and refresh the tree
* @returns {Promise<void>}
*/
const handlePaste = async () => {
await handlePutDataByParams('/api/catalogue/moveCatalogue', l('right.menu.paste'),{
originCatalogueId: cutId,
targetParentId: contextMenu.selectedKeys[0],
},()=>{
dispatch({type: 'Studio/queryProject'});
// 重置 cutId
setCutId(undefined);
setModalAllVisible(prevState => ({...prevState, isCut: false}));
});
handleContextCancel();
}
/**
* all context menu click handle
* @param {MenuInfo} node
* @returns {Promise<void>}
*/
const handleMenuClick = async (node: MenuInfo) => {
setRightActiveKey(node.key);
switch (node.key) {
case 'addSubFolder':
await handleCreateSubFolder();
break;
case 'createTask':
await handleCreateTask();
break;
case 'delete':
await handleDeleteSubmit();
break;
case 'renameFolder':
await handleRename();
break;
case 'edit':
await handleEdit();
break;
case 'exportJson':
// todo: 导出 json
// await handleCancel();
break;
case 'copy':
await handleCopy();
break;
case 'cut':
await handleCut();
break;
case 'paste':
await handlePaste();
break;
default:
await handleContextCancel();
break;
}
};
return (
<div style={{paddingInline: 5}}>
<JobTree selectedKeys={contextMenu.selectedKeys} onRightClick={handleRightClick}
onNodeClick={(info: any) => onNodeClick(info)} treeData={props.data}/>
<RightContextMenu
contextMenuPosition={contextMenu.position} open={contextMenu.visible}
openChange={() => setContext((prevState) => ({...prevState, visible: false}))} items={contextMenu.item}
onClick={handleMenuClick}
/>
{/* added sub folder */}
<FolderModal
title={l('right.menu.createSubFolder')}
values={{}}
modalVisible={modalAllVisible.isCreateSub}
onCancel={() => setModalAllVisible((prevState) => ({...prevState, isCreateSub: false,value: {}}))}
onSubmit={handleSubmit}
/>
{/* rename */}
<FolderModal
title={l('right.menu.rename')}
values={modalAllVisible.value}
modalVisible={modalAllVisible.isRename}
onCancel={() => setModalAllVisible((prevState) => ({...prevState, isRename: false,value: {}}))}
onSubmit={handleSubmit}
/>
{/* create task */}
<JobModal
title={l('right.menu.createTask')}
values={{}}
modalVisible={modalAllVisible.isCreateTask}
onCancel={() => setModalAllVisible((prevState) => ({...prevState, isCreateTask: false,value: {}}))}
onSubmit={handleSubmit}
/>
{/* edit task */}
{
Object.keys(modalAllVisible.value).length > 0 && <>
<JobModal
title={l('button.edit')}
values={modalAllVisible.value}
modalVisible={modalAllVisible.isEdit}
onCancel={() => setModalAllVisible((prevState) => ({...prevState, isEdit: false,value: {}}))}
onSubmit={handleSubmit}
/>
</>
}
</div>
)
}; };
export default connect(({Studio}: { Studio: StateType }) => ({ export default connect(({Studio}: { Studio: StateType }) => ({
data: Studio.project.data, data: Studio.project.data,
tabs: Studio.tabs,
}))(Project); }))(Project);
/*
*
* 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.
*
*/
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
} from "@/components/Icons/CodeLanguageIcon"; } from "@/components/Icons/CodeLanguageIcon";
import {ClickHouseIcons, DorisIcons, HiveIcons, MysqlIcons, OracleIcons, PhoenixIcons, import {ClickHouseIcons, DorisIcons, HiveIcons, MysqlIcons, OracleIcons, PhoenixIcons,
PostgresqlIcons, PrestoIcons, SqlServerIcons, StarRocksIcons} from "@/components/Icons/DBIcons"; PostgresqlIcons, PrestoIcons, SqlServerIcons, StarRocksIcons} from "@/components/Icons/DBIcons";
import {FolderOutlined} from "@ant-design/icons";
export const getTabIcon = (type: string, size?: number) => { export const getTabIcon = (type: string, size?: number) => {
if (!type){ if (!type){
......
...@@ -26,26 +26,20 @@ import {l} from "@/utils/intl"; ...@@ -26,26 +26,20 @@ import {l} from "@/utils/intl";
import {Drawer} from "antd"; import {Drawer} from "antd";
import {ProDescriptionsItemProps} from "@ant-design/pro-descriptions"; import {ProDescriptionsItemProps} from "@ant-design/pro-descriptions";
import {postAll} from "@/services/api"; import {postAll} from "@/services/api";
import {SavePoint} from "@/types/Studio/data";
const url = '/api/savepoints'; const url = '/api/savepoints';
export type SavePointTableListItem = {
id: number,
taskId: number,
name: string,
type: string,
path: string,
createTime: Date,
};
const SavePoints = (props: any) => { const SavePoints = (props: any) => {
const { tabs: {panes, activeKey}} = props; const { tabs: {panes, activeKey}} = props;
const current = getCurrentData(panes, activeKey); const current = getCurrentData(panes, activeKey);
const [row, setRow] = useState<SavePointTableListItem>(); const [row, setRow] = useState<SavePoint>();
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
actionRef.current?.reloadAndRest?.(); actionRef.current?.reloadAndRest?.();
const columns: ProDescriptionsItemProps<SavePointTableListItem>[] = [ const columns: ProDescriptionsItemProps<SavePoint>[] = [
{ {
title: l('pages.task.savePointPath'), title: l('pages.task.savePointPath'),
...@@ -67,7 +61,7 @@ const SavePoints = (props: any) => { ...@@ -67,7 +61,7 @@ const SavePoints = (props: any) => {
return ( return (
<> <>
<ProTable<SavePointTableListItem> <ProTable<SavePoint>
actionRef={actionRef} actionRef={actionRef}
rowKey="id" rowKey="id"
request={(params, sorter, filter) => postAll(url, {taskId: current.key, ...params, sorter, filter})} request={(params, sorter, filter) => postAll(url, {taskId: current.key, ...params, sorter, filter})}
...@@ -83,7 +77,7 @@ const SavePoints = (props: any) => { ...@@ -83,7 +77,7 @@ const SavePoints = (props: any) => {
closable={false} closable={false}
> >
{row?.name && ( {row?.name && (
<ProDescriptions<SavePointTableListItem> <ProDescriptions<SavePoint>
column={2} column={2}
title={row?.name} title={row?.name}
request={async () => ({ request={async () => ({
......
...@@ -252,6 +252,7 @@ export type ModelType = { ...@@ -252,6 +252,7 @@ export type ModelType = {
saveProject: Reducer<StateType>; saveProject: Reducer<StateType>;
updateTabsActiveKey: Reducer<StateType>; updateTabsActiveKey: Reducer<StateType>;
closeTab: Reducer<StateType>; closeTab: Reducer<StateType>;
removeTag: Reducer<StateType>;
addTab: Reducer<StateType>; addTab: Reducer<StateType>;
saveTabs: Reducer<StateType>; saveTabs: Reducer<StateType>;
closeAllTabs: Reducer<StateType>; closeAllTabs: Reducer<StateType>;
...@@ -537,6 +538,37 @@ const Model: ModelType = { ...@@ -537,6 +538,37 @@ const Model: ModelType = {
} }
}; };
}, },
/**
* 移除标签
* @param {StateType} state
* @param {any} payload
* @returns {{centerContentHeight: number, tabs: {panes: TabsItemType[], activeBreadcrumbTitle: string, activeKey: string}, project: {data: any[], expandKeys: [], selectKey: []}, leftContainer: Container, env: EnvType[], footContainer: {codeType: string, jobRunningMsg: JobRunningMsgType, codeEncoding: string, memDetails: string, lineSeparator: string, space: number, codePosition: [number, number]}, clusterConfiguration: Cluster.Config[], toolContentHeight: number, database: {dbData: DataSources.DataSource[], selectDatabaseId: number | null, expandKeys: [], selectKey: []}, sessionCluster: Cluster.Instance[], isFullScreen: boolean, rightContainer: Container, bottomContainerContent: BottomContainerContent, bottomContainer: Container}}
*/
removeTag(state, {payload}) {
const needRemoveKey = payload
const {tabs: {panes, activeKey}} = state;
const index = panes.findIndex((item,index)=> {
const params = item.params as DataStudioParams;
return params.taskId === needRemoveKey
})
// 关闭 传过来的key
if (index !== -1) {
panes.splice(index, 1);
}
const newActiveKey = activeKey === needRemoveKey ? panes[panes.length - 1].key : activeKey;
return {
...state,
tabs: {
...state.tabs,
panes: panes,
activeKey: newActiveKey,
}
}
},
/** /**
* 关闭tab * 关闭tab
* @param {StateType} state * @param {StateType} state
......
...@@ -30,7 +30,7 @@ import { ...@@ -30,7 +30,7 @@ import {
HistoryOutlined, HistoryOutlined,
InfoCircleOutlined, InfoCircleOutlined,
MonitorOutlined, MonitorOutlined,
PlayCircleOutlined, PlayCircleOutlined, PlusCircleOutlined, PlusCircleTwoTone,
ReloadOutlined, ReloadOutlined,
RightSquareOutlined, RightSquareOutlined,
SettingOutlined, ShrinkOutlined, SettingOutlined, ShrinkOutlined,
...@@ -213,6 +213,12 @@ export const BtnRoute: { [c:string]:CircleButtonProps[] } = { ...@@ -213,6 +213,12 @@ export const BtnRoute: { [c:string]:CircleButtonProps[] } = {
} }
], ],
'menu.datastudio.project':[ 'menu.datastudio.project':[
{
icon: <PlusCircleOutlined />,
title: l('right.menu.createRoot'),
key: 'right.menu.createRoot',
onClick: ()=>{}
},
{ {
icon: <ArrowsAltOutlined />, icon: <ArrowsAltOutlined />,
title: l('button.expand-all'), title: l('button.expand-all'),
......
...@@ -113,13 +113,15 @@ export const handleAddOrUpdate = async (url: string, params: any, afterCallBack? ...@@ -113,13 +113,15 @@ export const handleAddOrUpdate = async (url: string, params: any, afterCallBack?
* delete by id * delete by id
* @param url * @param url
* @param id * @param id
* @param afterCallBack
*/ */
export const handleRemoveById = async (url: string, id: number) => { export const handleRemoveById = async (url: string, id: number, afterCallBack?: ()=>void) => {
await LoadingMessageAsync(l('app.request.delete')); await LoadingMessageAsync(l('app.request.delete'));
try { try {
const {code, msg} = await removeById(url, {id}); const {code, msg} = await removeById(url, {id});
if (code === RESPONSE_CODE.SUCCESS) { if (code === RESPONSE_CODE.SUCCESS) {
await SuccessMessage(msg); await SuccessMessage(msg);
afterCallBack && afterCallBack();
} else { } else {
await WarningMessage(msg); await WarningMessage(msg);
} }
...@@ -170,12 +172,13 @@ export const updateEnabled = async (url: string, params: any) => { ...@@ -170,12 +172,13 @@ export const updateEnabled = async (url: string, params: any) => {
export const handleOption = async (url: string, title: string, param: any) => { export const handleOption = async (url: string, title: string, param: any, afterCallBack?: ()=>void) => {
await LoadingMessageAsync(l('app.request.running') + title); await LoadingMessageAsync(l('app.request.running') + title);
try { try {
const result = await postAll(url, param); const result = await postAll(url, param);
if (result.code === RESPONSE_CODE.SUCCESS) { if (result.code === RESPONSE_CODE.SUCCESS) {
SuccessMessage(result.msg); SuccessMessage(result.msg);
afterCallBack && afterCallBack();
return result; return result;
} else { } else {
WarningMessage(result.msg); WarningMessage(result.msg);
...@@ -266,12 +269,13 @@ export const queryDataByParams = async (url: string, params?: any) => { ...@@ -266,12 +269,13 @@ export const queryDataByParams = async (url: string, params?: any) => {
}; };
export const handlePutDataByParams = async (url: string, title: string, params: any) => { export const handlePutDataByParams = async (url: string, title: string, params: any,afterCallBack?: ()=> void) => {
await LoadingMessageAsync(l('app.request.running') + title); await LoadingMessageAsync(l('app.request.running') + title);
try { try {
const {code, msg} = await putData(url, {...params}); const {code, msg} = await putData(url, {...params});
if (code === RESPONSE_CODE.SUCCESS) { if (code === RESPONSE_CODE.SUCCESS) {
await SuccessMessage(msg); await SuccessMessage(msg);
afterCallBack && afterCallBack();
return true; return true;
} else { } else {
await WarningMessage(msg); await WarningMessage(msg);
......
...@@ -179,6 +179,7 @@ export const API_CONSTANTS = { ...@@ -179,6 +179,7 @@ export const API_CONSTANTS = {
UDF_TEMPLATE_DELETE: "/api/udf/template/delete", UDF_TEMPLATE_DELETE: "/api/udf/template/delete",
// UDF template enable or disable // UDF template enable or disable
UDF_TEMPLATE_ENABLE: "/api/udf/template/enable", UDF_TEMPLATE_ENABLE: "/api/udf/template/enable",
UDF_TEMPLATE_TREE: '/api/udf/template/tree',
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
export type Catalogue = { export type Catalogue = {
id: number; id: number;
name: string; name: string;
...@@ -27,4 +28,55 @@ export type Catalogue = { ...@@ -27,4 +28,55 @@ export type Catalogue = {
isLeaf: boolean; isLeaf: boolean;
createTime: Date; createTime: Date;
updateTime: Date; updateTime: Date;
} children: Catalogue[];
\ No newline at end of file configJson: Object<string, object>;
task: Task;
};
export type Task = {
id: number;
name: string;
dialect: string;
tenantId: number;
type: string;
checkPoint: number;
savePointStrategy: number;
savePointPath: string;
parallelism: number;
fragment: boolean;
statementSet: boolean;
batchModel: boolean;
clusterId: number;
clusterConfigurationId: number;
databaseId: number;
jarId: number;
envId: number;
alertGroupId: number;
note: string;
step: number;
jobInstanceId: number;
versionId: number;
statement: string;
clusterName: string;
savePoints: SavePoint[];
configJson: Object<string, object>;
path: string;
jarName: string;
clusterConfigurationName: string;
databaseName: string;
envName: string;
alertGroupName: string;
createTime: Date;
updateTime: Date;
};
export type SavePoint = {
id: number,
taskId: number,
name: string,
type: string,
path: string,
createTime: Date,
};
\ No newline at end of file
/*
* 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.
*/
const localStorageMock = {
getItem: jest.fn(),
setItem: jest.fn(),
removeItem: jest.fn(),
clear: jest.fn(),
};
global.localStorage = localStorageMock;
Object.defineProperty(URL, 'createObjectURL', {
writable: true,
value: jest.fn(),
});
class Worker {
constructor(stringUrl) {
this.url = stringUrl;
this.onmessage = () => {};
}
postMessage(msg) {
this.onmessage(msg);
}
}
window.Worker = Worker;
/* eslint-disable global-require */
if (typeof window !== 'undefined') {
// ref: https://github.com/ant-design/ant-design/issues/18774
if (!window.matchMedia) {
Object.defineProperty(global.window, 'matchMedia', {
writable: true,
configurable: true,
value: jest.fn(() => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
})),
});
}
if (!window.matchMedia) {
Object.defineProperty(global.window, 'matchMedia', {
writable: true,
configurable: true,
value: jest.fn((query) => ({
matches: query.includes('max-width'),
addListener: jest.fn(),
removeListener: jest.fn(),
})),
});
}
}
const errorLog = console.error;
Object.defineProperty(global.window.console, 'error', {
writable: true,
configurable: true,
value: (...rest) => {
const logStr = rest.join('');
if (logStr.includes('Warning: An update to %s inside a test was not wrapped in act(...)')) {
return;
}
errorLog(...rest);
},
});
{
"GET /api/currentUser": {
"res": {
"data": {
"name": "Serati Ma",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"userid": "00000001",
"email": "antdesign@alipay.com",
"signature": "海纳百川,有容乃大",
"title": "交互专家",
"group": "蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED",
"tags": [
{
"key": "0",
"label": "很有想法的"
},
{
"key": "1",
"label": "专注设计"
},
{
"key": "2",
"label": "辣~"
},
{
"key": "3",
"label": "大长腿"
},
{
"key": "4",
"label": "川妹子"
},
{
"key": "5",
"label": "海纳百川"
}
],
"notifyCount": 12,
"unreadCount": 11,
"country": "China",
"geographic": {
"province": {
"label": "浙江省",
"key": "330000"
},
"city": {
"label": "杭州市",
"key": "330100"
}
},
"address": "西湖区工专路 77 号",
"phone": "0752-268888888"
}
},
"query": {
"token ": " 123"
},
"payload": {},
"types": "/** GET /api/currentUser */\nexport type GET_API_CURRENT_USER_QUERY = {\n /** example: 123 */\n token : string\n}\n \n\nexport type GET_API_CURRENT_USER_PAYLOAD = {\n \n}\n \n\nexport type GET_API_CURRENT_USER_RES = {\n /** example: {\"name\": \"Serati Ma\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png\", \"userid\": \"00000001\", \"email\": \"antdesign@alipay.com\", \"signature\": \"海纳百川,有容乃大\", \"title\": \"交互专家\", \"group\": \"蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED\", \"tags\": [{\"key\": \"0\", \"label\": \"很有想法的\"}, {\"key\": \"1\", \"label\": \"专注设计\"}, {\"key\": \"2\", \"label\": \"辣~\"}, {\"key\": \"3\", \"label\": \"大长腿\"}, {\"key\": \"4\", \"label\": \"川妹子\"}, {\"key\": \"5\", \"label\": \"海纳百川\"}], \"notifyCount\": 12, \"unreadCount\": 11, \"country\": \"China\", \"geographic\": {\"province\": {\"label\": \"浙江省\", \"key\": \"330000\"}, \"city\": {\"label\": \"杭州市\", \"key\": \"330100\"}}, \"address\": \"西湖区工专路 77 号\", \"phone\": \"0752-268888888\"} */\n data: {\n name: string,\navatar: string,\nuserid: string,\nemail: string,\nsignature: string,\ntitle: string,\ngroup: string,\ntags: {\n key: string,\nlabel: string\n }[],\nnotifyCount: number,\nunreadCount: number,\ncountry: string,\ngeographic: {\n province: {\n label: string,\nkey: string\n },\ncity: {\n label: string,\nkey: string\n }\n },\naddress: string,\nphone: string\n }\n}\n "
},
"GET /api/rule": {
"res": {
"data": [
{
"key": 99,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 99",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 503,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 81
},
{
"key": 98,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 98",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 164,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 12
},
{
"key": 97,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 97",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 174,
"status": "1",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 81
},
{
"key": 96,
"disabled": true,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 96",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 914,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 7
},
{
"key": 95,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 95",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 698,
"status": "2",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 82
},
{
"key": 94,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 94",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 488,
"status": "1",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 14
},
{
"key": 93,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 93",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 580,
"status": "2",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 77
},
{
"key": 92,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 92",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 244,
"status": "3",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 58
},
{
"key": 91,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 91",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 959,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 66
},
{
"key": 90,
"disabled": true,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 90",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 958,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 72
},
{
"key": 89,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 89",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 301,
"status": "2",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 2
},
{
"key": 88,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 88",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 277,
"status": "1",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 12
},
{
"key": 87,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 87",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 810,
"status": "1",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 82
},
{
"key": 86,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 86",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 780,
"status": "3",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 22
},
{
"key": 85,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 85",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 705,
"status": "3",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 12
},
{
"key": 84,
"disabled": true,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 84",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 203,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 79
},
{
"key": 83,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 83",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 491,
"status": "2",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 59
},
{
"key": 82,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 82",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 73,
"status": "0",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 100
},
{
"key": 81,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png",
"name": "TradeCode 81",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 406,
"status": "3",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 61
},
{
"key": 80,
"disabled": false,
"href": "https://ant.design",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png",
"name": "TradeCode 80",
"owner": "曲丽丽",
"desc": "这是一段描述",
"callNo": 112,
"status": "2",
"updatedAt": "2022-12-06T05:00:57.040Z",
"createdAt": "2022-12-06T05:00:57.040Z",
"progress": 20
}
],
"total": 100,
"success": true,
"pageSize": 20,
"current": 1
},
"query": {
"token ": " 123",
"current": "1",
"pageSize": "20"
},
"payload": {},
"types": "/** GET /api/rule */\nexport type GET_API_RULE_QUERY = {\n /** example: 123 */\n token : string;\n /** example: 1 */\n current: string;\n /** example: 20 */\n pageSize: string\n}\n \n\nexport type GET_API_RULE_PAYLOAD = {\n \n}\n \n\nexport type GET_API_RULE_RES = {\n /** example: [{\"key\": 99, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 99\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 503, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 81}, {\"key\": 98, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 98\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 164, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 12}, {\"key\": 97, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 97\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 174, \"status\": \"1\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 81}, {\"key\": 96, \"disabled\": true, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 96\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 914, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 7}, {\"key\": 95, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 95\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 698, \"status\": \"2\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 82}, {\"key\": 94, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 94\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 488, \"status\": \"1\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 14}, {\"key\": 93, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 93\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 580, \"status\": \"2\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 77}, {\"key\": 92, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 92\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 244, \"status\": \"3\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 58}, {\"key\": 91, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 91\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 959, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 66}, {\"key\": 90, \"disabled\": true, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 90\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 958, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 72}, {\"key\": 89, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 89\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 301, \"status\": \"2\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 2}, {\"key\": 88, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 88\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 277, \"status\": \"1\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 12}, {\"key\": 87, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 87\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 810, \"status\": \"1\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 82}, {\"key\": 86, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 86\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 780, \"status\": \"3\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 22}, {\"key\": 85, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 85\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 705, \"status\": \"3\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 12}, {\"key\": 84, \"disabled\": true, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 84\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 203, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 79}, {\"key\": 83, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 83\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 491, \"status\": \"2\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 59}, {\"key\": 82, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 82\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 73, \"status\": \"0\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 100}, {\"key\": 81, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png\", \"name\": \"TradeCode 81\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 406, \"status\": \"3\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 61}, {\"key\": 80, \"disabled\": false, \"href\": \"https: //ant.design\", \"avatar\": \"https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png\", \"name\": \"TradeCode 80\", \"owner\": \"曲丽丽\", \"desc\": \"这是一段描述\", \"callNo\": 112, \"status\": \"2\", \"updatedAt\": \"2022-12-06T05: 00: 57.040Z\", \"createdAt\": \"2022-12-06T05: 00: 57.040Z\", \"progress\": 20}] */\n data: {\n key: number,\ndisabled: boolean,\nhref: string,\navatar: string,\nname: string,\nowner: string,\ndesc: string,\ncallNo: number,\nstatus: string,\nupdatedAt: string,\ncreatedAt: string,\nprogress: number\n }[];\n /** example: 100 */\n total: number;\n /** example: true */\n success: boolean;\n /** example: 20 */\n pageSize: number;\n /** example: 1 */\n current: number\n}\n "
},
"POST /api/login/outLogin": {
"res": {
"data": {},
"success": true
},
"query": {
"token ": " 123"
},
"payload": {},
"types": "/** POST /api/login/outLogin */\nexport type POST_API_LOGIN_OUT_LOGIN_QUERY = {\n /** example: 123 */\n token : string\n}\n \n\nexport type POST_API_LOGIN_OUT_LOGIN_PAYLOAD = {\n \n}\n \n\nexport type POST_API_LOGIN_OUT_LOGIN_RES = {\n /** example: {} */\n data: {\n \n };\n /** example: true */\n success: boolean\n}\n "
},
"POST /api/login/account": {
"res": {
"status": "ok",
"type": "account",
"currentAuthority": "admin"
},
"query": {
"token ": " 123"
},
"payload": {
"username": "admin",
"password": "ant.design",
"autoLogin": true,
"type": "account"
},
"types": "/** POST /api/login/account */\nexport type POST_API_LOGIN_ACCOUNT_QUERY = {\n /** example: 123 */\n token : string\n}\n \n\nexport type POST_API_LOGIN_ACCOUNT_PAYLOAD = {\n /** example: admin */\n username: string;\n /** example: ant.design */\n password: string;\n /** example: true */\n autoLogin: boolean;\n /** example: account */\n type: string\n}\n \n\nexport type POST_API_LOGIN_ACCOUNT_RES = {\n /** example: ok */\n status: string;\n /** example: account */\n type: string;\n /** example: admin */\n currentAuthority: string\n}\n "
}
}
/*
* 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.
*/
module.exports = {
'GET /api/currentUser': {
data: {
name: 'Serati Ma',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
userid: '00000001',
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },
{ key: '2', label: '辣~' },
{ key: '3', label: '大长腿' },
{ key: '4', label: '川妹子' },
{ key: '5', label: '海纳百川' },
],
notifyCount: 12,
unreadCount: 11,
country: 'China',
geographic: {
province: { label: '浙江省', key: '330000' },
city: { label: '杭州市', key: '330100' },
},
address: '西湖区工专路 77 号',
phone: '0752-268888888',
},
},
'GET /api/rule': {
data: [
{
key: 99,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 99',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 503,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 98,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 98',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 164,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 97,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 97',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 174,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 96,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 96',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 914,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 7,
},
{
key: 95,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 95',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 698,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 94,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 94',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 488,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 14,
},
{
key: 93,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 93',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 580,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 77,
},
{
key: 92,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 92',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 244,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 58,
},
{
key: 91,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 91',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 959,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 66,
},
{
key: 90,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 90',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 958,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 72,
},
{
key: 89,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 89',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 301,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 2,
},
{
key: 88,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 88',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 277,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 87,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 87',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 810,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 86,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 86',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 780,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 22,
},
{
key: 85,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 85',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 705,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 84,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 84',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 203,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 79,
},
{
key: 83,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 83',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 491,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 59,
},
{
key: 82,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 82',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 73,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 100,
},
{
key: 81,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 81',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 406,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 61,
},
{
key: 80,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 80',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 112,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 20,
},
],
total: 100,
success: true,
pageSize: 20,
current: 1,
},
'POST /api/login/outLogin': { data: {}, success: true },
'POST /api/login/account': {
status: 'ok',
type: 'account',
currentAuthority: 'admin',
},
};
/*
* 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.
*/
/*
* 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.
*/
export namespace API {
/** GET /api/currentUser */
export type GET_API_CURRENT_USER_QUERY = {
/** example: 123 */
token: string;
};
export type GET_API_CURRENT_USER_PAYLOAD = Record<string, any>;
export type GET_API_CURRENT_USER_RES = {
/** example: {"name": "Serati Ma", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", "userid": "00000001", "email": "antdesign@alipay.com", "signature": "海纳百川,有容乃大", "title": "交互专家", "group": "蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED", "tags": [{"key": "0", "label": "很有想法的"}, {"key": "1", "label": "专注设计"}, {"key": "2", "label": "辣~"}, {"key": "3", "label": "大长腿"}, {"key": "4", "label": "川妹子"}, {"key": "5", "label": "海纳百川"}], "notifyCount": 12, "unreadCount": 11, "country": "China", "geographic": {"province": {"label": "浙江省", "key": "330000"}, "city": {"label": "杭州市", "key": "330100"}}, "address": "西湖区工专路 77 号", "phone": "0752-268888888"} */
data: {
name: string;
avatar: string;
userid: string;
email: string;
signature: string;
title: string;
group: string;
tags: {
key: string;
label: string;
}[];
notifyCount: number;
unreadCount: number;
country: string;
geographic: {
province: {
label: string;
key: string;
};
city: {
label: string;
key: string;
};
};
address: string;
phone: string;
};
};
/** GET /api/rule */
export type GET_API_RULE_QUERY = {
/** example: 123 */
token: string;
/** example: 1 */
current: string;
/** example: 20 */
pageSize: string;
};
export type GET_API_RULE_PAYLOAD = Record<string, any>;
export type GET_API_RULE_RES = {
/** example: [{"key": 99, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 99", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 503, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 81}, {"key": 98, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 98", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 164, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 12}, {"key": 97, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 97", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 174, "status": "1", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 81}, {"key": 96, "disabled": true, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 96", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 914, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 7}, {"key": 95, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 95", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 698, "status": "2", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 82}, {"key": 94, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 94", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 488, "status": "1", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 14}, {"key": 93, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 93", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 580, "status": "2", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 77}, {"key": 92, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 92", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 244, "status": "3", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 58}, {"key": 91, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 91", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 959, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 66}, {"key": 90, "disabled": true, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 90", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 958, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 72}, {"key": 89, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 89", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 301, "status": "2", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 2}, {"key": 88, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 88", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 277, "status": "1", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 12}, {"key": 87, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 87", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 810, "status": "1", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 82}, {"key": 86, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 86", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 780, "status": "3", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 22}, {"key": 85, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 85", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 705, "status": "3", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 12}, {"key": 84, "disabled": true, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 84", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 203, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 79}, {"key": 83, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 83", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 491, "status": "2", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 59}, {"key": 82, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 82", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 73, "status": "0", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 100}, {"key": 81, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png", "name": "TradeCode 81", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 406, "status": "3", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 61}, {"key": 80, "disabled": false, "href": "https: //ant.design", "avatar": "https: //gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png", "name": "TradeCode 80", "owner": "曲丽丽", "desc": "这是一段描述", "callNo": 112, "status": "2", "updatedAt": "2022-12-06T05: 00: 57.040Z", "createdAt": "2022-12-06T05: 00: 57.040Z", "progress": 20}] */
data: {
key: number;
disabled: boolean;
href: string;
avatar: string;
name: string;
owner: string;
desc: string;
callNo: number;
status: string;
updatedAt: string;
createdAt: string;
progress: number;
}[];
/** example: 100 */
total: number;
/** example: true */
success: boolean;
/** example: 20 */
pageSize: number;
/** example: 1 */
current: number;
};
/** POST /api/login/outLogin */
export type POST_API_LOGIN_OUT_LOGIN_QUERY = {
/** example: 123 */
token: string;
};
export type POST_API_LOGIN_OUT_LOGIN_PAYLOAD = Record<string, any>;
export type POST_API_LOGIN_OUT_LOGIN_RES = {
/** example: {} */
data: Record<string, any>;
/** example: true */
success: boolean;
};
/** POST /api/login/account */
export type POST_API_LOGIN_ACCOUNT_QUERY = {
/** example: 123 */
token: string;
};
export type POST_API_LOGIN_ACCOUNT_PAYLOAD = {
/** example: admin */
username: string;
/** example: ant.design */
password: string;
/** example: true */
autoLogin: boolean;
/** example: account */
type: string;
};
export type POST_API_LOGIN_ACCOUNT_RES = {
/** example: ok */
status: string;
/** example: account */
type: string;
/** example: admin */
currentAuthority: string;
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment