mirror of
https://github.com/apache/rocketmq-dashboard.git
synced 2025-09-10 03:29:59 +08:00
* commit * commit * commit * commit
This commit is contained in:
1
frontend-new/.env.development
Normal file
1
frontend-new/.env.development
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REACT_APP_API_BASE_URL=http://localhost:8082
|
1
frontend-new/.env.production
Normal file
1
frontend-new/.env.production
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REACT_APP_API_BASE_URL=
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const appConfig = {
|
const appConfig = {
|
||||||
apiBaseUrl: 'http://localhost:8082'
|
apiBaseUrl: process.env.REACT_APP_API_BASE_URL || window.location.origin
|
||||||
};
|
};
|
||||||
|
|
||||||
let _redirectHandler = null;
|
let _redirectHandler = null;
|
||||||
@@ -954,21 +954,18 @@ const remoteApi = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tools = {
|
const tools = {
|
||||||
// 适配新的数据结构
|
|
||||||
dashboardRefreshTime: 5000,
|
dashboardRefreshTime: 5000,
|
||||||
generateBrokerMap: (brokerServer, clusterAddrTable, brokerAddrTable) => {
|
generateBrokerMap: (brokerServer, clusterAddrTable, brokerAddrTable) => {
|
||||||
const clusterMap = {}; // 最终存储 { clusterName: [brokerInstance1, brokerInstance2, ...] }
|
const clusterMap = {};
|
||||||
|
|
||||||
Object.entries(clusterAddrTable).forEach(([clusterName, brokerNamesInCluster]) => {
|
Object.entries(clusterAddrTable).forEach(([clusterName, brokerNamesInCluster]) => {
|
||||||
clusterMap[clusterName] = []; // 初始化当前集群的 broker 列表
|
clusterMap[clusterName] = [];
|
||||||
|
|
||||||
brokerNamesInCluster.forEach(brokerName => {
|
brokerNamesInCluster.forEach(brokerName => {
|
||||||
// 从 brokerAddrTable 获取当前 brokerName 下的所有 brokerId 及其地址
|
const brokerAddrs = brokerAddrTable[brokerName]?.brokerAddrs;
|
||||||
const brokerAddrs = brokerAddrTable[brokerName]?.brokerAddrs; // 确保 brokerAddrs 存在
|
|
||||||
if (brokerAddrs) {
|
if (brokerAddrs) {
|
||||||
Object.entries(brokerAddrs).forEach(([brokerIdStr, address]) => {
|
Object.entries(brokerAddrs).forEach(([brokerIdStr, address]) => {
|
||||||
const brokerId = parseInt(brokerIdStr); // brokerId 是字符串,转为数字
|
const brokerId = parseInt(brokerIdStr);
|
||||||
// 从 brokerServer 获取当前 brokerName 和 brokerId 对应的详细信息
|
|
||||||
const detail = brokerServer[brokerName]?.[brokerIdStr];
|
const detail = brokerServer[brokerName]?.[brokerIdStr];
|
||||||
|
|
||||||
if (detail) {
|
if (detail) {
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM java:8
|
FROM eclipse-temurin:17.0.16_8-jre-ubi9-minimal
|
||||||
VOLUME /tmp
|
VOLUME /tmp
|
||||||
ADD rocketmq-dashboard-*.jar rocketmq-dashboard.jar
|
ADD rocketmq-dashboard-*.jar rocketmq-dashboard.jar
|
||||||
RUN sh -c 'touch /rocketmq-dashboard.jar'
|
RUN sh -c 'touch /rocketmq-dashboard.jar'
|
||||||
|
@@ -28,6 +28,7 @@ import org.mockito.InjectMocks;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.mockito.Spy;
|
import org.mockito.Spy;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
@@ -87,15 +88,14 @@ public class LoginControllerTest extends BaseControllerTest {
|
|||||||
final String rightPwd = "admin";
|
final String rightPwd = "admin";
|
||||||
final String wrongPwd = "rocketmq";
|
final String wrongPwd = "rocketmq";
|
||||||
|
|
||||||
// 模拟 userService.queryByName 方法返回一个用户
|
|
||||||
User user = new User("admin", "admin", 1);
|
User user = new User("admin", "admin", 1);
|
||||||
user.setPassword(rightPwd);
|
user.setPassword(rightPwd);
|
||||||
|
|
||||||
|
|
||||||
// 1、login fail
|
// 1、login fail
|
||||||
perform = mockMvc.perform(post(url)
|
perform = mockMvc.perform(post(url)
|
||||||
.param("username", username)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.param("password", wrongPwd));
|
.content("{\"username\":\"" + username + "\",\"password\":\"" + wrongPwd + "\"}"));
|
||||||
perform.andExpect(status().isOk())
|
perform.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.data").doesNotExist())
|
.andExpect(jsonPath("$.data").doesNotExist())
|
||||||
.andExpect(jsonPath("$.status").value(-1))
|
.andExpect(jsonPath("$.status").value(-1))
|
||||||
@@ -105,10 +105,8 @@ public class LoginControllerTest extends BaseControllerTest {
|
|||||||
|
|
||||||
// 2、login success
|
// 2、login success
|
||||||
perform = mockMvc.perform(post(url)
|
perform = mockMvc.perform(post(url)
|
||||||
.param("username", username)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.param("password", rightPwd));
|
.content("{\"username\":\"" + username + "\",\"password\":\"" + rightPwd + "\"}"));
|
||||||
perform.andExpect(status().isOk())
|
|
||||||
.andExpect(jsonPath("$.contextPath").value(contextPath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user