diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/FavTaskController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/FavTaskController.java index 2051d03f74..35b11627b3 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/FavTaskController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/FavTaskController.java @@ -82,13 +82,13 @@ public class FavTaskController extends BaseController { * @return */ @Operation(summary = "deleteTaskType", description = "DELETE_TASK_TYPE") - @DeleteMapping(value = "/{taskName}") + @DeleteMapping(value = "/{taskType}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_TASK_TYPE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result deleteFavTask(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @PathVariable("taskName") String taskName) { - boolean b = favTaskService.deleteFavTask(loginUser, taskName); + @PathVariable("taskType") String taskType) { + boolean b = favTaskService.deleteFavTask(loginUser, taskType); return success(b); } @@ -99,13 +99,13 @@ public class FavTaskController extends BaseController { * @return */ @Operation(summary = "addTaskType", description = "ADD_TASK_TYPE") - @PostMapping(value = "/{taskName}") + @PostMapping(value = "/{taskType}") @ResponseStatus(HttpStatus.OK) @ApiException(ADD_TASK_TYPE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result addFavTask(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @PathVariable("taskName") String taskName) { - int i = favTaskService.addFavTask(loginUser, taskName); + @PathVariable("taskType") String taskType) { + int i = favTaskService.addFavTask(loginUser, taskType); return success(i > 0); } } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/FavTaskDto.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/FavTaskDto.java index 71a8b5299d..9c88225e6e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/FavTaskDto.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/FavTaskDto.java @@ -28,24 +28,11 @@ import lombok.Setter; @AllArgsConstructor public class FavTaskDto implements Cloneable { - private String taskName; - private boolean isCollection; + // task type name 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(); - } + private boolean isCollection; + // task category the task type belongs to + private String taskCategory; @Override public Object clone() throws CloneNotSupportedException { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/FavTaskService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/FavTaskService.java index a6c24fdac8..f10bf3b642 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/FavTaskService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/FavTaskService.java @@ -26,7 +26,7 @@ public interface FavTaskService { List getFavTaskList(User loginUser); - boolean deleteFavTask(User loginUser, String taskName); + boolean deleteFavTask(User loginUser, String taskType); - int addFavTask(User loginUser, String taskName); + int addFavTask(User loginUser, String taskType); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/FavTaskServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/FavTaskServiceImpl.java index 21e3737101..d8692a7f8f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/FavTaskServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/FavTaskServiceImpl.java @@ -50,7 +50,7 @@ public class FavTaskServiceImpl extends BaseServiceImpl implements FavTaskServic defaultTaskTypes.forEach(e -> { try { FavTaskDto clone = (FavTaskDto) e.clone(); - if (userFavTaskTypes.contains(clone.getTaskName())) { + if (userFavTaskTypes.contains(clone.getTaskType())) { clone.setCollection(true); } result.add(clone); @@ -62,13 +62,13 @@ public class FavTaskServiceImpl extends BaseServiceImpl implements FavTaskServic } @Override - public boolean deleteFavTask(User loginUser, String taskName) { - return favMapper.deleteUserFavTask(loginUser.getId(), taskName); + public boolean deleteFavTask(User loginUser, String taskType) { + return favMapper.deleteUserFavTask(loginUser.getId(), taskType); } @Override - public int addFavTask(User loginUser, String taskName) { - favMapper.deleteUserFavTask(loginUser.getId(), taskName); - return favMapper.insert(new FavTask(null, taskName, loginUser.getId())); + public int addFavTask(User loginUser, String taskType) { + favMapper.deleteUserFavTask(loginUser.getId(), taskType); + return favMapper.insert(new FavTask(null, taskType, loginUser.getId())); } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/FavTask.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/FavTask.java index e9e3c88642..8bddc05c7d 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/FavTask.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/FavTask.java @@ -35,7 +35,7 @@ public class FavTask { @TableId(value = "id", type = IdType.AUTO) private Long id; - private String taskName; + private String taskType; private int userId; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.java index 8ea39dd7d8..2013ac707e 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.java @@ -32,5 +32,5 @@ public interface FavTaskMapper extends BaseMapper { Set getUserFavTaskTypes(@Param("userId") int userId); - boolean deleteUserFavTask(@Param("userId") int userId, @Param("taskName") String taskName); + boolean deleteUserFavTask(@Param("userId") int userId, @Param("taskType") String taskType); } diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.xml index 891529bb04..cb49072806 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/FavTaskMapper.xml @@ -20,7 +20,7 @@ @@ -29,6 +29,6 @@ delete from t_ds_fav_task where user_id = #{userId} - and task_name = #{taskName} + and task_type = #{taskType} diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql index d396b5c5e8..b1511c2511 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql @@ -2028,7 +2028,7 @@ DROP TABLE IF EXISTS t_ds_fav_task CASCADE; CREATE TABLE t_ds_fav_task ( id bigint(20) NOT NULL AUTO_INCREMENT, - task_name varchar(64) NOT NULL, + task_type varchar(64) NOT NULL, user_id int NOT NULL, PRIMARY KEY (id) ); diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql index 9c690ddb45..e7a0c8ce0d 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql @@ -2000,8 +2000,8 @@ CREATE TABLE `t_ds_cluster`( 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', + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `task_type` varchar(64) NOT NULL COMMENT 'favorite task type name', `user_id` int NOT NULL COMMENT 'user id', PRIMARY KEY (`id`) ) ENGINE = InnoDB diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql index 89f3d06a74..e97da2c29b 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql @@ -1979,7 +1979,7 @@ DROP TABLE IF EXISTS t_ds_fav_task; CREATE TABLE t_ds_fav_task ( id serial NOT NULL, - task_name varchar(64) NOT NULL, + task_type varchar(64) NOT NULL, user_id int NOT NULL, PRIMARY KEY (id) ); diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_dml.sql index 5f26e3515d..4a14f326b9 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_dml.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_dml.sql @@ -14,4 +14,3 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/mysql/dolphinscheduler_ddl.sql index 0008af69c7..978f1bf39f 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/mysql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/mysql/dolphinscheduler_ddl.sql @@ -14,6 +14,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +--- rename t_ds_fav_task task_name to task_type +drop procedure if exists modify_t_ds_fav_task_task_name; +delimiter d// +CREATE PROCEDURE modify_t_ds_fav_task_task_name() +BEGIN + IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME='t_ds_fav_task' + AND TABLE_SCHEMA=(SELECT DATABASE()) + AND COLUMN_NAME='task_name') + THEN +SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); +ALTER TABLE `t_ds_fav_task` change `task_name` `task_type` varchar(64) NOT NULL COMMENT 'favorite task type name'; +END IF; +END; +d// +delimiter ; +CALL modify_t_ds_fav_task_task_name; +DROP PROCEDURE modify_t_ds_fav_task_task_name; + -- alter table `t_ds_worker_group` add `description` varchar(256); drop procedure if exists add_column_safety; delimiter d// @@ -47,4 +66,4 @@ delimiter ; -- ALTER TABLE t_ds_worker_group ADD COLUMN description varchar(255) DEFAULT NULL COMMENT 'ds worker group description'; call add_column_safety('t_ds_worker_group','description', 'varchar(255)' , "DEFAULT NULL COMMENT 'ds worker group description'"); -drop procedure if exists add_column_safety; \ No newline at end of file +drop procedure if exists add_column_safety; diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/postgresql/dolphinscheduler_ddl.sql index 1d10ad01d0..fd465802ec 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/postgresql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.1_schema/postgresql/dolphinscheduler_ddl.sql @@ -14,5 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +--- rename t_ds_fav_task task_name to task_type +DO $$ +DECLARE +v_schema varchar; +BEGIN + v_schema =current_schema(); + IF EXISTS(SELECT * + FROM information_schema.columns + WHERE table_name='t_ds_fav_task' and column_name='task_name') + then + EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_fav_task RENAME COLUMN task_name TO task_type'; +END IF; +END $$; + --- add column -ALTER TABLE t_ds_task_group alter COLUMN description type varchar(255); \ No newline at end of file +ALTER TABLE t_ds_task_group alter COLUMN description type varchar(255); + diff --git a/dolphinscheduler-ui/src/service/modules/dag-menu/index.ts b/dolphinscheduler-ui/src/service/modules/dag-menu/index.ts index b107ed2caa..3cadace17f 100644 --- a/dolphinscheduler-ui/src/service/modules/dag-menu/index.ts +++ b/dolphinscheduler-ui/src/service/modules/dag-menu/index.ts @@ -24,16 +24,16 @@ export function getDagMenu(): any { }) } -export function Collection(taskName: string): any { +export function Collection(taskType: string): any { return axios({ - url: `/favourite/${taskName}`, + url: `/favourite/${taskType}`, method: 'post' }) } -export function CancelCollection(taskName: string): any { +export function CancelCollection(taskType: string): any { return axios({ - url: `/favourite/${taskName}`, + url: `/favourite/${taskType}`, method: 'delete' }) } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-sidebar.tsx b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-sidebar.tsx index a45ef02ce8..7420525514 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-sidebar.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-sidebar.tsx @@ -51,29 +51,29 @@ export default defineComponent({ return { ...item, starHover: false, - type: item.taskName + type: item.taskType } }) variables.universal = variables.dataList.filter( - (item: any) => item.taskType === 'Universal' + (item: any) => item.taskCategory === 'Universal' ) variables.cloud = variables.dataList.filter( - (item: any) => item.taskType === 'Cloud' + (item: any) => item.taskCategory === 'Cloud' ) variables.logic = variables.dataList.filter( - (item: any) => item.taskType === 'Logic' + (item: any) => item.taskCategory === 'Logic' ) variables.di = variables.dataList.filter( - (item: any) => item.taskType === 'DataIntegration' + (item: any) => item.taskCategory === 'DataIntegration' ) variables.dq = variables.dataList.filter( - (item: any) => item.taskType === 'DataQuality' + (item: any) => item.taskCategory === 'DataQuality' ) variables.ml = variables.dataList.filter( - (item: any) => item.taskType === 'MachineLearning' + (item: any) => item.taskCategory === 'MachineLearning' ) variables.other = variables.dataList.filter( - (item: any) => item.taskType === 'Other' + (item: any) => item.taskCategory === 'Other' ) variables.fav = variables.dataList.filter( (item: any) => item.collection === true @@ -83,10 +83,10 @@ export default defineComponent({ const handleCollection = (item: any) => { item.collection - ? CancelCollection(item.taskName).then(() => { + ? CancelCollection(item.taskType).then(() => { handleDagMenu() }) - : Collection(item.taskName).then(() => { + : Collection(item.taskType).then(() => { handleDagMenu() }) item.collection = !item.collection @@ -120,7 +120,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -173,7 +173,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -226,7 +226,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -279,7 +279,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -332,7 +332,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -385,7 +385,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -438,7 +438,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{ @@ -491,7 +491,7 @@ export default defineComponent({ styles['icon-' + task.type.toLocaleLowerCase()] ]} /> - {task.taskName} + {task.taskType}
{