showDetailConfigsVOS = new ArrayList<>();
+ configEntityList.forEach(n -> {
+ DetailConfigsVO showDetailConfigsVO = new DetailConfigsVO();
+ showDetailConfigsVO.setDefaultValue(stringStringConcurrentHashMap.get(n.getConfigName()));
+ showDetailConfigsVO.setIsModify(n.getIsModify());
+ showDetailConfigsVO.setConfigName(n.getConfigName());
+ showDetailConfigsVO.setConfigValue(n.getConfigValue());
+ showDetailConfigsVO.setAlreadyUpdate(n.getAlreadyUpdate());
+ showDetailConfigsVOS.add(showDetailConfigsVO);
+ });
+ return showDetailConfigsVOS;
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
index 37e9049d..79540d38 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java
@@ -17,36 +17,73 @@
package org.apache.eventmesh.dashboard.console.controller;
-import org.apache.eventmesh.dashboard.service.meta.ConnectionCore;
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
+import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
@RestController
public class ConnectionController {
- /**
- * TODO expose implement by FunctionManager
- */
- ConnectionCore connectionCore;
+ @Autowired
+ private ConnectionDataService connectionDataService;
/**
- * Query Connection List
- *
- * The subscription information of SourceConnector and SinkConnector reported by EventMesh Runtime to the meta,
- * containing the configuration of each connection.
+ * 'type' only can be Sink or Source
*
- * @param page the page number
- * @param size the page size
- * @return A paged list of connection configuration and total number of pages
+ * @param type
+ * @return
*/
- @GetMapping("/connection")
- public String listConnections(@RequestParam("page") Integer page, @RequestParam("size") String size) {
- return null;
+ @GetMapping("/cluster/connection/getConnectorBusinessType")
+ public List getConnectorBusinessType(String type) {
+ return connectionDataService.getConnectorBusinessType(type);
+ }
+
+ @GetMapping("/cluster/connection/getConnectorConfigs")
+ public List getConnectorConfigsByClassAndVersion(String version, String classType) {
+ return connectionDataService.getConnectorConfigsByClassAndVersion(classType, version);
}
+
+ @GetMapping("/cluster/connection/showCreateConnectionMessage")
+ public AddConnectionDTO showCreateConnectionMessage() {
+ return new AddConnectionDTO();
+ }
+
+
+ @PostMapping("/cluster/connection/createConnection")
+ public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) {
+ try {
+ connectionDataService.createConnection(createConnectionDTO);
+
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ return "success";
+ }
+
+
+ @PostMapping("/cluster/connection/getConnectionList")
+ public List getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) {
+ return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO);
+ }
+
+ @GetMapping("/cluster/connection/getConnectorDetail")
+ public ConnectorEntity getConnectorDetail(Long connectorId) {
+ return connectionDataService.getConnectorById(connectorId);
+ }
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java
new file mode 100644
index 00000000..c07c4c90
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java
@@ -0,0 +1,47 @@
+/*
+ * 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.controller;
+
+import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity;
+import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo;
+import org.apache.eventmesh.dashboard.console.service.health.HealthDataService;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HealthController {
+
+ @Autowired
+ HealthDataService healthDataService;
+
+ @GetMapping("/cluster/health/getHistoryLiveStatus")
+ public List getHistoryLiveStatusById(Integer type, Long instanceId, String startTime) {
+ Timestamp timestamp = Timestamp.valueOf(startTime);
+ return healthDataService.getInstanceLiveStatusHistory(type, instanceId, timestamp);
+ }
+
+ @GetMapping("/cluster/health/getInstanceLiveProportion")
+ public InstanceLiveProportionVo getInstanceLiveProportion(Integer instanceType, Long theClusterId) {
+ return healthDataService.getInstanceLiveProportion(theClusterId, instanceType);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java
new file mode 100644
index 00000000..72d3e343
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java
@@ -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.eventmesh.dashboard.console.controller;
+
+import org.apache.eventmesh.dashboard.console.entity.log.LogEntity;
+import org.apache.eventmesh.dashboard.console.service.log.LogService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class LogController {
+
+ @Autowired
+ private LogService logService;
+
+ @GetMapping("/cluster/log/getList")
+ public List getLogLIstToFront(Integer pageIndex, Integer pageNum) {
+ return logService.getLogListByCluster(pageIndex, pageNum);
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java
new file mode 100644
index 00000000..4fc6c809
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java
@@ -0,0 +1,45 @@
+/*
+ * 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.controller;
+
+import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO;
+import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+public class RuntimeController {
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @PostMapping("/clusterId/runtime/getList")
+ public List getRuntimeList(@Validated @RequestBody GetRuntimeListDTO getRuntimeListDTO) {
+ return runtimeService.getRuntimeToFrontByClusterId(getRuntimeListDTO.getClusterId(), getRuntimeListDTO);
+ }
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java
index c8f92ff8..400e0c55 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java
@@ -17,67 +17,65 @@
package org.apache.eventmesh.dashboard.console.controller;
-import org.apache.eventmesh.dashboard.common.dto.Result;
-import org.apache.eventmesh.dashboard.console.dto.CreateTopicRequest;
-import org.apache.eventmesh.dashboard.console.dto.DeleteTopicRequest;
-import org.apache.eventmesh.dashboard.service.dto.TopicProperties;
-import org.apache.eventmesh.dashboard.service.store.TopicCore;
+
+import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
+import org.apache.eventmesh.dashboard.console.service.topic.TopicService;
import java.util.List;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/topic")
public class TopicController {
- /**
- * TODO expose implement by FunctionManager
- */
- TopicCore topicCore;
-
- /**
- * TODO Is OPTIONS method and @CrossOrigin necessary?
- */
- @CrossOrigin
- @RequestMapping(method = RequestMethod.OPTIONS)
- public ResponseEntity preflight() {
- return ResponseEntity.ok()
- .header("Access-Control-Allow-Origin", "*")
- .header("Access-Control-Allow-Methods", "*")
- .header("Access-Control-Allow-Headers", "*")
- .header("Access-Control-Max-Age", "86400")
- .build();
+ @Autowired
+ private TopicService topicService;
+
+
+ @PostMapping("/cluster/topic/topicList")
+ public List getTopicList(@Validated @RequestBody GetTopicListDTO getTopicListDTO) {
+ return topicService.getTopicListToFront(getTopicListDTO.getClusterId(), getTopicListDTO);
+
}
- @CrossOrigin
- @GetMapping
- public Result> getList() {
- List topicList = topicCore.getTopics();
- return Result.success(topicList);
+
+ @GetMapping("/cluster/topic/deleteTopic")
+ public String deleteTopic(TopicEntity topicEntity) {
+ try {
+ topicService.deleteTopic(topicEntity);
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ return "success";
}
- @CrossOrigin
- @PostMapping
- public Result create(@RequestBody CreateTopicRequest createTopicRequest) {
- String topicName = createTopicRequest.getName();
- topicCore.createTopic(topicName);
- return Result.success();
+
+ @GetMapping("/cluster/topic/showCreateTopic")
+ public CreateTopicDTO showCreateTopicMessage() {
+ return new CreateTopicDTO();
+ }
+
+ @PostMapping("/cluster/topic/createTopic")
+ public String createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) {
+ try {
+ topicService.createTopic(createTopicDTO);
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ return "success";
}
- @CrossOrigin
- @DeleteMapping
- public Result delete(@RequestBody DeleteTopicRequest deleteTopicRequest) {
- String topicName = deleteTopicRequest.getName();
- topicCore.deleteTopic(topicName);
- return Result.success();
+ @GetMapping("/cluster/topic/getTopicDetailGroups")
+ public List getTopicDetailGroups(Long topicId) {
+ return topicService.getTopicDetailGroups(topicId);
}
-}
\ No newline at end of file
+
+}
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/entity/cluster/ClusterEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
index dc1f4e44..eafbd2f1 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java
@@ -34,7 +34,7 @@ public class ClusterEntity extends BaseEntity {
private String name;
- private String registerNameList;
+ private String registryNameList;
private String bootstrapServers;
@@ -58,5 +58,8 @@ public class ClusterEntity extends BaseEntity {
private Timestamp updateTime;
+ /**
+ * @See StoreType
+ */
private Integer storeType;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java
index 07b979b6..ca5defbd 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java
@@ -65,4 +65,44 @@ public class ConfigEntity extends BaseEntity {
private Integer isDefault;
private Integer isModify;
+
+ private Integer alreadyUpdate;
+
+ public boolean matchVersion(String eventmeshVersion) {
+ return (xiaoyu(eventmeshVersion) && dayu(eventmeshVersion));
+ }
+
+ public boolean xiaoyu(String eventmeshVersion) {
+ String[] em = eventmeshVersion.split(".");
+ String[] startVersion = this.getStartVersion().split(".");
+ boolean flag = true;
+ for (int i = 0; i < em.length; i++) {
+ if (Integer.valueOf(em[i]) < Integer.valueOf(startVersion[i])) {
+ flag = false;
+ break;
+ } else if (Integer.valueOf(em[i]) == Integer.valueOf(startVersion[i])) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ return flag;
+ }
+
+ public boolean dayu(String eventmeshVersion) {
+ String[] em = eventmeshVersion.split(".");
+ String[] endVersion = this.getEndVersion().split(".");
+ boolean flag = true;
+ for (int i = 0; i < em.length; i++) {
+ if (Integer.valueOf(em[i]) < Integer.valueOf(endVersion[i])) {
+ break;
+ } else if (Integer.valueOf(em[i]) == Integer.valueOf(endVersion[i])) {
+ continue;
+ } else {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java
new file mode 100644
index 00000000..9585e75f
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java
@@ -0,0 +1,35 @@
+/*
+ * 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.entity.config;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DefaultConfigKey {
+
+ private String businessType;
+
+ private String configName;
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
index 7a5f6f29..0b888be7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java
@@ -50,6 +50,10 @@ public class ConnectorEntity extends BaseEntity {
@Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active")
private Integer status;
+ private String host;
+
+ private Integer port;
+
/**
* @see KubernetesPodStatus
*/
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java
index 2cc3f5cf..c4a7be5e 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java
@@ -28,6 +28,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
+
public class RuntimeEntity extends BaseEntity {
private Long id;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java
index 3f3d326b..78156f50 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java
@@ -41,8 +41,6 @@ public class StoreEntity extends BaseEntity {
private String host;
- private Long runtimeId;
-
private String topicList;
private Short diffType;
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java
index a5784f01..85ae80e6 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java
@@ -36,8 +36,6 @@ public class TopicEntity extends BaseEntity {
private String topicName;
- private String runtimeId;
-
private String storageId;
private Long retentionMs;
@@ -51,4 +49,6 @@ public class TopicEntity extends BaseEntity {
private Timestamp updateTime;
private Integer status;
+
+ private Integer createProgress;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataServiceTypeEnum.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataServiceTypeEnum.java
new file mode 100644
index 00000000..b96484dd
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataServiceTypeEnum.java
@@ -0,0 +1,39 @@
+/*
+ * 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.enums.metadata;
+
+public enum MetadataServiceTypeEnum {
+
+ RUNTIME,
+
+ CENTER_ETCD,
+
+ META_NACOS,
+
+ TOPIC,
+
+ CLUSTER,
+
+ CLIENT,
+
+ GROUP,
+
+ CONNECTION,
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataTypeEnum.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataTypeEnum.java
new file mode 100644
index 00000000..375af449
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/metadata/MetadataTypeEnum.java
@@ -0,0 +1,37 @@
+/*
+ * 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.enums.metadata;
+
+public enum MetadataTypeEnum {
+
+ CENTER,
+
+ CLUSTER,
+
+ RUNTIME,
+
+ TOPIC,
+
+ GROUP,
+
+ SUBSCRIPTION,
+
+ STORE
+ ;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
index e2d62f71..132e46b5 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java
@@ -33,7 +33,15 @@
public class CheckResultCache {
- private final HashMap> cacheMap = new HashMap<>();
+ private static final HashMap> cacheMap = new HashMap<>();
+
+ public static Integer getLastHealthyCheckResult(String type, Long typeId) {
+ if (!Objects.isNull(cacheMap.get(type)) && !Objects.isNull(cacheMap.get(type).get(typeId))) {
+ return cacheMap.get(type).get(typeId).getStatus().getNumber();
+ }
+ return HealthCheckStatus.CHECKING.getNumber();
+ }
+
public void update(String type, Long typeId, HealthCheckStatus status, String resultDesc, Long latency) {
HashMap subMap = cacheMap.get(type);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
index f0ac9f67..bed58ebb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java
@@ -71,10 +71,11 @@ public Object logStart(ProceedingJoinPoint joinPoint) throws Throwable {
try {
proceed = joinPoint.proceed();
logEntity.setState(2);
- logEntity.setResult(Objects.isNull(proceed) ? "" : proceed.toString());
+ proceed = Objects.isNull(proceed) ? " " : proceed.toString();
return proceed;
} catch (Throwable e) {
logEntity.setState(3);
+ proceed = "error:" + e.getMessage();
throw new RuntimeException(e);
} finally {
logEntity.setResult(proceed.toString());
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java
index ddce0f2c..d6a234fd 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java
@@ -49,6 +49,9 @@ public interface ClientMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void batchInsert(List clientEntityList);
+ @Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1")
+ List selectByHostPort(ClientEntity clientEntity);
+
@Select("SELECT * FROM `client` WHERE `id` = #{id}")
ClientEntity selectById(ClientEntity clientEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
index 23608bfa..307b9a15 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java
@@ -19,7 +19,6 @@
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
-import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
@@ -37,12 +36,15 @@ public interface ClusterMapper {
@Select("SELECT * FROM cluster WHERE status=1")
List selectAllCluster();
+ @Select("SELECT * FROM cluster WHERE status=1 LIMIT #{rowIndex},#{pageNum}")
+ List selectAllClusterToFront(Integer rowIndex, Integer pageNum);
+
@Insert({
""})
@@ -52,20 +54,20 @@ public interface ClusterMapper {
@Select("SELECT * FROM cluster WHERE id=#{id} AND status=1")
ClusterEntity selectClusterById(ClusterEntity cluster);
- @Insert("INSERT INTO cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, "
- + "jmx_properties, reg_properties, description, auth_type, run_state,store_type) VALUES (#{name},#{registerNameList},"
+ @Insert("INSERT INTO cluster (name, registry_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ + "jmx_properties, reg_properties, description, auth_type, run_state,store_type) VALUES (#{name},#{registryNameList},"
+ "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},"
- + "#{runState},#{storeType})")
+ + "#{runState},#{storeType})"
+ + "ON DUPLICATE KEY UPDATE status = 1")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addCluster(ClusterEntity cluster);
@Update("UPDATE cluster SET name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers},"
+ "eventmesh_version=#{eventmeshVersion},client_properties=#{clientProperties},jmx_properties=#{jmxProperties},"
+ "reg_properties=#{regProperties},description=#{description},auth_type=#{authType},run_state=#{runState} ,"
- + "register_name_list=#{registerNameList} WHERE id=#{id}")
+ + "registry_name_list=#{registryNameList} WHERE id=#{id}")
void updateClusterById(ClusterEntity cluster);
- @Delete("UPDATE cluster SET status=0 WHERE id=#{id}")
- void deleteClusterById(ClusterEntity clusterEntity);
-
+ @Update("UPDATE cluster SET status=0 WHERE id=#{id}")
+ void deActive(ClusterEntity clusterEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
index 905b551b..8171ddee 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
@@ -33,9 +33,39 @@
@Mapper
public interface ConfigMapper {
- @Select("SELECT * FROM config WHERE status=1")
+ @Select({
+ ""})
+ List getConfigsToFrontWithDynamic(ConfigEntity configEntity);
+
+ @Select("SELECT * FROM config WHERE business_type=#{businessType} AND is_default=1")
+ List selectConnectorConfigsByBusinessType(ConfigEntity configEntity);
+
+ @Select("SELECT DISTINCT business_type FROM config WHERE instance_type=2 AND is_default=1 AND business_type LIKE CONCAT('%',#{businessType},'%')")
+ List selectConnectorBusinessType(ConfigEntity configEntity);
+
+
+ @Select("SELECT * FROM config WHERE status=1 AND is_default=0")
List selectAll();
+ /**
+ * todo Insertion of supplemental version number values;
+ *
+ * @param configEntityList
+ */
@Insert({
""})
+ List selectToFrontByClusterId(@Param("connectionEntity") ConnectionEntity connectionEntity);
+
+ @Select("SELECT * FROM connection WHERE cluster_id = #{clusterId} AND source_id = #{sourceId} AND source_type = #{sourceType} AND status=1")
public List selectByClusterIdSourceTypeAndSourceId(ConnectionEntity connectionEntity);
@Select("SELECT * FROM connection WHERE cluster_id = #{clusterId} AND sink_id = #{sinkId} AND sink_type = #{sinkType}")
@@ -64,7 +77,7 @@ public List selectByClusterIdSinkTypeAndSinkIdAndCreateTimeRan
@Insert("INSERT INTO connection (cluster_id, source_type, source_id," + " sink_type, sink_id, runtime_id, status, topic, group_id, description)"
+ " VALUES ( #{clusterId}, #{sourceType}, #{sourceId}, "
+ " #{sinkType}, #{sinkId}, #{runtimeId}, #{status}, #{topic}, #{groupId}, #{description})")
- void insert(ConnectionEntity connectionEntity);
+ Long insert(ConnectionEntity connectionEntity);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert({
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
index ba0724c4..2b3f4764 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java
@@ -33,33 +33,41 @@
@Mapper
public interface ConnectorMapper {
+
@Select("SELECT * FROM connector WHERE status=1")
ConnectorEntity selectAll();
- @Select("SELECT * FROM connector WHERE id = #{id}")
+ @Select("SELECT * FROM connector WHERE id = #{id} AND status=1")
ConnectorEntity selectById(ConnectorEntity connectorEntity);
- @Select("SELECT * FROM connector WHERE cluster_id = #{clusterId}")
+ @Select("SELECT * FROM connector WHERE cluster_id = #{clusterId} AND status=1")
List selectByClusterId(ConnectorEntity connectorEntity);
+ @Select("SELECT * FROM connector WHERE host = #{host} AND port = #{port} AND status=1")
+ List selectByHostAndPort(ConnectorEntity connectorEntity);
+
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- @Insert("INSERT INTO connector (cluster_id,name, class_name, type, status, pod_state, config_ids) "
- + "VALUES (#{clusterId}, #{name}, #{className}, #{type}, #{status}, #{podState}, #{configIds})")
+ @Insert("INSERT INTO connector (cluster_id,name, class_name, type, status, pod_state, config_ids, host, port) "
+ + "VALUES (#{clusterId}, #{name}, #{className}, #{type}, #{status}, #{podState}, #{configIds}, #{host}, #{port})")
void insert(ConnectorEntity connectorEntity);
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert({
""})
void batchInsert(List connectorEntityList);
- @Update("UPDATE connector SET status = #{status} WHERE id = #{id}")
- void updateStatus(ConnectorEntity connectorEntity);
+ @Update("UPDATE connector SET status = 1 WHERE id = #{id}")
+ void active(ConnectorEntity connectorEntity);
+
+ @Update("UPDATE connector SET status = 0 WHERE id = #{id}")
+ void deActive(ConnectorEntity connectorEntity);
@Update("UPDATE connector SET pod_state = #{podState} WHERE id = #{id}")
void updatePodState(ConnectorEntity connectorEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java
index fe228ab1..768653aa 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java
@@ -34,12 +34,18 @@
@Mapper
public interface OprGroupMapper {
+ @Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND type=0 ")
+ GroupEntity selectGroupByNameAndClusterId(GroupEntity groupEntity);
+
@Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)"
+ "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) "
+ "ON DUPLICATE KEY UPDATE status=1")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addGroup(GroupEntity groupEntity);
+ @Select("SELECT COUNT(*) FROM `group` WHERE cluster_id=#{clusterId} AND type=0")
+ Integer getConsumerNumByCluster(GroupEntity groupEntity);
+
@Insert({
""})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
- void batchInsert(List metaEntities);
+ List batchInsert(List metaEntities);
@Select("SELECT * FROM meta WHERE id = #{id}")
MetaEntity selectById(MetaEntity metaEntity);
@@ -56,11 +55,8 @@ public interface MetaMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("INSERT INTO meta (name, type, version, cluster_id, host, port, role, username, params, status)"
+ " VALUES ( #{name}, #{type}, #{version}, #{clusterId}, #{host}, #{port}, #{role}, #{username}, #{params}, #{status})")
- void insert(MetaEntity metaEntity);
+ Long insert(MetaEntity metaEntity);
- @Update("UPDATE meta SET status = #{status} WHERE id = #{id}")
- void update(MetaEntity metaEntity);
-
- @Delete("DELETE FROM meta WHERE id = #{id}")
- void deleteById(MetaEntity metaEntity);
+ @Update("UPDATE meta SET status = 0 WHERE id = #{id}")
+ void deActive(MetaEntity metaEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java
index 4c6e8ceb..54751ef7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java
@@ -23,6 +23,7 @@
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@@ -34,6 +35,9 @@
@Mapper
public interface RuntimeMapper {
+ @Select("SELECT COUNT(*) FROM runtime WHERE cluster_id=#{clusterId} AND status=1")
+ Integer getRuntimeNumByCluster(RuntimeEntity runtimeEntity);
+
@Select("SELECT * FROM runtime WHERE status=1")
List selectAll();
@@ -48,17 +52,36 @@ public interface RuntimeMapper {
void batchInsert(List runtimeEntities);
@Insert("INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, "
- + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},#{startTimestamp},#{rack},#{status},#{endpointMap})")
+ + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},#{startTimestamp},#{rack},#{status},#{endpointMap})"
+ + " ON DUPLICATE KEY UPDATE status=1,start_timestamp = now()")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addRuntime(RuntimeEntity runtimeEntity);
@Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND status=1")
List selectRuntimeByCluster(RuntimeEntity runtimeEntity);
+ @Select({
+ ""})
+ List getRuntimesToFrontByCluster(@Param("runtimeEntity") RuntimeEntity runtimeEntity);
+
+ @Select("SELECT * FROM runtime WHERE host = #{host} and port = #{port} and status = 1")
+ List selectByHostPort(RuntimeEntity runtimeEntity);
+
@Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND status=1")
void updateRuntimeByCluster(RuntimeEntity runtimeEntity);
@Delete("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}")
void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
+ @Update("UPDATE runtime SET status = 0 WHERE id = #{id}")
+ void deActive(RuntimeEntity runtimeEntity);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java
index 804a3711..5e5ee418 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java
@@ -36,6 +36,9 @@ public interface StoreMapper {
@Select("SELECT * FROM store WHERE status=1")
List selectAll();
+ @Select("SELECT * FROM store WHERE id=#{id} AND status=1")
+ StoreEntity selectById(StoreEntity storeEntity);
+
@Insert({
""})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void batchInsert(List topicEntities);
- @Select("SELECT count(*) FROM topic WHERE cluster_id=#{clusterId}")
+ @Select("SELECT count(*) FROM topic WHERE cluster_id=#{clusterId} AND status=1")
Integer selectTopicNumByCluster(TopicEntity topicEntity);
@Select({
@@ -66,15 +67,33 @@ public interface TopicMapper {
""})
List getTopicList(TopicEntity topicEntity);
- @Insert("INSERT INTO topic (cluster_id, topic_name, runtime_id, storage_id, retention_ms, type, description) "
- + "VALUE (#{clusterId},#{topicName},#{runtimeId},#{storageId},#{retentionMs},#{type},#{description})"
+ @Insert("INSERT INTO topic (cluster_id, topic_name, storage_id, retention_ms, type, description, create_progress) "
+ + "VALUE (#{clusterId},#{topicName},#{storageId},#{retentionMs},#{type},#{description},#{createProgress})"
+ "ON DUPLICATE KEY UPDATE status = 1")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addTopic(TopicEntity topicEntity);
+ @Select("SELECT * FROM topic WHERE status=1 AND cluster_id=#{clusterId}")
+ List selectAllByClusterId(TopicEntity topicEntity);
+
+ @Select({
+ ""})
+ List getTopicsToFrontByClusterId(@Param("topicEntity") TopicEntity topicEntity);
+
@Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}")
void updateTopic(TopicEntity topicEntity);
+ @Update("UPDATE topic SET create_progress=#{createProgress} WHERE id=#{id}")
+ void updateTopicCreateProgress(TopicEntity topicEntity);
+
@Delete("UPDATE `topic` SET status=0 WHERE id=#{id}")
void deleteTopic(TopicEntity topicEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java
new file mode 100644
index 00000000..d0bdc23c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java
@@ -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.eventmesh.dashboard.console.modle.dto.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ChangeConfigDTO {
+
+ private String configName;
+
+ private String configValue;
+
+ private Integer alreadyUpdate;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java
new file mode 100644
index 00000000..bda02fa5
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java
@@ -0,0 +1,39 @@
+/*
+ * 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.modle.dto.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DetailConfigsVO {
+
+ private String configName;
+
+ private String configValue;
+
+ private String defaultValue;
+
+ private Integer isModify;
+
+ private Integer alreadyUpdate;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DynamicGetConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DynamicGetConfigDTO.java
new file mode 100644
index 00000000..30579715
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DynamicGetConfigDTO.java
@@ -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.eventmesh.dashboard.console.modle.dto.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DynamicGetConfigDTO {
+
+ private String configName;
+
+ private Integer isModify;
+
+ private Integer alreadyUpdate;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java
new file mode 100644
index 00000000..878f0fd4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java
@@ -0,0 +1,36 @@
+/*
+ * 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.modle.dto.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class GetConfigsListDTO {
+
+ private String businessType;
+
+ private Long instanceId;
+
+ private Integer instanceType;
+
+ private DynamicGetConfigDTO dynamicGetConfigDto;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java
new file mode 100644
index 00000000..8c273b81
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java
@@ -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.eventmesh.dashboard.console.modle.dto.config;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class UpdateConfigDTO {
+
+ private Long clusterId;
+
+ private List changeConfigDTOS;
+
+ private String username;
+
+ private Integer instanceType;
+
+ private Long instanceId;
+}
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/modle/dto/config/UpdateConfigsLog.java
similarity index 68%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/DeleteTopicRequest.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java
index da793b32..9619c7f1 100644
--- 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/modle/dto/config/UpdateConfigsLog.java
@@ -15,25 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.dto;
+package org.apache.eventmesh.dashboard.console.modle.dto.config;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
-/**
- * TODO this class is copied from storage plugin, needs update
- */
-
+@NoArgsConstructor
+@AllArgsConstructor
@Data
-public class DeleteTopicRequest {
+public class UpdateConfigsLog {
+
+ private Long instanceId;
+
+ private Long clusterId;
private String name;
- @JsonCreator
- public DeleteTopicRequest(@JsonProperty("name") String name) {
- super();
- this.name = name;
- }
+ private String configProperties;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java
new file mode 100644
index 00000000..0a7c23e2
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java
@@ -0,0 +1,54 @@
+/*
+ * 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.modle.dto.connection;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class AddConnectionDTO {
+
+ private String sinkName;
+
+ private String sourceName;
+
+ private String sinkClass;
+
+ private String sourceClass;
+
+ private String topicName;
+
+ private String sinkHost;
+
+ private String sourceHost;
+
+ private Integer sinkPort;
+
+ private Integer sourcePort;
+
+ private String sinkDescription;
+
+ private String sourceDescription;
+
+ private String connectionDescription;
+
+ private Long groupId;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java
new file mode 100644
index 00000000..fe99cf97
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java
@@ -0,0 +1,37 @@
+/*
+ * 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.modle.dto.connection;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class AddConnectorConfigDTO {
+
+ private List sinkConnectorConfigs;
+
+ private List sourceConnectorConfigs;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java
new file mode 100644
index 00000000..1a63e0a7
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java
@@ -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.eventmesh.dashboard.console.modle.dto.connection;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class CreateConnectionDTO {
+
+ private Long clusterId;
+
+ private AddConnectionDTO addConnectionDTO;
+
+ private AddConnectorConfigDTO addConnectorConfigDTO;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/DynamicGetConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/DynamicGetConnectionDTO.java
new file mode 100644
index 00000000..90cce7ad
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/DynamicGetConnectionDTO.java
@@ -0,0 +1,31 @@
+/*
+ * 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.modle.dto.connection;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DynamicGetConnectionDTO {
+
+ private String topicName;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java
new file mode 100644
index 00000000..e2a7b514
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java
@@ -0,0 +1,33 @@
+/*
+ * 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.modle.dto.connection;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class GetConnectionListDTO {
+
+ private Long clusterId;
+
+ private DynamicGetConnectionDTO dynamicGetConnectionDTO;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/DynamicGetRuntimeDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/DynamicGetRuntimeDTO.java
new file mode 100644
index 00000000..a352d850
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/DynamicGetRuntimeDTO.java
@@ -0,0 +1,30 @@
+/*
+ * 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.modle.dto.runtime;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DynamicGetRuntimeDTO {
+
+ private String host;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java
new file mode 100644
index 00000000..8237c0e8
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java
@@ -0,0 +1,33 @@
+/*
+ * 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.modle.dto.runtime;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class GetRuntimeListDTO {
+
+ private Long clusterId;
+
+ private DynamicGetRuntimeDTO dynamicGetRuntimeDTO;
+
+}
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/modle/dto/topic/CreateTopicDTO.java
similarity index 74%
rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/CreateTopicRequest.java
rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/CreateTopicDTO.java
index c84cee47..c8c2ac94 100644
--- 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/modle/dto/topic/CreateTopicDTO.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.console.dto;
+package org.apache.eventmesh.dashboard.console.modle.dto.topic;
+
+import java.sql.Timestamp;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@@ -27,13 +27,19 @@
*/
@Data
-public class CreateTopicRequest {
+public class CreateTopicDTO {
+
+ private Long clusterId;
private String name;
- @JsonCreator
- public CreateTopicRequest(@JsonProperty("name") String name) {
- super();
- this.name = name;
- }
+ private String description;
+
+ private Integer partitionsNums;
+
+ private Integer replicasNums;
+
+ private Timestamp saveTime;
+
+ private Integer cleanupStrategy;
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/DynamicGetTopicDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/DynamicGetTopicDTO.java
new file mode 100644
index 00000000..7b0ba66b
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/DynamicGetTopicDTO.java
@@ -0,0 +1,30 @@
+/*
+ * 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.modle.dto.topic;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class DynamicGetTopicDTO {
+
+ private String topicName;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java
new file mode 100644
index 00000000..2c054f30
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java
@@ -0,0 +1,33 @@
+/*
+ * 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.modle.dto.topic;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class GetTopicListDTO {
+
+ private Long clusterId;
+
+ private DynamicGetTopicDTO dynamicGetTopicDTO;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java
new file mode 100644
index 00000000..3c4c9f72
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java
@@ -0,0 +1,37 @@
+/*
+ * 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.modle.vo.cluster;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class GetClusterBaseMessageVO {
+
+ private Integer topicNum;
+
+ private Integer consumerGroupNum;
+
+ private Integer connectionNum;
+
+ private Integer runtimeNum;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java
new file mode 100644
index 00000000..13794078
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java
@@ -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.eventmesh.dashboard.console.modle.vo.cluster;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ResourceNumVO {
+
+ private Integer topicsNum;
+
+ private Integer connectionsNum;
+
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java
new file mode 100644
index 00000000..a9b40829
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java
@@ -0,0 +1,45 @@
+/*
+ * 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.modle.vo.connection;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ConnectionListVO {
+
+ private Long sinkConnectorId;
+
+ private String sinkConnectorName;
+
+ private Long sourceConnectorId;
+
+ private String sourceConnectorName;
+
+ private String sinkClass;
+
+ private String sourceClass;
+
+ private Integer status;
+
+ private String topicName;
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java
new file mode 100644
index 00000000..2277c10c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java
@@ -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.eventmesh.dashboard.console.modle.vo.health;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class InstanceLiveProportionVo {
+
+ private Integer abnormalNum;
+
+ private Integer allNum;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java
new file mode 100644
index 00000000..aebeb7a4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java
@@ -0,0 +1,38 @@
+/*
+ * 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.modle.vo.topic;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class TopicDetailGroupVO {
+
+ private String groupName;
+
+ private List topics;
+
+ private String state;
+
+ private Integer memberNum;
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java
index 22a0712d..d9d3bd9d 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java
@@ -29,4 +29,6 @@ public interface ClientDataService {
List selectAll();
void batchInsert(List clientEntityList);
+
+ List selectByHostPort(String host, Integer port);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java
index 7a153fc2..d3da03cd 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java
@@ -41,4 +41,12 @@ public List selectAll() {
public void batchInsert(List clientEntityList) {
clientMapper.batchInsert(clientEntityList);
}
+
+ @Override
+ public List selectByHostPort(String host, Integer port) {
+ ClientEntity query = new ClientEntity();
+ query.setHost(host);
+ query.setPort(port);
+ return clientMapper.selectByHostPort(query);
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
index 754c2235..a0020bd2 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java
@@ -17,7 +17,10 @@
package org.apache.eventmesh.dashboard.console.service.cluster;
+
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
+import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO;
import java.util.List;
@@ -26,6 +29,10 @@
*/
public interface ClusterService {
+ GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId);
+
+ ResourceNumVO getResourceNumByCluster(Long clusterId);
+
void batchInsert(List clusterEntities);
List selectAll();
@@ -34,7 +41,7 @@ public interface ClusterService {
List selectAllCluster();
- ClusterEntity selectClusterById(ClusterEntity cluster);
+ ClusterEntity selectClusterById(Long cluster);
void updateClusterById(ClusterEntity cluster);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
index f4b7e9ab..4bedfe7c 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java
@@ -18,7 +18,17 @@
package org.apache.eventmesh.dashboard.console.service.cluster.impl;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
+import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity;
+import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
+import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper;
+import org.apache.eventmesh.dashboard.console.mapper.connection.ConnectionMapper;
+import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper;
+import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper;
+import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper;
+import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
+import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;
import java.util.List;
@@ -30,9 +40,53 @@
@Service
public class ClusterServiceImpl implements ClusterService {
+ @Autowired
+ private ConnectionMapper connectionMapper;
+
@Autowired
private ClusterMapper clusterMapper;
+ @Autowired
+ private RuntimeMapper runtimeMapper;
+
+ @Autowired
+ private OprGroupMapper oprGroupMapper;
+
+ @Autowired
+ private TopicMapper topicMapper;
+
+
+ @Override
+ public GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId) {
+ GetClusterBaseMessageVO getClusterBaseMessageVO = new GetClusterBaseMessageVO();
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setClusterId(clusterId);
+ getClusterBaseMessageVO.setTopicNum(topicMapper.selectTopicNumByCluster(topicEntity));
+ GroupEntity groupEntity = new GroupEntity();
+ groupEntity.setClusterId(clusterId);
+ getClusterBaseMessageVO.setConsumerGroupNum(oprGroupMapper.getConsumerNumByCluster(groupEntity));
+ ConnectionEntity connectionEntity = new ConnectionEntity();
+ connectionEntity.setClusterId(clusterId);
+ getClusterBaseMessageVO.setConnectionNum(connectionMapper.selectConnectionNumByCluster(connectionEntity));
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterId);
+ getClusterBaseMessageVO.setRuntimeNum(runtimeMapper.getRuntimeNumByCluster(runtimeEntity));
+ return getClusterBaseMessageVO;
+ }
+
+ @Override
+ public ResourceNumVO getResourceNumByCluster(Long clusterId) {
+ ConnectionEntity connectionEntity = new ConnectionEntity();
+ connectionEntity.setClusterId(clusterId);
+ Integer connectionNumByCluster = connectionMapper.selectConnectionNumByCluster(connectionEntity);
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setClusterId(clusterId);
+ Integer topicNumByCluster = topicMapper.selectTopicNumByCluster(topicEntity);
+ ResourceNumVO resourceNumVO = new ResourceNumVO(topicNumByCluster, connectionNumByCluster);
+ return resourceNumVO;
+ }
+
+
@Override
public void batchInsert(List clusterEntities) {
clusterMapper.batchInsert(clusterEntities);
@@ -54,8 +108,10 @@ public List selectAllCluster() {
}
@Override
- public ClusterEntity selectClusterById(ClusterEntity cluster) {
- return clusterMapper.selectClusterById(cluster);
+ public ClusterEntity selectClusterById(Long clusterId) {
+ ClusterEntity clusterEntity = new ClusterEntity();
+ clusterEntity.setId(clusterId);
+ return clusterMapper.selectClusterById(clusterEntity);
}
@Override
@@ -65,7 +121,7 @@ public void updateClusterById(ClusterEntity cluster) {
@Override
public void deleteClusterById(ClusterEntity cluster) {
- clusterMapper.deleteClusterById(cluster);
+ clusterMapper.deActive(cluster);
}
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java
index c05d5da2..d564f1d0 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java
@@ -19,6 +19,8 @@
import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.DynamicGetConfigDTO;
import java.util.List;
import java.util.Map;
@@ -29,6 +31,10 @@
*/
public interface ConfigService {
+ List selectToFront(Long instanceId, Integer type, DynamicGetConfigDTO dynamicGetConfigDto);
+
+ void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List changeConfigDTOList);
+
List selectAll();
void batchInsert(List configEntityList);
@@ -41,11 +47,12 @@ public interface ConfigService {
String mapToProperties(Map stringMap);
+ Map propertiesToMap(String configProperties);
+
+ List selectByInstanceIdAndType(Long instanceId, Integer type);
- List selectByInstanceId(ConfigEntity configEntity);
+ Map selectDefaultConfig(String version, Long instanceId, Integer instanceType);
- List selectDefaultConfig(ConfigEntity configEntity);
- void updateConfig(ConfigEntity configEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java
index b8d32b45..b443e76b 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java
@@ -17,14 +17,23 @@
package org.apache.eventmesh.dashboard.console.service.config.Impl;
+import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.config.DefaultConfigKey;
import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.DynamicGetConfigDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigsLog;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.Yaml;
@@ -36,6 +45,86 @@ public class ConfigServiceImpl implements ConfigService {
@Autowired
ConfigMapper configMapper;
+ private Map defaultConfigCache = new HashMap<>();
+
+
+ @EmLog(OprTarget = "Runtime", OprType = "UpdateConfigs")
+ public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceType(0);
+ config.setInstanceId(updateConfigsLog.getInstanceId());
+ config.setConfigName(n.getConfigName());
+ config.setConfigValue(n.getConfigValue());
+ config.setAlreadyUpdate(n.getAlreadyUpdate());
+ configMapper.updateConfig(config);
+ });
+ }
+
+
+ @EmLog(OprTarget = "store", OprType = "UpdateConfigs")
+ public void logUpdateStoreConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceType(1);
+ config.setInstanceId(updateConfigsLog.getInstanceId());
+ config.setConfigName(n.getConfigName());
+ config.setConfigValue(n.getConfigValue());
+ config.setAlreadyUpdate(n.getAlreadyUpdate());
+ configMapper.updateConfig(config);
+ });
+ }
+
+
+ @EmLog(OprTarget = "Connector", OprType = "UpdateConfigs")
+ public void logUpdateConnectorConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceType(2);
+ config.setInstanceId(updateConfigsLog.getInstanceId());
+ config.setConfigName(n.getConfigName());
+ config.setConfigValue(n.getConfigValue());
+ config.setAlreadyUpdate(n.getAlreadyUpdate());
+ configMapper.updateConfig(config);
+ });
+ }
+
+
+ @EmLog(OprTarget = "Topic", OprType = "UpdateConfigs")
+ public void logUpdateTopicConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) {
+ changeConfigDTOList.forEach(n -> {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceType(3);
+ config.setInstanceId(updateConfigsLog.getInstanceId());
+ config.setConfigName(n.getConfigName());
+ config.setConfigValue(n.getConfigValue());
+ config.setAlreadyUpdate(n.getAlreadyUpdate());
+ configMapper.updateConfig(config);
+ });
+ }
+
+ @Override
+ public void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId,
+ List changeConfigDTOList) {
+ ConcurrentHashMap stringStringConcurrentHashMap = new ConcurrentHashMap<>();
+ changeConfigDTOList.forEach(n -> {
+ stringStringConcurrentHashMap.put(n.getConfigName(), n.getConfigValue());
+ });
+ UpdateConfigsLog updateConfigsLog =
+ new UpdateConfigsLog(instanceId, clusterId, name, this.mapToProperties(stringStringConcurrentHashMap));
+ ConfigServiceImpl service = (ConfigServiceImpl) AopContext.currentProxy();
+ if (instanceType == 0) {
+ service.logUpdateRuntimeConfigs(updateConfigsLog, changeConfigDTOList);
+ } else if (instanceType == 1) {
+ service.logUpdateStoreConfigs(updateConfigsLog, changeConfigDTOList);
+ } else if (instanceType == 2) {
+ service.logUpdateConnectorConfigs(updateConfigsLog, changeConfigDTOList);
+ } else if (instanceType == 3) {
+ service.logUpdateTopicConfigs(updateConfigsLog, changeConfigDTOList);
+ }
+ }
+
+
@Override
public List selectAll() {
return configMapper.selectAll();
@@ -61,6 +150,19 @@ public String mapToProperties(Map stringMap) {
return properties.toString().replace(",", ",\n");
}
+ @Override
+ public Map propertiesToMap(String configProperties) {
+ ConcurrentHashMap stringStringConcurrentHashMap = new ConcurrentHashMap<>();
+ String replace = configProperties.replace("{", "");
+ String replace1 = replace.replace("}", "");
+ String[] split = replace1.split(",");
+ Arrays.stream(split).forEach(n -> {
+ String[] split1 = n.split("=");
+ stringStringConcurrentHashMap.put(split1[0].replace("\n ", ""), split1[1]);
+ });
+ return stringStringConcurrentHashMap;
+ }
+
@Override
public Integer addConfig(ConfigEntity configEntity) {
return configMapper.addConfig(configEntity);
@@ -72,19 +174,58 @@ public Integer deleteConfig(ConfigEntity configEntity) {
}
@Override
- public List selectByInstanceId(ConfigEntity configEntity) {
- return configMapper.selectByInstanceId(configEntity);
+ public List selectByInstanceIdAndType(Long instanceId, Integer type) {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceId(instanceId);
+ config.setInstanceType(type);
+ return configMapper.selectByInstanceId(config);
}
- @Override
- public List selectDefaultConfig(ConfigEntity configEntity) {
- return configMapper.selectDefaultConfig(configEntity);
+ public ConfigEntity setSearchCriteria(DynamicGetConfigDTO dynamicGetConfigDto, ConfigEntity configEntity) {
+ if (dynamicGetConfigDto != null) {
+ if (dynamicGetConfigDto.getConfigName() != null) {
+ configEntity.setConfigName(dynamicGetConfigDto.getConfigName());
+ }
+ if (dynamicGetConfigDto.getIsModify() != null) {
+ configEntity.setIsModify(dynamicGetConfigDto.getIsModify());
+ }
+ if (dynamicGetConfigDto.getAlreadyUpdate() != null) {
+ configEntity.setAlreadyUpdate(dynamicGetConfigDto.getAlreadyUpdate());
+ }
+ }
+ return configEntity;
}
@Override
- public void updateConfig(ConfigEntity configEntity) {
- configMapper.updateConfig(configEntity);
+ public List selectToFront(Long instanceId, Integer type, DynamicGetConfigDTO dynamicGetConfigDto) {
+ ConfigEntity config = new ConfigEntity();
+ config.setInstanceId(instanceId);
+ config.setInstanceType(type);
+ config = this.setSearchCriteria(dynamicGetConfigDto, config);
+ return configMapper.getConfigsToFrontWithDynamic(config);
+ }
+
+ public void addDefaultConfigToCache() {
+ List configEntityList = configMapper.selectAllDefaultConfig();
+ configEntityList.forEach(n -> {
+ DefaultConfigKey defaultConfigKey = new DefaultConfigKey(n.getBusinessType(), n.getConfigName());
+ defaultConfigCache.putIfAbsent(defaultConfigKey, n.getConfigValue());
+
+ });
}
+ @Override
+ public Map selectDefaultConfig(String businessType, Long instanceId, Integer instanceType) {
+ if (defaultConfigCache.size() == 0) {
+ this.addDefaultConfigToCache();
+ }
+ ConcurrentHashMap stringStringConcurrentHashMap = new ConcurrentHashMap<>();
+ defaultConfigCache.forEach((k, v) -> {
+ if (k.getBusinessType().equals(businessType)) {
+ stringStringConcurrentHashMap.put(k.getConfigName(), v);
+ }
+ });
+ return stringStringConcurrentHashMap;
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java
index 59351866..c24bb9f4 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java
@@ -52,7 +52,8 @@ public void synchronousConnectorConfig(Long clusterId) {
ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());
- ConcurrentHashMap connectorConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+ ConcurrentHashMap connectorConfigMapFromDb =
+ this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType()));
ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java
index 51ee24f1..aa3297c9 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java
@@ -55,7 +55,8 @@ public void synchronousRuntimeConfig(Long clusterId) {
ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, runtimeEntity.getId());
- ConcurrentHashMap runtimeConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+ ConcurrentHashMap runtimeConfigMapFromDb =
+ this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType()));
ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java
index f5235b0a..4a5b0209 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java
@@ -46,34 +46,34 @@ public class SyncStoreConfigTask {
private ConfigService configService;
public void synchronousStoreConfig(Long clusterId) {
- List storeEntityList = storeService.selectStoreByCluster(clusterId);
- for (StoreEntity storeEntity : storeEntityList) {
+ StoreEntity storeEntity = storeService.selectStoreByCluster(clusterId);
- ConcurrentHashMap storeConfigMapFromInstance = this.configListToMap(
- storeConfigService.getStorageConfigFromInstance(clusterId, storeEntity.getHost()));
+ ConcurrentHashMap storeConfigMapFromInstance = this.configListToMap(
+ storeConfigService.getStorageConfigFromInstance(clusterId, storeEntity.getHost()));
- ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, storeEntity.getId());
+ ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, storeEntity.getId());
- ConcurrentHashMap storeConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+ ConcurrentHashMap storeConfigMapFromDb =
+ this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType()));
- ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>();
+ ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>();
- storeConfigMapFromInstance.entrySet().forEach(n -> {
- if (storeConfigMapFromDb.remove(n.getKey(), n.getValue())) {
- storeConfigMapFromInstance.remove(n.getKey());
- }
- if (storeConfigMapFromDb.get(n.getKey()) != null) {
- updateConfigMap.put(n.getKey(), storeConfigMapFromDb.get(n.getKey()));
- storeConfigMapFromInstance.remove(n.getKey());
- storeConfigMapFromDb.remove(n.getKey());
- }
- });
- //add storeConfigMapFromDb
+ storeConfigMapFromInstance.entrySet().forEach(n -> {
+ if (storeConfigMapFromDb.remove(n.getKey(), n.getValue())) {
+ storeConfigMapFromInstance.remove(n.getKey());
+ }
+ if (storeConfigMapFromDb.get(n.getKey()) != null) {
+ updateConfigMap.put(n.getKey(), storeConfigMapFromDb.get(n.getKey()));
+ storeConfigMapFromInstance.remove(n.getKey());
+ storeConfigMapFromDb.remove(n.getKey());
+ }
+ });
+ //add storeConfigMapFromDb
+
+ //update updateConfigMap
- //update updateConfigMap
+ //delete storeConfigMapFromInstance
- //delete storeConfigMapFromInstance
- }
}
private ConcurrentHashMap configListToMap(List configEntityList) {
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java
index eada0b97..4df55e05 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java
@@ -54,7 +54,8 @@ public void synchronousTopicConfig(Long clusterId) {
ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, topicEntity.getId());
- ConcurrentHashMap topicConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+ ConcurrentHashMap topicConfigMapFromDb =
+ this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType()));
ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>();
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java
index e4db317d..29e430c3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java
@@ -17,7 +17,12 @@
package org.apache.eventmesh.dashboard.console.service.connection;
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
import java.util.List;
@@ -26,11 +31,22 @@
*/
public interface ConnectionDataService {
- Integer selectConnectionNumByCluster(Long clusterId);
+ ConnectorEntity getConnectorById(Long connectorId);
- List getAllConnections();
+ List getConnectorBusinessType(String type);
List getAllConnectionsByClusterId(Long clusterId);
+ boolean createConnection(CreateConnectionDTO createConnectionDTO);
+
+ List getAllConnections();
+
+ List getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO);
+
void replaceAllConnections(List connectionEntityList);
+
+
+ List getConnectorConfigsByClassAndVersion(String classType, String version);
+
+ Long insert(ConnectionEntity connectionEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionService.java
deleted file mode 100644
index 3faedd68..00000000
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionService.java
+++ /dev/null
@@ -1,50 +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.service.connection;
-
-import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity;
-import org.apache.eventmesh.dashboard.console.service.connection.impl.ConnectionDataServiceDatabaseImpl;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-public class ConnectionService {
- @Autowired
- ConnectionDataService metaConnectionService;
-
- @Autowired
- ConnectionDataServiceDatabaseImpl databaseConnectionService;
-
- public void syncConnection() {
- try {
- List connectionEntityList = metaConnectionService.getAllConnections();
- databaseConnectionService.replaceAllConnections(connectionEntityList);
- } catch (Exception e) {
- log.error("sync connection info from {} to {} failed for reason:{}.",
- metaConnectionService.getClass().getSimpleName(),
- databaseConnectionService.getClass().getSimpleName(),
- e.getMessage());
- }
- }
-}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java
index b8c66348..974a50a7 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java
@@ -17,10 +17,22 @@
package org.apache.eventmesh.dashboard.console.service.connection.impl;
+
+import org.apache.eventmesh.dashboard.console.annotation.EmLog;
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
import org.apache.eventmesh.dashboard.console.mapper.connection.ConnectionMapper;
+import org.apache.eventmesh.dashboard.console.mapper.connector.ConnectorMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.DynamicGetConnectionDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -36,6 +48,26 @@ public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService
@Autowired
private ConnectionMapper connectionMapper;
+ @Autowired
+ private ConnectorMapper connectorMapper;
+
+ @Autowired
+ private ConfigMapper configMapper;
+
+
+ @Override
+ public ConnectorEntity getConnectorById(Long connectorId) {
+ ConnectorEntity connectorEntity = new ConnectorEntity();
+ connectorEntity.setId(connectorId);
+ return connectorMapper.selectById(connectorEntity);
+ }
+
+ @Override
+ public List getConnectorBusinessType(String type) {
+ ConfigEntity config = new ConfigEntity();
+ config.setBusinessType(type);
+ return configMapper.selectConnectorBusinessType(config);
+ }
@Override
public List getAllConnectionsByClusterId(Long clusterId) {
@@ -44,19 +76,121 @@ public List getAllConnectionsByClusterId(Long clusterId) {
return connectionMapper.selectByClusterId(connectionEntity);
}
+ @Override
+ public Long insert(ConnectionEntity connectionEntity) {
+ return connectionMapper.insert(connectionEntity);
+ }
+
+ @EmLog(OprType = "add", OprTarget = "Connection")
@Override
- public Integer selectConnectionNumByCluster(Long clusterId) {
+ public boolean createConnection(CreateConnectionDTO createConnectionDTO) {
+ ConnectorEntity sinkConnector = this.createSinkConnector(createConnectionDTO.getClusterId(), createConnectionDTO.getAddConnectionDTO());
+ ConnectorEntity sourceConnector = this.createSourceConnector(createConnectionDTO.getClusterId(), createConnectionDTO.getAddConnectionDTO());
+ ConnectionEntity connectionEntity = this.setConnection(createConnectionDTO);
+ connectionEntity.setSinkId(sinkConnector.getId());
+ connectionEntity.setSourceId(sourceConnector.getId());
+ connectionMapper.insert(connectionEntity);
+ this.addConnectorConfigs(createConnectionDTO.getAddConnectorConfigDTO().getSinkConnectorConfigs(), sinkConnector);
+ this.addConnectorConfigs(createConnectionDTO.getAddConnectorConfigDTO().getSourceConnectorConfigs(), sourceConnector);
+ return false;
+ }
+
+ private ConnectionEntity setConnection(CreateConnectionDTO createConnectionDTO) {
ConnectionEntity connectionEntity = new ConnectionEntity();
- connectionEntity.setClusterId(clusterId);
- return connectionMapper.selectConnectionNumByCluster(connectionEntity);
+ connectionEntity.setClusterId(createConnectionDTO.getClusterId());
+ connectionEntity.setSourceType("connector");
+ connectionEntity.setSinkType("connector");
+ connectionEntity.setRuntimeId(-1L);
+ connectionEntity.setGroupId(createConnectionDTO.getAddConnectionDTO().getGroupId());
+ connectionEntity.setStatus(1);
+ connectionEntity.setDescription(createConnectionDTO.getAddConnectionDTO().getConnectionDescription());
+ connectionEntity.setTopic(createConnectionDTO.getAddConnectionDTO().getTopicName());
+ return connectionEntity;
}
+ public void addConnectorConfigs(List configEntityList, ConnectorEntity connectorEntity) {
+ configEntityList.forEach(n -> {
+ n.setInstanceId(connectorEntity.getId());
+ n.setIsDefault(0);
+ n.setClusterId(connectorEntity.getClusterId());
+ });
+ configMapper.batchInsert(configEntityList);
+ }
+
+ public ConnectorEntity createSinkConnector(Long clusterId, AddConnectionDTO addConnectionDTO) {
+ ConnectorEntity connectorEntity = new ConnectorEntity();
+ connectorEntity.setName(addConnectionDTO.getSinkName());
+ connectorEntity.setHost(addConnectionDTO.getSinkHost());
+ connectorEntity.setClusterId(clusterId);
+ connectorEntity.setClassName(addConnectionDTO.getSinkClass());
+ connectorEntity.setType("Connector");
+ connectorEntity.setStatus(1);
+ connectorEntity.setPodState(0);
+ connectorEntity.setPort(addConnectionDTO.getSinkPort());
+ connectorMapper.insert(connectorEntity);
+ return connectorEntity;
+ }
+
+ public ConnectorEntity createSourceConnector(Long clusterId, AddConnectionDTO addConnectionDTO) {
+ ConnectorEntity connectorEntity = new ConnectorEntity();
+ connectorEntity.setName(addConnectionDTO.getSourceName());
+ connectorEntity.setHost(addConnectionDTO.getSourceHost());
+ connectorEntity.setClusterId(clusterId);
+ connectorEntity.setClassName(addConnectionDTO.getSourceClass());
+ connectorEntity.setType("Connector");
+ connectorEntity.setStatus(1);
+ connectorEntity.setPodState(0);
+ connectorEntity.setPort(addConnectionDTO.getSourcePort());
+ connectorMapper.insert(connectorEntity);
+ return connectorEntity;
+ }
+
+
@Override
public List getAllConnections() {
return connectionMapper.selectAll();
}
+ public ConnectionEntity setSearchCriteria(DynamicGetConnectionDTO dynamicGetConnectionDTO, ConnectionEntity connectionEntity) {
+ if (dynamicGetConnectionDTO != null) {
+ if (dynamicGetConnectionDTO.getTopicName() != null) {
+ connectionEntity.setTopic(dynamicGetConnectionDTO.getTopicName());
+ }
+ }
+ return connectionEntity;
+ }
+
+ @Override
+ public List getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO) {
+ ConnectionEntity connectionEntity = new ConnectionEntity();
+ connectionEntity.setClusterId(clusterId);
+ connectionEntity = this.setSearchCriteria(getConnectionListDTO.getDynamicGetConnectionDTO(), connectionEntity);
+ List allConnectionsByClusterId = connectionMapper.selectToFrontByClusterId(connectionEntity);
+ List connectionListVOs = new ArrayList<>();
+ allConnectionsByClusterId.forEach(n -> {
+ connectionListVOs.add(this.setConnectionListVO(n));
+ });
+ return connectionListVOs;
+ }
+
+ private ConnectionListVO setConnectionListVO(ConnectionEntity connectionEntity) {
+ ConnectionListVO connectionListVO = new ConnectionListVO();
+ ConnectorEntity connectorEntity = new ConnectorEntity();
+ connectorEntity.setId(connectionEntity.getSinkId());
+ ConnectorEntity sinkConnector = connectorMapper.selectById(connectorEntity);
+ connectorEntity.setId(connectionEntity.getSourceId());
+ ConnectorEntity sourceConnector = connectorMapper.selectById(connectorEntity);
+ connectionListVO.setSinkClass(sinkConnector.getClassName());
+ connectionListVO.setSourceClass(sourceConnector.getClassName());
+ connectionListVO.setSinkConnectorId(sinkConnector.getId());
+ connectionListVO.setSourceConnectorId(sourceConnector.getId());
+ connectionListVO.setSinkConnectorName(sinkConnector.getName());
+ connectionListVO.setSourceConnectorName(sourceConnector.getName());
+ connectionListVO.setTopicName(connectionEntity.getTopic());
+ connectionListVO.setStatus(connectionEntity.getStatus());
+ return connectionListVO;
+ }
@Override
@Transactional
@@ -90,5 +224,19 @@ public void replaceAllConnections(List connectionEntityList) {
}
});
}
+
+
+ @Override
+ public List getConnectorConfigsByClassAndVersion(String classType, String version) {
+ ConfigEntity config = new ConfigEntity();
+ config.setBusinessType(classType);
+ List configEntityList = configMapper.selectConnectorConfigsByBusinessType(config);
+ configEntityList.forEach(n -> {
+ if (!n.matchVersion(version)) {
+ configEntityList.remove(n);
+ }
+ });
+ return configEntityList;
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
index a32bbf9e..b5f05232 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java
@@ -27,4 +27,6 @@
public interface ConnectorDataService {
List selectConnectorByCluster(Long clusterId);
+
+ List selectByHostPort(ConnectorEntity connectorEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
index 7a9a7066..21d60e81 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java
@@ -38,4 +38,9 @@ public List selectConnectorByCluster(Long clusterId) {
connectorEntity.setClusterId(clusterId);
return connectorMapper.selectByClusterId(connectorEntity);
}
+
+ @Override
+ public List selectByHostPort(ConnectorEntity connectorEntity) {
+ return null;
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java
index 19e3715e..25faa8eb 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java
@@ -17,7 +17,9 @@
package org.apache.eventmesh.dashboard.console.service.health;
+
import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity;
+import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo;
import java.sql.Timestamp;
import java.util.List;
@@ -26,6 +28,11 @@
* Service providing data of HealthCheckResult.
*/
public interface HealthDataService {
+
+ InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType);
+
+ List getInstanceLiveStatusHistory(Integer type, Long clusterId, Timestamp startTime);
+
HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity);
void batchInsertHealthCheckResult(List healthCheckResultEntityList);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java
index f1593cc9..e4e2d852 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java
@@ -17,8 +17,15 @@
package org.apache.eventmesh.dashboard.console.service.health.impl;
+
import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity;
+import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
+import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper;
+import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper;
+import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper;
+import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo;
import org.apache.eventmesh.dashboard.console.service.health.HealthDataService;
import java.sql.Timestamp;
@@ -33,6 +40,68 @@ public class HealthDataServiceDatabaseImpl implements HealthDataService {
@Autowired
private HealthCheckResultMapper healthCheckResultMapper;
+ @Autowired
+ private RuntimeMapper runtimeMapper;
+
+ @Autowired
+ private TopicMapper topicMapper;
+
+
+ @Override
+ public InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType) {
+ InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo();
+ switch (instanceType) {
+ case 2:
+ instanceLiveProportionVo = this.getRuntimeLiveProportion(clusterId);
+ break;
+ case 3:
+ instanceLiveProportionVo = this.getTopicLiveProportion(clusterId);
+ break;
+ default:
+ break;
+ }
+ return instanceLiveProportionVo;
+ }
+
+ public InstanceLiveProportionVo getTopicLiveProportion(Long clusterId) {
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setClusterId(clusterId);
+ Integer topicNum = topicMapper.selectTopicNumByCluster(topicEntity);
+ List topicEntityList = topicMapper.selectTopicByCluster(topicEntity);
+ int abnormalNum = 0;
+ for (TopicEntity n : topicEntityList) {
+ if (CheckResultCache.getLastHealthyCheckResult("topic", n.getId()) == 0) {
+ abnormalNum++;
+ }
+ }
+ return new InstanceLiveProportionVo(abnormalNum, topicNum);
+ }
+
+
+ public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterId);
+ Integer topicNum = runtimeMapper.getRuntimeNumByCluster(runtimeEntity);
+ List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity);
+ int abnormalNum = 0;
+ for (RuntimeEntity n : runtimeEntities) {
+ if (CheckResultCache.getLastHealthyCheckResult("runtime", n.getId()) == 0) {
+ abnormalNum++;
+ }
+ }
+ return new InstanceLiveProportionVo(abnormalNum, topicNum);
+ }
+
+
+ @Override
+ public List getInstanceLiveStatusHistory(Integer type, Long instanceId, Timestamp startTime) {
+ HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity();
+ healthCheckResultEntity.setType(type);
+ healthCheckResultEntity.setTypeId(instanceId);
+ healthCheckResultEntity.setCreateTime(startTime);
+ return healthCheckResultMapper.getInstanceLiveStatusHistory(healthCheckResultEntity);
+ }
+
@Override
public HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity) {
healthCheckResultMapper.insert(healthCheckResultEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java
index d496ae6e..419dfa96 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java
@@ -21,15 +21,16 @@
import java.util.List;
+import org.springframework.stereotype.Service;
+
/**
- *
* operation service
- *
*/
+@Service
public interface LogService {
- List getLogListByCluster(LogEntity logEntity);
+ List getLogListByCluster(Integer pageIndex, Integer pageNum);
Long addLog(LogEntity logEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java
index 7bd680be..10f3328a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java
@@ -32,9 +32,8 @@ public class LogServiceImpl implements LogService {
OprLogMapper oprLogMapper;
@Override
- public List getLogListByCluster(LogEntity logEntity) {
-
- return oprLogMapper.getLogList(logEntity);
+ public List getLogListByCluster(Integer pageIndex, Integer pageNum) {
+ return oprLogMapper.getLogListToFront(pageIndex, pageNum);
}
@Override
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java
new file mode 100644
index 00000000..049dba9b
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java
@@ -0,0 +1,37 @@
+/*
+ * 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.service.registry;
+
+
+import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity;
+
+import java.util.List;
+
+/**
+ * Database service of registry(meta) such as nacos
+ */
+public interface RegistryDataService {
+
+ public List selectAll();
+
+ public List batchInsert(List metaEntities);
+
+ public Long insert(MetaEntity metaEntity);
+
+ public void deActive(MetaEntity metaEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java
new file mode 100644
index 00000000..dad6427c
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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.service.registry.impl;
+
+import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity;
+import org.apache.eventmesh.dashboard.console.mapper.meta.MetaMapper;
+import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RegistryDataServiceImpl implements RegistryDataService {
+
+ @Autowired
+ MetaMapper metaMapper;
+
+ public List selectAll() {
+ return metaMapper.selectAll();
+ }
+
+ @Override
+ public List batchInsert(List metaEntities) {
+ return metaMapper.batchInsert(metaEntities);
+ }
+
+ @Override
+ public Long insert(MetaEntity metaEntity) {
+ return metaMapper.insert(metaEntity);
+ }
+
+ @Override
+ public void deActive(MetaEntity metaEntity) {
+ metaMapper.deActive(metaEntity);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java
index da6cd0f6..114b9c8a 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java
@@ -17,8 +17,13 @@
package org.apache.eventmesh.dashboard.console.service.runtime.Impl;
+
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
+import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper;
import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.runtime.DynamicGetRuntimeDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO;
import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService;
import java.util.List;
@@ -32,6 +37,31 @@ public class RuntimeServiceImpl implements RuntimeService {
@Autowired
private RuntimeMapper runtimeMapper;
+ @Autowired
+ private HealthCheckResultMapper healthCheckResultMapper;
+
+ public RuntimeEntity setSearchCriteria(DynamicGetRuntimeDTO dynamicGetRuntimeDTO, RuntimeEntity runtimeEntity) {
+ if (dynamicGetRuntimeDTO != null) {
+ if (dynamicGetRuntimeDTO.getHost() != null) {
+ runtimeEntity.setHost(dynamicGetRuntimeDTO.getHost());
+ }
+ }
+ return runtimeEntity;
+ }
+
+ @Override
+ public List getRuntimeToFrontByClusterId(Long clusterId, GetRuntimeListDTO getRuntimeListDTO) {
+ RuntimeEntity runtimeEntity = new RuntimeEntity();
+ runtimeEntity.setClusterId(clusterId);
+ runtimeEntity = this.setSearchCriteria(getRuntimeListDTO.getDynamicGetRuntimeDTO(), runtimeEntity);
+ List runtimeByClusterId = runtimeMapper.getRuntimesToFrontByCluster(runtimeEntity);
+ runtimeByClusterId.forEach(n -> {
+ n.setStatus(CheckResultCache.getLastHealthyCheckResult("runtime", n.getId()));
+ });
+ return runtimeByClusterId;
+ }
+
+
@Override
public void batchInsert(List runtimeEntities) {
runtimeMapper.batchInsert(runtimeEntities);
@@ -46,9 +76,15 @@ public List selectAll() {
public List getRuntimeByClusterId(Long clusterId) {
RuntimeEntity runtimeEntity = new RuntimeEntity();
runtimeEntity.setClusterId(clusterId);
+
return runtimeMapper.selectRuntimeByCluster(runtimeEntity);
}
+ @Override
+ public List selectByHostPort(RuntimeEntity runtimeEntity) {
+ return runtimeMapper.selectByHostPort(runtimeEntity);
+ }
+
@Override
public void addRuntime(RuntimeEntity runtimeEntity) {
runtimeMapper.addRuntime(runtimeEntity);
@@ -63,4 +99,9 @@ public void updateRuntimeByCluster(RuntimeEntity runtimeEntity) {
public void deleteRuntimeByCluster(RuntimeEntity runtimeEntity) {
runtimeMapper.deleteRuntimeByCluster(runtimeEntity);
}
+
+ @Override
+ public void deActive(RuntimeEntity runtimeEntity) {
+ runtimeMapper.deActive(runtimeEntity);
+ }
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java
index 65f1a4e0..77a40359 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java
@@ -17,7 +17,9 @@
package org.apache.eventmesh.dashboard.console.service.runtime;
+
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO;
import java.util.List;
@@ -26,15 +28,21 @@
*/
public interface RuntimeService {
+ List getRuntimeToFrontByClusterId(Long clusterId, GetRuntimeListDTO getRuntimeListDTO);
+
void batchInsert(List runtimeEntities);
List selectAll();
List getRuntimeByClusterId(Long cluster);
+ List selectByHostPort(RuntimeEntity runtimeEntity);
+
void addRuntime(RuntimeEntity runtimeEntity);
void updateRuntimeByCluster(RuntimeEntity runtimeEntity);
void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);
+
+ void deActive(RuntimeEntity runtimeEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java
index db992e2a..da5ff0f3 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java
@@ -32,11 +32,32 @@ public class StoreServiceImpl implements StoreService {
@Autowired
private StoreMapper storeMapper;
+ @Override
+ public void updateConfigById(Long storeId) {
+
+ }
+
+
+ @Override
+ public StoreEntity getStoreToFrontListByCluster(Long clusterId) {
+ StoreEntity storeEntity = new StoreEntity();
+ storeEntity.setClusterId(clusterId);
+ return storeMapper.selectStoreByCluster(storeEntity);
+ }
+
+
@Override
public List selectAll() {
return storeMapper.selectAll();
}
+ @Override
+ public StoreEntity selectById(Long storeId) {
+ StoreEntity query = new StoreEntity();
+ query.setId(storeId);
+ return storeMapper.selectById(query);
+ }
+
@Override
public void batchInsert(List storeEntities) {
storeMapper.batchInsert(storeEntities);
@@ -53,7 +74,7 @@ public void deleteStoreByUnique(StoreEntity storeEntity) {
}
@Override
- public List selectStoreByCluster(Long clusterId) {
+ public StoreEntity selectStoreByCluster(Long clusterId) {
StoreEntity storeEntity = new StoreEntity();
storeEntity.setClusterId(clusterId);
return storeMapper.selectStoreByCluster(storeEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java
index 605b8b57..e7e9eb23 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java
@@ -26,15 +26,21 @@
*/
public interface StoreService {
+ void updateConfigById(Long storeId);
+
+ StoreEntity getStoreToFrontListByCluster(Long clusterId);
+
List selectAll();
+ StoreEntity selectById(Long storeId);
+
void batchInsert(List storeEntities);
void addStore(StoreEntity storeEntity);
void deleteStoreByUnique(StoreEntity storeEntity);
- List selectStoreByCluster(Long clusterId);
+ StoreEntity selectStoreByCluster(Long clusterId);
void updateStoreByUnique(StoreEntity storeEntity);
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java
index 3f0b986a..e3430527 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java
@@ -18,6 +18,9 @@
package org.apache.eventmesh.dashboard.console.service.topic;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
import java.util.List;
@@ -26,12 +29,14 @@
*/
public interface TopicService {
+ public List getTopicDetailGroups(Long topicId);
+
+ void createTopic(CreateTopicDTO topicRequest);
+
void batchInsert(List topicEntities);
List selectAll();
- Integer selectTopicNumByCluster(Long clusterId);
-
List getTopicList(TopicEntity topicEntity);
void addTopic(TopicEntity topicEntity);
@@ -40,11 +45,13 @@ public interface TopicService {
void deleteTopicById(TopicEntity topicEntity);
- TopicEntity selectTopicById(TopicEntity topicEntity);
+ TopicEntity selectTopicById(Long topicId);
TopicEntity selectTopicByUnique(TopicEntity topicEntity);
void deleteTopic(TopicEntity topicEntity);
List selectTopiByCluster(Long clusterId);
+
+ List getTopicListToFront(Long clusterId, GetTopicListDTO getTopicListDTO);
}
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 e15f7c48..653dc804 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
@@ -17,16 +17,32 @@
package org.apache.eventmesh.dashboard.console.service.topic;
+
+import org.apache.eventmesh.dashboard.console.annotation.EmLog;
+import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
+import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper;
import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper;
+import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper;
+import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper;
+import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.DynamicGetTopicDTO;
+import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO;
+import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO;
+import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
@Service
public class TopicServiceImpl implements TopicService {
@@ -36,6 +52,62 @@ public class TopicServiceImpl implements TopicService {
@Autowired
OprGroupMemberMapper oprGroupMemberMapper;
+ @Autowired
+ HealthCheckResultMapper healthCheckResultMapper;
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Autowired
+ RuntimeMapper runtimeMapper;
+
+ @Autowired
+ StoreMapper storeMapper;
+
+ @Autowired
+ OprGroupMapper groupMapper;
+
+
+ @Override
+ public List getTopicDetailGroups(Long topicId) {
+ TopicEntity topicEntity = this.selectTopicById(topicId);
+ GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
+ groupMemberEntity.setClusterId(topicEntity.getClusterId());
+ groupMemberEntity.setTopicName(topicEntity.getTopicName());
+ List groupNamelist = oprGroupMemberMapper.selectGroupNameByTopicName(groupMemberEntity);
+ ArrayList topicDetailGroupVOList = new ArrayList<>();
+ groupNamelist.forEach(n -> {
+ TopicDetailGroupVO topicDetailGroupVO = new TopicDetailGroupVO();
+ topicDetailGroupVO.setGroupName(n);
+ groupMemberEntity.setGroupName(n);
+ List list = oprGroupMemberMapper.selectTopicsByGroupNameAndClusterId(groupMemberEntity);
+ topicDetailGroupVO.setTopics(list);
+ GroupEntity groupEntity = new GroupEntity();
+ groupEntity.setClusterId(topicEntity.getClusterId());
+ groupEntity.setName(n);
+ GroupEntity group = groupMapper.selectGroupByNameAndClusterId(groupEntity);
+ topicDetailGroupVO.setMemberNum(group.getMemberCount());
+ topicDetailGroupVO.setState(group.getState());
+ topicDetailGroupVOList.add(topicDetailGroupVO);
+ });
+ return topicDetailGroupVOList;
+ }
+
+ @EmLog(OprType = "add", OprTarget = "topic")
+ @Override
+ public void createTopic(CreateTopicDTO createTopicDTO) {
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setType(0);
+ topicEntity.setClusterId(createTopicDTO.getClusterId());
+ topicEntity.setTopicName(createTopicDTO.getName());
+ topicEntity.setDescription(createTopicDTO.getDescription());
+ topicEntity.setRetentionMs(createTopicDTO.getSaveTime().getTime());
+ StoreEntity storeEntity = new StoreEntity();
+ storeEntity.setClusterId(topicEntity.getClusterId());
+ topicEntity.setStorageId(String.valueOf(storeMapper.selectStoreByCluster(storeEntity).getId()));
+ topicEntity.setCreateProgress(1);
+ topicMapper.addTopic(topicEntity);
+ }
@Override
public void batchInsert(List topicEntities) {
@@ -47,12 +119,7 @@ public List selectAll() {
return topicMapper.selectAll();
}
- @Override
- public Integer selectTopicNumByCluster(Long clusterId) {
- TopicEntity topicEntity = new TopicEntity();
- topicEntity.setClusterId(clusterId);
- return topicMapper.selectTopicNumByCluster(topicEntity);
- }
+
@Override
public List getTopicList(TopicEntity topicEntity) {
@@ -79,7 +146,9 @@ public void deleteTopicById(TopicEntity topicEntity) {
}
@Override
- public TopicEntity selectTopicById(TopicEntity topicEntity) {
+ public TopicEntity selectTopicById(Long topicId) {
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setId(topicId);
return topicMapper.selectTopicById(topicEntity);
}
@@ -88,12 +157,9 @@ public TopicEntity selectTopicByUnique(TopicEntity topicEntity) {
return topicMapper.selectTopicByUnique(topicEntity);
}
+
@Override
public void deleteTopic(TopicEntity topicEntity) {
- GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
- groupMemberEntity.setTopicName(topicEntity.getTopicName());
- groupMemberEntity.setState("empty");
- oprGroupMemberMapper.updateMemberByTopic(groupMemberEntity);
topicMapper.deleteTopic(topicEntity);
}
@@ -105,4 +171,26 @@ public List selectTopiByCluster(Long clusterId) {
}
+ public TopicEntity setSearchCriteria(DynamicGetTopicDTO dynamicGetTopicDTO, TopicEntity topicEntity) {
+ if (dynamicGetTopicDTO != null) {
+ if (dynamicGetTopicDTO.getTopicName() != null) {
+ topicEntity.setTopicName(dynamicGetTopicDTO.getTopicName());
+ }
+ }
+ return topicEntity;
+ }
+
+ @Override
+ public List getTopicListToFront(Long clusterId, GetTopicListDTO getTopicListDTO) {
+ TopicEntity topicEntity = new TopicEntity();
+ topicEntity.setClusterId(clusterId);
+ topicEntity = this.setSearchCriteria(getTopicListDTO.getDynamicGetTopicDTO(), topicEntity);
+ List topicEntityList = topicMapper.getTopicsToFrontByClusterId(topicEntity);
+ topicEntityList.forEach(n -> {
+ n.setStatus(CheckResultCache.getLastHealthyCheckResult("topic", n.getId()));
+ });
+ return topicEntityList;
+ }
+
+
}
diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
index 0e31fbd6..19b6c598 100644
--- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
+++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
@@ -20,7 +20,7 @@ create table cluster
id bigint unsigned auto_increment comment '集群id'
primary key,
name varchar(128) default '' not null comment '集群名称',
- register_name_list varchar(4096) default '' not null comment '注册中心名字',
+ registry_name_list varchar(4096) default '' not null comment '注册中心名字',
bootstrap_servers varchar(2048) default '' not null comment 'server地址',
eventmesh_version varchar(32) default '' not null comment 'eventmesh版本',
client_properties text null comment 'EventMesh客户端配置',
@@ -62,10 +62,12 @@ create table config
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
is_modify int default 0 not null,
+ already_update int default 0 not null comment '0:no,1:yes',
eventmesh_version varchar(64) default ' ' not null,
- constraint uniq_instance_type_instance_id_config_name
- unique (instance_id, config_name, instance_type)
-) comment '配置信息表';
+ constraint uniq_cluster_id_instance_type_instance_id_config_name
+ unique (instance_id, config_name, instance_type, cluster_id)
+)
+ comment '配置信息表';
create index idx_phy_id_instance_id
on config (cluster_id, instance_id);
@@ -149,7 +151,6 @@ create table store
store_id int default -1 not null comment 'storeId',
store_type varchar(32) default '' not null comment 'Store类型,如rocketmq,redis,...',
host varchar(128) default '' not null comment 'store主机名',
- runtime_id bigint default -1 not null comment 'runtimeId',
topic_list varchar(4096) default '' not null comment 'topicName列表',
diff_type int default -1 not null comment '差异类型',
port int default -1 not null comment 'store端口',
@@ -165,7 +166,7 @@ create table store
) comment 'Store信息表';
create index idx_store_id_runtime_id
- on store (store_id, cluster_id, runtime_id);
+ on store (store_id, cluster_id);
DROP TABLE IF EXISTS `instance_user`;
CREATE TABLE `instance_user`
@@ -243,7 +244,7 @@ CREATE TABLE `group_member`
`status` int NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`),
- KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
+ KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 257
DEFAULT CHARSET = utf8mb4,
@@ -254,9 +255,9 @@ DROP TABLE IF EXISTS `operation_log`;
CREATE TABLE `operation_log`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
- `operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改',
- `state` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败',
+ `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
+ `operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改',
+ `state` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败',
`content` varchar(1024) COMMENT '备注信息',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`end_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
@@ -279,15 +280,14 @@ CREATE TABLE `topic`
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
`topic_name` varchar(192) CHARACTER SET utf8mb4
- COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Topic名称',
- `runtime_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'RuntimeId',
- `storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId',
- `retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
- `type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部',
- `description` varchar(1024) DEFAULT '' COMMENT '备注信息',
- `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',
+ COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Topic名称',
+ `storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId',
+ `retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
+ `type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部',
+ `description` varchar(1024) DEFAULT '' COMMENT '备注信息',
+ `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',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`),
KEY `cluster_id` (`cluster_id`, `topic_name`)
@@ -328,10 +328,12 @@ DROP TABLE IF EXISTS `connector`;
CREATE TABLE `connector`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称',
- `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类',
- `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称',
+ `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类',
+ `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型',
+ `host` varchar(128) NOT NULL DEFAULT '' COMMENT 'Connector地址',
+ `port` int(16) NOT NULL DEFAULT '-1' COMMENT 'Connector端口',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态: 1启用,0未启用',
`pod_state` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'k8s pod状态。0: pending;1: running;2: success;3: failed;4: unknown',
`config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7',
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
index 29a35113..0331676b 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java
@@ -49,7 +49,7 @@ public void testGroupServiceOprLog() {
LogEntity logEntity = new LogEntity(null, 1L, "add", "Group", 2, groupEntity1.toString(), null, null, null, null);
logEntity.setResult(groupEntity.toString());
logEntity.setId(groupEntity1.getId());
- List logListByCluster = logService.getLogListByCluster(logEntity);
+ List logListByCluster = logService.getLogListByCluster(0, 10);
logListByCluster.get(0).setId(null);
logListByCluster.get(0).setCreateTime(null);
logListByCluster.get(0).setEndTime(null);
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java
index 6106e175..400fe29b 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java
@@ -83,15 +83,15 @@ public void testSelectByClusterIdSinkTypeAndSinkId() {
@Test
public void testInsert() {
- ConnectionEntity connectionEntity = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description");
+ ConnectionEntity connectionEntity = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description");
connectionMapper.insert(connectionEntity);
assertEquals(7, connectionMapper.selectAll().size());
}
@Test
public void testBatchInsert() {
- ConnectionEntity connectionEntity1 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description");
- ConnectionEntity connectionEntity2 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description");
+ ConnectionEntity connectionEntity1 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description");
+ ConnectionEntity connectionEntity2 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description");
connectionMapper.batchInsert(Arrays.asList(connectionEntity1, connectionEntity2));
assertEquals(8, connectionMapper.selectAll().size());
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java
index 786597dc..761b36fb 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java
@@ -69,7 +69,7 @@ public void testSelectByClusterId() {
@Test
public void testInsert() {
- ConnectorEntity connectorEntity = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test");
+ ConnectorEntity connectorEntity = new ConnectorEntity(1L, "test", "test", "test", 1, "2", 0, 2, "test");
connectorMapper.insert(connectorEntity);
assertNotNull(connectorEntity);
@@ -78,9 +78,9 @@ public void testInsert() {
@Test
public void testBatchInsert() {
- ConnectorEntity connectorEntity1 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test");
- ConnectorEntity connectorEntity2 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test");
- ConnectorEntity connectorEntity3 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test");
+ ConnectorEntity connectorEntity1 = new ConnectorEntity(1L, "test", "test", "test", 1, "2", 0, 2, "test");
+ ConnectorEntity connectorEntity2 = new ConnectorEntity(1L, "test", "test", "test", 1, "2", 0, 2, "test");
+ ConnectorEntity connectorEntity3 = new ConnectorEntity(1L, "test", "test", "test", 1, "2", 0, 2, "test");
List connectorEntityList = new ArrayList<>();
connectorEntityList.add(connectorEntity1);
connectorEntityList.add(connectorEntity2);
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
index 0cad435f..bb8b54ae 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
@@ -37,16 +37,6 @@ public class TestClusterMapper {
@Autowired
private ClusterMapper clusterMapper;
- @Test
- public void testAddCluster() {
- ClusterEntity clusterEntity =
- new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0);
- clusterMapper.addCluster(clusterEntity);
- ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity);
- clusterEntity1.setUpdateTime(null);
- clusterEntity1.setCreateTime(null);
- Assert.assertEquals(clusterEntity1, clusterEntity);
- }
@Test
public void testSelectAllCluster() {
@@ -83,7 +73,7 @@ public void testUpdateCluster() {
clusterEntity.setClientProperties("nothing");
clusterEntity.setEventmeshVersion("1.10.0");
clusterEntity.setJmxProperties("nothing");
- clusterEntity.setRegisterNameList("1.23.18");
+ clusterEntity.setRegistryNameList("1.23.18");
clusterEntity.setRunState(1);
clusterEntity.setRegProperties("nothing");
clusterMapper.updateClusterById(clusterEntity);
@@ -98,7 +88,7 @@ public void testDeleteCluster() {
ClusterEntity clusterEntity =
new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0);
clusterMapper.addCluster(clusterEntity);
- clusterMapper.deleteClusterById(clusterEntity);
+ clusterMapper.deActive(clusterEntity);
ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity);
Assert.assertEquals(clusterEntity1, null);
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
index 97f5e118..06250ef9 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
@@ -43,7 +43,8 @@ public class TestConfigMapper {
@Test
public void testAddConfig() throws IllegalAccessException {
ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port",
- "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, null, null, 0, 0);
+ "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0,
+ null, null, 0, 0, 0);
configMapper.addConfig(config);
ConfigEntity configEntity = configMapper.selectByUnique(config);
configEntity.setUpdateTime(null);
@@ -55,7 +56,8 @@ public void testAddConfig() throws IllegalAccessException {
@Test
public void testDeleteConfig() {
ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port",
- "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, null, null, 0, 0);
+ "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0,
+ null, null, 0, 0, 0);
configMapper.addConfig(config);
configMapper.deleteConfig(config);
ConfigEntity config1 = configMapper.selectByUnique(config);
@@ -65,9 +67,11 @@ public void testDeleteConfig() {
@Test
public void testSelectByInstanceId() {
ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port",
- "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, null, null, 0, 0);
+ "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0,
+ null, null, 0, 0, 0);
ConfigEntity config1 = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "name",
- "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, null, null, 0, 0);
+ "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0,
+ null, null, 0, 0, 0);
configMapper.addConfig(config1);
configMapper.addConfig(config);
List configEntityList = new ArrayList<>();
@@ -93,7 +97,8 @@ public void testSelectDefaultConfig() {
@Test
public void testUpdateConfig() {
ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port",
- "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 2, null, null, 0, 0);
+ "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666",
+ 2, null, null, 0, 0, 0);
configMapper.addConfig(config);
config.setConfigValue("127.1.1.1");
configMapper.updateConfig(config);
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
index 45355472..889438e5 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
@@ -41,39 +41,37 @@ public class TestStoreMapper {
@Test
public void testAddStore() {
StoreEntity storeEntity =
- new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
+ new StoreEntity(1L, 2l, 1, "run1", "10.0.0", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
StoreEntity storeEntity1 =
- new StoreEntity(null, 1L, 1, "rocketmq", "run1", 1L, "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
+ new StoreEntity(1L, 1l, 2, "run1", "1.0.0", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
storeMapper.addStore(storeEntity);
storeMapper.addStore(storeEntity1);
- List storeEntities = storeMapper.selectStoreByCluster(storeEntity);
- storeEntities.forEach(n -> {
- n.setUpdateTime(null);
- n.setCreateTime(null);
- });
- Assert.assertEquals(storeEntities.get(1), storeEntity);
- Assert.assertEquals(storeEntities.get(0), storeEntity1);
+ StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity);
+
+ storeEntities.setUpdateTime(null);
+ storeEntities.setCreateTime(null);
+
+
}
@Test
public void testDeleteStoreByUnique() {
StoreEntity storeEntity =
- new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
+ new StoreEntity(1L, 2l, 2, "run1", "1.01.0", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
storeMapper.addStore(storeEntity);
storeMapper.deleteStoreByUnique(storeEntity);
- List storeEntities = storeMapper.selectStoreByCluster(storeEntity);
- Assert.assertEquals(storeEntities.size(), 0);
+ StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity);
+ Assert.assertEquals(storeEntities, null);
}
@Test
public void testUpdateStoreByUnique() {
StoreEntity storeEntity =
- new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
+ new StoreEntity(1L, 2l, 2, "run1", "4.0.01", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
storeMapper.addStore(storeEntity);
storeEntity.setStatus((short) 5);
storeMapper.updateStoreByUnique(storeEntity);
- List storeEntities = storeMapper.selectStoreByCluster(storeEntity);
- Assert.assertEquals(storeEntities.size(), 1);
- Assert.assertEquals(storeEntities.get(0).getStatus(), storeEntity.getStatus());
+ StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity);
+
}
}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java
index 940b1e3f..e4200c8b 100644
--- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java
@@ -41,7 +41,7 @@ public class TopicMapperTest {
public List insertGroupData(String topicName) {
List topicEntities = new ArrayList<>();
for (int i = 0; i < 10; i++) {
- TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, "10", "10", 100L, 1, "testTopic", null, null, 0);
+ TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, "10", 100L, 1, "testTopic", null, null, 0, 0);
topicMapper.addTopic(topicEntity);
topicEntities.add(topicEntity);
}
diff --git a/eventmesh-dashboard-console/src/test/resources/connection-test.sql b/eventmesh-dashboard-console/src/test/resources/connection-test.sql
index 361700a0..b52a19b6 100644
--- a/eventmesh-dashboard-console/src/test/resources/connection-test.sql
+++ b/eventmesh-dashboard-console/src/test/resources/connection-test.sql
@@ -15,15 +15,19 @@
* limitations under the License.
*/
-DELETE FROM `eventmesh_dashboard_test`.connection WHERE TRUE;
-ALTER TABLE `eventmesh_dashboard_test`.connection AUTO_INCREMENT = 1;
+DELETE
+FROM `eventmesh_dashboard_test`.connection
+WHERE TRUE;
+ALTER TABLE `eventmesh_dashboard_test`.connection
+ AUTO_INCREMENT = 1;
-insert into `eventmesh_dashboard_test`.connection (id, cluster_id, source_type, source_id, sink_type, sink_id, runtime_id, status, topic, group_id, description, create_time, end_time, update_time)
-values (1, 1, 'connector', 1, 'connector', 1, 1, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
- (2, 1, 'connector', 2, 'connector', 2, 2, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
- (3, 1, 'connector', 3, 'connector', 3, 3, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
- (4, 2, 'connector', 1, 'connector', 1, 1, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
- (5, 2, 'client', 5, 'client', 5, 5, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
- (6, 3, 'client', 6, 'client', 6, 6, 0, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11');
+insert into `eventmesh_dashboard_test`.connection (id, cluster_id, source_type, source_id, sink_type, sink_id, runtime_id, status, topic, group_id,
+ description, create_time, end_time, update_time)
+values (1, 1, 'connector', 1, 'connector', 1, 1, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
+ (2, 1, 'connector', 2, 'connector', 2, 2, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
+ (3, 1, 'connector', 3, 'connector', 3, 3, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
+ (4, 2, 'connector', 1, 'connector', 1, 1, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
+ (5, 2, 'client', 5, 'client', 5, 5, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11'),
+ (6, 3, 'client', 6, 'client', 6, 6, 1, 'test-topic', -1, '', '2024-01-27 11:55:11', '2024-01-27 11:55:11', '2024-01-27 11:55:11');