mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
Fix the page redirection issue of Arthas tunnel server
This commit is contained in:
@@ -13,19 +13,21 @@ public class AgentClusterInfo {
|
||||
private String arthasVersion;
|
||||
|
||||
/**
|
||||
* agent 连接到的 tunnel server 的ip
|
||||
* agent 连接到的 tunnel server 的ip 和 port
|
||||
*/
|
||||
private String clientConnectHost;
|
||||
private int clientConnectTunnelPort;
|
||||
|
||||
public AgentClusterInfo() {
|
||||
|
||||
}
|
||||
|
||||
public AgentClusterInfo(AgentInfo agentInfo, String clientConnectHost) {
|
||||
public AgentClusterInfo(AgentInfo agentInfo, String clientConnectHost, int clientConnectTunnelPort) {
|
||||
this.host = agentInfo.getHost();
|
||||
this.port = agentInfo.getPort();
|
||||
this.arthasVersion = agentInfo.getArthasVersion();
|
||||
this.clientConnectHost = clientConnectHost;
|
||||
this.clientConnectTunnelPort = clientConnectTunnelPort;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
@@ -60,4 +62,12 @@ public class AgentClusterInfo {
|
||||
this.clientConnectHost = clientConnectHost;
|
||||
}
|
||||
|
||||
public int getClientConnectTunnelPort() {
|
||||
return clientConnectTunnelPort;
|
||||
}
|
||||
|
||||
public void setClientConnectTunnelPort(int clientConnectTunnelPort) {
|
||||
this.clientConnectTunnelPort = clientConnectTunnelPort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class TunnelServer {
|
||||
if (tunnelClusterStore != null && clientConnectHost != null) {
|
||||
try {
|
||||
for (Entry<String, AgentInfo> entry : agentInfoMap.entrySet()) {
|
||||
tunnelClusterStore.addAgent(entry.getKey(), new AgentClusterInfo(entry.getValue(), clientConnectHost), 60 * 60, TimeUnit.SECONDS);
|
||||
tunnelClusterStore.addAgent(entry.getKey(), new AgentClusterInfo(entry.getValue(), clientConnectHost, port), 60 * 60, TimeUnit.SECONDS);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.error("update tunnel info error", t);
|
||||
@@ -123,7 +123,7 @@ public class TunnelServer {
|
||||
public void addAgent(String id, AgentInfo agentInfo) {
|
||||
agentInfoMap.put(id, agentInfo);
|
||||
if (this.tunnelClusterStore != null) {
|
||||
this.tunnelClusterStore.addAgent(id, new AgentClusterInfo(agentInfo, clientConnectHost), 60 * 60, TimeUnit.SECONDS);
|
||||
this.tunnelClusterStore.addAgent(id, new AgentClusterInfo(agentInfo, clientConnectHost, port), 60 * 60, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ function getUrlParam(name: string) {
|
||||
const urlparam = new URLSearchParams(window.location.search)
|
||||
return urlparam.get(name)
|
||||
}
|
||||
function tunnelWebConsoleLink(agentId: string, targetServer: string) {
|
||||
return `/?targetServer=${targetServer}&agentId=${agentId}`;
|
||||
function tunnelWebConsoleLink(agentId: string, tunnelPort: number, targetServer: string) {
|
||||
return `/?targetServer=${targetServer}&port=${tunnelPort}&agentId=${agentId}`;
|
||||
}
|
||||
|
||||
const fetchMyApps = () => {
|
||||
@@ -44,7 +44,7 @@ onMounted(() => {
|
||||
<tr v-for="(agentInfoRecord) in agentInfos" :key="agentInfoRecord[0]" class="hover">
|
||||
<td>
|
||||
<a class="btn btn-primary btn-sm"
|
||||
:href="tunnelWebConsoleLink(agentInfoRecord[0], agentInfoRecord[1].clientConnectHost)">{{
|
||||
:href="tunnelWebConsoleLink(agentInfoRecord[0], agentInfoRecord[1].clientConnectTunnelPort, agentInfoRecord[1].clientConnectHost)">{{
|
||||
agentInfoRecord[1].host
|
||||
}}</a>
|
||||
</td>
|
||||
|
||||
@@ -2,5 +2,6 @@ type AgentInfo = {
|
||||
clientConnectHost:string,
|
||||
host:string,
|
||||
port:number,
|
||||
clientConnectTunnelPort:number,
|
||||
arthasVersion:string
|
||||
}
|
||||
Reference in New Issue
Block a user