Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #86] Add Front-end view controller #87

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
11d1668
refactor: add dependency of console module and move controllers into …
Lambert-Rao Jan 21, 2024
f81c0dd
fix: add logback config, fix application-dev.yml and move `</dependen…
Lambert-Rao Jan 21, 2024
d9cf419
FirstCommit
zzxxiansheng Jan 28, 2024
6bd0009
Merge remote-tracking branch 'eventmesh/dev' into dev
zzxxiansheng Jan 29, 2024
df369e7
remerge
zzxxiansheng Feb 1, 2024
1b82aad
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
3391325
first improve
zzxxiansheng Feb 1, 2024
c7da0b9
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
0b17293
second improve
zzxxiansheng Feb 1, 2024
22b8528
third improve
zzxxiansheng Feb 1, 2024
edb4005
fourth improve
zzxxiansheng Feb 1, 2024
c030859
fourth improve
zzxxiansheng Feb 1, 2024
a6b5caa
fourth improve
zzxxiansheng Feb 1, 2024
92b2953
Update and rename EventmeshConsoleApplication.java to EventMeshDashbo…
zzxxiansheng Feb 5, 2024
6dcb360
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f5bf0d
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f2e85b
change some resource file
zzxxiansheng Feb 5, 2024
b9718ed
improve name
zzxxiansheng Feb 5, 2024
b4ab687
improve name
zzxxiansheng Feb 5, 2024
bff80be
Modify the fields of the synchronized log table
zzxxiansheng Feb 5, 2024
e5765d0
improve name
zzxxiansheng Feb 5, 2024
390dd05
improve name
zzxxiansheng Feb 5, 2024
befb6ee
Merge remote-tracking branch 'origin/dev' into dev
Mar 3, 2024
ca26ec5
config basic function and config ,runtime,store,cluster sql
Mar 6, 2024
ab82d06
try to resolve build error
Mar 6, 2024
506023b
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 6, 2024
886c754
Some changes in the specification
Mar 7, 2024
e6081f6
something rename
Mar 8, 2024
8b0db55
one sql update
Mar 8, 2024
3e01c42
tag something to do
Mar 8, 2024
5ff139b
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 8, 2024
0601b9b
The distinction between state and status is_delete fields is unified,…
Mar 10, 2024
095eb24
Delete eventmesh-dashboard-console/src/main/java/org/apache/eventmesh…
zzxxiansheng Mar 10, 2024
dc6276e
Delete eventmesh-dashboard-console/src/main/java/org/apache/eventmesh…
zzxxiansheng Mar 10, 2024
7661186
improve something checkstyle error
Mar 10, 2024
92d11b8
Merge remote-tracking branch 'origin/dev' into dev
Mar 10, 2024
eb3fe52
try to solve something sql test error
Mar 10, 2024
d4efd94
try to resolve something test error
Mar 10, 2024
0044f3c
try to resolve something test error
Mar 10, 2024
a2dd306
Merge remote-tracking branch 'eventmesh/dev' into dev
Mar 10, 2024
545e91e
something is_delete(error) change to status (#3)
zzxxiansheng Mar 11, 2024
33f592c
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 12, 2024
2eabe79
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 19, 2024
198214a
Merge branch 'apache:dev' into dev
zzxxiansheng Apr 4, 2024
1f9eacd
Dev controller (#9)
zzxxiansheng Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions eventmesh-dashboard-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,48 @@
<scope>runtime</scope>
</dependency>

<!-- health check client -->
<!-- EventMesh SDK -->
<!-- <dependency>-->
<!-- <groupId>org.apache.eventmesh</groupId>-->
<!-- <artifactId>eventmesh-sdk-java</artifactId>-->
<!-- <version>1.10.0-release</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit-dep</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- storage redis client -->
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</dependency>
<!-- rocketmq client -->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-tools</artifactId>
<version>5.2.0</version>
</dependency>
<!-- health check client end -->




<!--health check client -->
<!--EventMesh SDK -->
<!--<dependency>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@SpringBootApplication
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true)
public class EventMeshDashboardApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.modle.vo.cluster.GetClusterBaseMessageVO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class ClusterController {

@Autowired
ClusterService clusterService;

@GetMapping("/cluster/getResourceNum")
public ResourceNumVO getResourceNumByClusterId(Long clusterId) {
return clusterService.getResourceNumByCluster(clusterId);
}


@GetMapping("/cluster/getBaseMessage")
public GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId) {
return clusterService.getClusterBaseMessage(clusterId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* 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.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.config.DetailConfigsVO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigDTO;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

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 ConfigController {

@Autowired
private ConfigService configService;

@PostMapping("/cluster/config/updateConfigs")
public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO updateConfigDTO) {
try {
configService.updateConfigsByInstanceId(updateConfigDTO.getUsername(), updateConfigDTO.getClusterId(), updateConfigDTO.getInstanceType(),
updateConfigDTO.getInstanceId(), updateConfigDTO.getChangeConfigDTOS());
} catch (Exception e) {
return e.getMessage();
}
return "success";
}


@PostMapping("/cluster/config/getInstanceDetailConfigs")
public List<DetailConfigsVO> getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) {
List<ConfigEntity> configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(),
getConfigsListDTO.getInstanceType(), getConfigsListDTO.getDynamicGetConfigDto());
Map<String, String> stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType(),
getConfigsListDTO.getInstanceId(), getConfigsListDTO.getInstanceType());
ArrayList<DetailConfigsVO> 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;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>
* 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<String> getConnectorBusinessType(String type) {
return connectionDataService.getConnectorBusinessType(type);
}

@GetMapping("/cluster/connection/getConnectorConfigs")
public List<ConfigEntity> 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<ConnectionListVO> getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) {
return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO);
}

@GetMapping("/cluster/connection/getConnectorDetail")
public ConnectorEntity getConnectorDetail(Long connectorId) {
return connectionDataService.getConnectorById(connectorId);
}


}
Original file line number Diff line number Diff line change
@@ -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<HealthCheckResultEntity> 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);
}
}
Original file line number Diff line number Diff line change
@@ -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<LogEntity> getLogLIstToFront(Integer pageIndex, Integer pageNum) {
return logService.getLogListByCluster(pageIndex, pageNum);
}

}
Loading
Loading