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;
|
private String arthasVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* agent 连接到的 tunnel server 的ip
|
* agent 连接到的 tunnel server 的ip 和 port
|
||||||
*/
|
*/
|
||||||
private String clientConnectHost;
|
private String clientConnectHost;
|
||||||
|
private int clientConnectTunnelPort;
|
||||||
|
|
||||||
public AgentClusterInfo() {
|
public AgentClusterInfo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AgentClusterInfo(AgentInfo agentInfo, String clientConnectHost) {
|
public AgentClusterInfo(AgentInfo agentInfo, String clientConnectHost, int clientConnectTunnelPort) {
|
||||||
this.host = agentInfo.getHost();
|
this.host = agentInfo.getHost();
|
||||||
this.port = agentInfo.getPort();
|
this.port = agentInfo.getPort();
|
||||||
this.arthasVersion = agentInfo.getArthasVersion();
|
this.arthasVersion = agentInfo.getArthasVersion();
|
||||||
this.clientConnectHost = clientConnectHost;
|
this.clientConnectHost = clientConnectHost;
|
||||||
|
this.clientConnectTunnelPort = clientConnectTunnelPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
@@ -60,4 +62,12 @@ public class AgentClusterInfo {
|
|||||||
this.clientConnectHost = clientConnectHost;
|
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) {
|
if (tunnelClusterStore != null && clientConnectHost != null) {
|
||||||
try {
|
try {
|
||||||
for (Entry<String, AgentInfo> entry : agentInfoMap.entrySet()) {
|
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) {
|
} catch (Throwable t) {
|
||||||
logger.error("update tunnel info error", t);
|
logger.error("update tunnel info error", t);
|
||||||
@@ -123,7 +123,7 @@ public class TunnelServer {
|
|||||||
public void addAgent(String id, AgentInfo agentInfo) {
|
public void addAgent(String id, AgentInfo agentInfo) {
|
||||||
agentInfoMap.put(id, agentInfo);
|
agentInfoMap.put(id, agentInfo);
|
||||||
if (this.tunnelClusterStore != null) {
|
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)
|
const urlparam = new URLSearchParams(window.location.search)
|
||||||
return urlparam.get(name)
|
return urlparam.get(name)
|
||||||
}
|
}
|
||||||
function tunnelWebConsoleLink(agentId: string, targetServer: string) {
|
function tunnelWebConsoleLink(agentId: string, tunnelPort: number, targetServer: string) {
|
||||||
return `/?targetServer=${targetServer}&agentId=${agentId}`;
|
return `/?targetServer=${targetServer}&port=${tunnelPort}&agentId=${agentId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchMyApps = () => {
|
const fetchMyApps = () => {
|
||||||
@@ -44,7 +44,7 @@ onMounted(() => {
|
|||||||
<tr v-for="(agentInfoRecord) in agentInfos" :key="agentInfoRecord[0]" class="hover">
|
<tr v-for="(agentInfoRecord) in agentInfos" :key="agentInfoRecord[0]" class="hover">
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-primary btn-sm"
|
<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
|
agentInfoRecord[1].host
|
||||||
}}</a>
|
}}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ type AgentInfo = {
|
|||||||
clientConnectHost:string,
|
clientConnectHost:string,
|
||||||
host:string,
|
host:string,
|
||||||
port:number,
|
port:number,
|
||||||
|
clientConnectTunnelPort:number,
|
||||||
arthasVersion:string
|
arthasVersion:string
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user