From e38db0f2f01e32ae3b9f0f4dc31ea234589dddae Mon Sep 17 00:00:00 2001 From: zzx <142965157+zzxxiansheng@users.noreply.github.com> Date: Wed, 17 Apr 2024 22:52:57 +0800 Subject: [PATCH] [ISSUE #119] Introduce dependencies for a unified return front-end format (#120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add view controller * Some fixes to the position of the dynamic properties in the request, changes to the controller, and added comments to the config table * improve somme method name * Sync the modification of #85 * Sync the modification of #85 * Removed the use of delete annotations * Introduce dependencies for a unified return front-end format * resolve error * improve some mistake * improve some mistake * improve some mistake --------- Co-authored-by: 周倬贤 <14100340+zhou-zhuoxian@user.noreply.gitee.com> --- eventmesh-dashboard-common/pom.xml | 1 + eventmesh-dashboard-console/pom.xml | 89 ++++++++----------- .../console/dto/ConnectionResponse.java | 69 -------------- .../console/dto/CreateTopicRequest.java | 39 -------- .../console/dto/DeleteTopicRequest.java | 39 -------- .../modle/dto/topic/CreateTopicDTO.java | 3 +- .../service/topic/TopicServiceImpl.java | 2 +- .../src/main/resources/application-dev.yml | 7 ++ .../main/resources/eventmesh-dashboard.sql | 1 + eventmesh-dashboard-core/pom.xml | 7 +- 10 files changed, 51 insertions(+), 206 deletions(-) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/CreateTopicRequest.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/DeleteTopicRequest.java diff --git a/eventmesh-dashboard-common/pom.xml b/eventmesh-dashboard-common/pom.xml index 892093b0..2f531fd5 100644 --- a/eventmesh-dashboard-common/pom.xml +++ b/eventmesh-dashboard-common/pom.xml @@ -41,6 +41,7 @@ org.springframework.boot spring-boot-starter-web + provided diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index 511671da..a39ae57a 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -36,21 +36,15 @@ - - - org.springframework.boot - spring-boot-starter-web - - - org.apache.eventmesh.dashboard.common - eventmesh-dashboard-common + org.apache.eventmesh.dashboard.core + eventmesh-dashboard-core 0.0.1-SNAPSHOT - org.apache.eventmesh.dashboard.core - eventmesh-dashboard-core + org.apache.eventmesh.dashboard.common + eventmesh-dashboard-common 0.0.1-SNAPSHOT @@ -65,17 +59,16 @@ spring-aspects - + - org.springframework.boot - spring-boot-starter-test - test + io.github.githublaohu + mybatis-dependent + 0.1.4 - - junit - junit - 4.13.2 - test + + com.github.pagehelper + pagehelper-spring-boot-starter + 2.1.0 @@ -90,46 +83,38 @@ 1.8.0 - + - com.alibaba - druid-spring-boot-starter - 1.2.22 + io.github.githublaohu + dubbo-springmvc + 0.1.4 + + + org.apache.dubbo + dubbo-spring-boot-starter + + + + - org.mybatis.spring.boot - mybatis-spring-boot-starter + cn.lampup + decoration-core + 0.1.7 + - com.mysql - mysql-connector-j - runtime + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + 4.13.2 + test - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java deleted file mode 100644 index d4062a68..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.eventmesh.dashboard.console.dto; - -import java.io.Serializable; - -import io.swagger.v3.oas.annotations.media.Schema; - - -public class ConnectionResponse implements Serializable { - - private static final long serialVersionUID = -7317308457824435889L; - - @Schema(name = "id", description = "primary key of table connection") - private Long id; - - @Schema(name = "sourceType", defaultValue = "connector", allowableValues = {"connector", "client"}) - private String sourceType; - - @Schema(name = "sourceId", description = "connectorId or clientId") - private Long sourceId; - - @Schema(name = "sourceStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") - private Integer sourceStatus; - - // @Schema(name = "sourceConfigList", description = "source config list") - // private List sourceConfigList; - - @Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"}) - private String sinkType; - - @Schema(name = "sinkId", description = "connectorId or clientId") - private Long sinkId; - - @Schema(name = "sinkStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") - private Integer sinkStatus; - - // @Schema(name = "sinkConfigList", description = "sink config list") - // private List sinkConfigList; - - private Long runtimeId; - - @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") - private Integer status; - - @Schema(name = "topic", description = "related topic name from storage") - private String topic; - - private Long groupId; - - private String groupName; - - private String description; -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/CreateTopicRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/CreateTopicRequest.java deleted file mode 100644 index c84cee47..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/CreateTopicRequest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.eventmesh.dashboard.console.dto; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Data; - -/** - * TODO this class is copied from storage plugin, needs update - */ - -@Data -public class CreateTopicRequest { - - private String name; - - @JsonCreator - public CreateTopicRequest(@JsonProperty("name") String name) { - super(); - this.name = name; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/DeleteTopicRequest.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/DeleteTopicRequest.java deleted file mode 100644 index da793b32..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/DeleteTopicRequest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.eventmesh.dashboard.console.dto; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Data; - -/** - * TODO this class is copied from storage plugin, needs update - */ - -@Data -public class DeleteTopicRequest { - - private String name; - - @JsonCreator - public DeleteTopicRequest(@JsonProperty("name") String name) { - super(); - this.name = name; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java index df7cc3d2..15d9c8b1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java @@ -17,7 +17,6 @@ package org.apache.eventmesh.dashboard.console.modle.dto.topic; -import java.sql.Timestamp; import lombok.Data; @@ -38,7 +37,7 @@ public class CreateTopicDTO { private Integer replicasNums; - private Timestamp saveTime; + private Long saveTime; private Integer cleanupStrategy; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java index d99cd705..68544989 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java @@ -99,7 +99,7 @@ public void createTopic(CreateTopicDTO createTopicDTO) { topicEntity.setClusterId(createTopicDTO.getClusterId()); topicEntity.setTopicName(createTopicDTO.getName()); topicEntity.setDescription(createTopicDTO.getDescription()); - topicEntity.setRetentionMs(createTopicDTO.getSaveTime().getTime()); + topicEntity.setRetentionMs(createTopicDTO.getSaveTime()); StoreEntity storeEntity = new StoreEntity(); storeEntity.setClusterId(topicEntity.getClusterId()); topicEntity.setStorageId(String.valueOf(storeMapper.selectStoreByCluster(storeEntity).getId())); diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml index b0cee4bc..1516982e 100644 --- a/eventmesh-dashboard-console/src/main/resources/application-dev.yml +++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml @@ -53,5 +53,12 @@ logging: mybatis: type-aliases-package: org.apache.eventmesh.dashboard.console.entity +decoration: + constantConfig: + #The 'all' configuration item indicates that the decoration component is allowed to enable pagination and return the front-end style function in a unified manner + all: true + #the 'corsEnable' configuration item indicates that cross-domain is enabled + corsEnable: true + diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql index e4fc2715..51655bc4 100644 --- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql +++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql @@ -290,6 +290,7 @@ CREATE TABLE `topic` `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(尽量与Topic实际创建时间一致)', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间(尽量与Topic实际创建时间一致)', `status` int NOT NULL DEFAULT '1', + create_progress int NOT NULL DEFAULT 1 COMMENT '0:创建成功,1:创建中,2:创建失败', PRIMARY KEY (`id`), UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`), KEY `cluster_id` (`cluster_id`, `topic_name`) diff --git a/eventmesh-dashboard-core/pom.xml b/eventmesh-dashboard-core/pom.xml index 2e43383c..c5d20d7e 100644 --- a/eventmesh-dashboard-core/pom.xml +++ b/eventmesh-dashboard-core/pom.xml @@ -137,10 +137,9 @@ test - junit - junit - 4.13.2 - test + org.springframework.boot + spring-boot-starter-web + provided