[feature][API]feature: add task type list and enable user to add task type to fav (#11727)
* feature: add task type list and enable user to add task type to fav * make DependentExecute.java variable protected * add standalone server fileSet
This commit is contained in:
parent
f95cdd350a
commit
b3cc8a55b9
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.configuration;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.dolphinscheduler.api.dto.FavTaskDto;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.config.YamlPropertySourceFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
@EnableConfigurationProperties
|
||||
@PropertySource(value = {"classpath:task-type-config.yaml"}, factory = YamlPropertySourceFactory.class)
|
||||
@ConfigurationProperties(prefix = "task")
|
||||
@Getter
|
||||
@Setter
|
||||
public class TaskTypeConfiguration {
|
||||
|
||||
private List<String> universal;
|
||||
private List<String> cloud;
|
||||
private List<String> logic;
|
||||
private List<String> dataIntegration;
|
||||
private List<String> dataQuality;
|
||||
private List<String> other;
|
||||
|
||||
private List<String> machineLearning;
|
||||
|
||||
public Set<FavTaskDto> getDefaultTaskTypes() {
|
||||
Set<FavTaskDto> defaultTaskTypes = new HashSet<>();
|
||||
if (defaultTaskTypes.size() <= 0) {
|
||||
universal.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_UNIVERSAL)));
|
||||
cloud.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_CLOUD)));
|
||||
logic.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_LOGIC)));
|
||||
dataIntegration.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_DATA_INTEGRATION)));
|
||||
dataQuality.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_DATA_QUALITY)));
|
||||
machineLearning.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_MACHINE_LEARNING)));
|
||||
other.forEach(task -> defaultTaskTypes.add(new FavTaskDto(task, false, Constants.TYPE_OTHER)));
|
||||
|
||||
}
|
||||
|
||||
return defaultTaskTypes;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
|
||||
import org.apache.dolphinscheduler.api.dto.FavTaskDto;
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.exceptions.ApiException;
|
||||
import org.apache.dolphinscheduler.api.service.FavTaskService;
|
||||
import org.apache.dolphinscheduler.api.utils.Result;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.dolphinscheduler.api.enums.Status.ADD_TASK_TYPE_ERROR;
|
||||
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_TASK_TYPE_ERROR;
|
||||
import static org.apache.dolphinscheduler.api.enums.Status.LIST_TASK_TYPE_ERROR;
|
||||
|
||||
/**
|
||||
* fav controller
|
||||
*/
|
||||
@Api(tags = "FAVOURITE")
|
||||
@RestController
|
||||
@RequestMapping("/favourite")
|
||||
public class FavTaskController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private FavTaskService favTaskService;
|
||||
|
||||
/**
|
||||
* get task type list
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @return task type list
|
||||
*/
|
||||
@ApiOperation(value = "listTaskType", notes = "LIST_TASK_TYPE")
|
||||
@GetMapping(value = "/taskTypes")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ApiException(LIST_TASK_TYPE_ERROR)
|
||||
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
|
||||
public Result listTaskType(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
|
||||
List<FavTaskDto> favTaskList = favTaskService.getFavTaskList(loginUser);
|
||||
return success(Status.SUCCESS.getMsg(), favTaskList);
|
||||
}
|
||||
|
||||
/**
|
||||
* delete task fav
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "deleteTaskType", notes = "DELETE_TASK_TYPE")
|
||||
@DeleteMapping(value = "/{taskName}")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ApiException(DELETE_TASK_TYPE_ERROR)
|
||||
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
|
||||
public Result deleteFavTask(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
|
||||
@PathVariable("taskName") String taskName) {
|
||||
boolean b = favTaskService.deleteFavTask(loginUser, taskName);
|
||||
return success(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* add task fav
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "addTaskType", notes = "ADD_TASK_TYPE")
|
||||
@PostMapping(value = "/{taskName}")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ApiException(ADD_TASK_TYPE_ERROR)
|
||||
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
|
||||
public Result addFavTask(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
|
||||
@PathVariable("taskName") String taskName) {
|
||||
int i = favTaskService.addFavTask(loginUser, taskName);
|
||||
return success(i > 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class FavTaskDto {
|
||||
|
||||
private String taskName;
|
||||
private boolean isCollection;
|
||||
private String taskType;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FavTaskDto) {
|
||||
FavTaskDto favDto = (FavTaskDto) obj;
|
||||
return this.taskName.equals(favDto.getTaskName());
|
||||
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
package org.apache.dolphinscheduler.api.enums;
|
||||
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
/**
|
||||
* status enum // todo #4855 One category one interval
|
||||
*/
|
||||
|
|
@ -222,6 +222,9 @@ public enum Status {
|
|||
TASK_WITH_DEPENDENT_ERROR(10195, "task used in other tasks", "删除被其他任务引用"),
|
||||
TASK_SAVEPOINT_ERROR(10196, "task savepoint error", "任务实例savepoint错误"),
|
||||
TASK_STOP_ERROR(10197, "task stop error", "任务实例停止错误"),
|
||||
LIST_TASK_TYPE_ERROR(10200, "list task type error", "查询任务类型列表错误"),
|
||||
DELETE_TASK_TYPE_ERROR(10200, "delete task type error", "删除任务类型错误"),
|
||||
ADD_TASK_TYPE_ERROR(10200, "add task type error", "添加任务类型错误"),
|
||||
|
||||
UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"),
|
||||
UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
import org.apache.dolphinscheduler.api.dto.FavTaskDto;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FavTaskService {
|
||||
|
||||
List<FavTaskDto> getFavTaskList(User loginUser);
|
||||
|
||||
boolean deleteFavTask(User loginUser, String taskName);
|
||||
|
||||
int addFavTask(User loginUser, String taskName);
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.service.impl;
|
||||
|
||||
import org.apache.dolphinscheduler.api.configuration.TaskTypeConfiguration;
|
||||
import org.apache.dolphinscheduler.api.dto.FavTaskDto;
|
||||
import org.apache.dolphinscheduler.api.service.FavTaskService;
|
||||
import org.apache.dolphinscheduler.dao.entity.FavTask;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
import org.apache.dolphinscheduler.dao.mapper.FavTaskMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class FavTaskServiceImpl extends BaseServiceImpl implements FavTaskService {
|
||||
|
||||
@Resource
|
||||
private TaskTypeConfiguration taskTypeConfiguration;
|
||||
@Resource
|
||||
private FavTaskMapper favMapper;
|
||||
|
||||
@Override
|
||||
public List<FavTaskDto> getFavTaskList(User loginUser) {
|
||||
List<FavTaskDto> result = new ArrayList<>();
|
||||
Set<String> userFavTaskTypes = favMapper.getUserFavTaskTypes(loginUser.getId());
|
||||
|
||||
Set<FavTaskDto> defaultTaskTypes = taskTypeConfiguration.getDefaultTaskTypes();
|
||||
defaultTaskTypes.forEach(e -> {
|
||||
if (userFavTaskTypes.contains(e.getTaskName())) {
|
||||
e.setCollection(true);
|
||||
}
|
||||
result.add(e);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFavTask(User loginUser, String taskName) {
|
||||
return favMapper.deleteUserFavTask(loginUser.getId(), taskName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addFavTask(User loginUser, String taskName) {
|
||||
favMapper.deleteUserFavTask(loginUser.getId(), taskName);
|
||||
return favMapper.insert(new FavTask(null, taskName, loginUser.getId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
task:
|
||||
universal:
|
||||
- 'SHELL'
|
||||
- 'PYTHON'
|
||||
- 'PROCEDURE'
|
||||
- 'SQL'
|
||||
- 'SPARK'
|
||||
- 'FLINK'
|
||||
- 'HTTP'
|
||||
- 'MR'
|
||||
- 'DINKY'
|
||||
- 'FLINK_STREAM'
|
||||
- 'HIVECLI'
|
||||
cloud:
|
||||
- 'EMR'
|
||||
- 'K8S'
|
||||
logic:
|
||||
- 'SUB_PROCESS'
|
||||
- 'DEPENDENT'
|
||||
- 'CONDITIONS'
|
||||
- 'SWITCH'
|
||||
- 'NEXT_LOOP'
|
||||
- 'SURVEIL'
|
||||
dataIntegration:
|
||||
- 'SEATUNNEL'
|
||||
- 'DATAX'
|
||||
- 'SQOOP'
|
||||
dataQuality:
|
||||
- 'DATA_QUALITY'
|
||||
machineLearning:
|
||||
- 'JUPYTER'
|
||||
- 'MLFLOW'
|
||||
- 'OPENMLDB'
|
||||
- 'DVC'
|
||||
- 'SAGEMAKER'
|
||||
- 'PYTORCH'
|
||||
other:
|
||||
- 'PIGEON'
|
||||
- 'ZEPPELIN'
|
||||
- 'CHUNJUN'
|
||||
|
|
@ -845,4 +845,14 @@ public final class Constants {
|
|||
public static final String SECURITY_CONFIG_TYPE_PASSWORD = "PASSWORD";
|
||||
|
||||
public static final String SECURITY_CONFIG_TYPE_LDAP = "LDAP";
|
||||
/**
|
||||
* Task Types
|
||||
*/
|
||||
public static final String TYPE_UNIVERSAL = "Universal";
|
||||
public static final String TYPE_DATA_INTEGRATION = "DataIntegration";
|
||||
public static final String TYPE_CLOUD = "Cloud";
|
||||
public static final String TYPE_LOGIC = "Logic";
|
||||
public static final String TYPE_DATA_QUALITY = "DataQuality";
|
||||
public static final String TYPE_OTHER = "Other";
|
||||
public static final String TYPE_MACHINE_LEARNING = "MachineLearning";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.common.config;
|
||||
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.io.support.EncodedResource;
|
||||
import org.springframework.core.io.support.PropertySourceFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class YamlPropertySourceFactory implements PropertySourceFactory {
|
||||
|
||||
@Override
|
||||
public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
|
||||
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
|
||||
String sourceName = name != null ? name : resource.getResource().getFilename();
|
||||
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
|
||||
}
|
||||
|
||||
private Properties loadYamlIntoProperties(EncodedResource resource) {
|
||||
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
|
||||
factory.setResources(resource.getResource());
|
||||
factory.afterPropertiesSet();
|
||||
return factory.getObject();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@TableName("t_ds_fav_task")
|
||||
public class FavTask {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String taskName;
|
||||
private int userId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.dolphinscheduler.dao.entity.FavTask;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* fav mapper interface
|
||||
*/
|
||||
public interface FavTaskMapper extends BaseMapper<FavTask> {
|
||||
|
||||
Set<String> getUserFavTaskTypes(@Param("userId") int userId);
|
||||
|
||||
boolean deleteUserFavTask(@Param("userId") int userId, @Param("taskName") String taskName);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.FavTaskMapper">
|
||||
|
||||
<select id="getUserFavTaskTypes" resultType="string">
|
||||
select task_name
|
||||
from t_ds_fav
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserFavTask">
|
||||
delete
|
||||
from t_ds_fav
|
||||
where user_id = #{userId}
|
||||
and task_name = #{taskName}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -1992,5 +1992,17 @@ CREATE TABLE t_ds_cluster
|
|||
);
|
||||
|
||||
INSERT INTO `t_ds_cluster`
|
||||
(`id`,`code`,`name`,`config`,`description`,`operator`,`create_time`,`update_time`)
|
||||
(`id`, `code`, `name`, `config`, `description`, `operator`, `create_time`, `update_time`)
|
||||
VALUES (100, 0, 'ds_null_k8s', '{"k8s":"ds_null_k8s"}', 'test', 1, '2021-03-03 11:31:24.0', '2021-03-03 11:31:24.0');
|
||||
|
||||
--
|
||||
-- Table structure for t_ds_fav
|
||||
--
|
||||
DROP TABLE IF EXISTS t_ds_fav CASCADE;
|
||||
CREATE TABLE t_ds_fav
|
||||
(
|
||||
id bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
task_name varchar(64) NOT NULL,
|
||||
user_id int NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1955,16 +1955,30 @@ CREATE TABLE t_ds_alert_send_status (
|
|||
-- Table structure for t_ds_cluster
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `t_ds_cluster`;
|
||||
CREATE TABLE `t_ds_cluster` (
|
||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`code` bigint(20) DEFAULT NULL COMMENT 'encoding',
|
||||
`name` varchar(100) NOT NULL COMMENT 'cluster name',
|
||||
`config` text NULL DEFAULT NULL COMMENT 'this config contains many cluster variables config',
|
||||
`description` text NULL DEFAULT NULL COMMENT 'the details',
|
||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `cluster_name_unique` (`name`),
|
||||
UNIQUE KEY `cluster_code_unique` (`code`)
|
||||
CREATE TABLE `t_ds_cluster`(
|
||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`code` bigint(20) DEFAULT NULL COMMENT 'encoding',
|
||||
`name` varchar(100) NOT NULL COMMENT 'cluster name',
|
||||
`config` text NULL DEFAULT NULL COMMENT 'this config contains many cluster variables config',
|
||||
`description` text NULL DEFAULT NULL COMMENT 'the details',
|
||||
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `cluster_name_unique` (`name`),
|
||||
UNIQUE KEY `cluster_code_unique` (`code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for t_ds_fav_task
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `t_ds_fav_task`;
|
||||
CREATE TABLE `t_ds_fav_task`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'favorite task id',
|
||||
`task_name` varchar(64) NOT NULL COMMENT 'favorite task name',
|
||||
`user_id` int NOT NULL COMMENT 'user id',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
|
|
|||
|
|
@ -1937,16 +1937,29 @@ CREATE TABLE t_ds_alert_send_status (
|
|||
--
|
||||
|
||||
DROP TABLE IF EXISTS t_ds_cluster;
|
||||
CREATE TABLE t_ds_cluster (
|
||||
id serial NOT NULL,
|
||||
code bigint NOT NULL,
|
||||
name varchar(100) DEFAULT NULL,
|
||||
config text DEFAULT NULL,
|
||||
description text,
|
||||
operator int DEFAULT NULL,
|
||||
create_time timestamp DEFAULT NULL,
|
||||
update_time timestamp DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT cluster_name_unique UNIQUE (name),
|
||||
CONSTRAINT cluster_code_unique UNIQUE (code)
|
||||
CREATE TABLE t_ds_cluster(
|
||||
id serial NOT NULL,
|
||||
code bigint NOT NULL,
|
||||
name varchar(100) DEFAULT NULL,
|
||||
config text DEFAULT NULL,
|
||||
description text,
|
||||
operator int DEFAULT NULL,
|
||||
create_time timestamp DEFAULT NULL,
|
||||
update_time timestamp DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT cluster_name_unique UNIQUE (name),
|
||||
CONSTRAINT cluster_code_unique UNIQUE (code)
|
||||
);
|
||||
|
||||
--
|
||||
-- Table structure for t_ds_fav
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS t_ds_fav;
|
||||
CREATE TABLE t_ds_fav
|
||||
(
|
||||
id serial NOT NULL,
|
||||
task_name varchar(64) NOT NULL,
|
||||
user_id int NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@
|
|||
</includes>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${basedir}/../dolphinscheduler-api/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>task-type-config.yaml</include>
|
||||
</includes>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${basedir}/../dolphinscheduler-ui/dist</directory>
|
||||
<outputDirectory>./ui</outputDirectory>
|
||||
|
|
|
|||
Loading…
Reference in New Issue