提交 25275a29 编写于 作者: A Alex Ross

Fix port labeling and localhost candidate display

上级 9298d3b4
......@@ -45,11 +45,15 @@ export interface Tunnel {
closeable?: boolean;
}
export function MakeAddress(host: string, port: number): string {
function ToLocalHost(host: string): string {
if (host === '127.0.0.1') {
host = 'localhost';
}
return host + ':' + port;
return host;
}
export function MakeAddress(host: string, port: number): string {
return ToLocalHost(host) + ':' + port;
}
export class TunnelModel extends Disposable {
......@@ -201,7 +205,13 @@ export class TunnelModel extends Disposable {
return;
}
if (this._candidateFinder) {
this._candidates = await this._candidateFinder();
this._candidates = (await this._candidateFinder()).map(value => {
return {
host: ToLocalHost(value.host),
port: value.port,
detail: value.detail
};
});
}
}
......@@ -286,7 +296,9 @@ class RemoteExplorerService implements IRemoteExplorerService {
}
getEditableData(tunnelItem: ITunnelItem | undefined): IEditableData | undefined {
return (this._editable && (!tunnelItem || (this._editable.tunnelItem?.remotePort === tunnelItem.remotePort) && (this._editable.tunnelItem.remoteHost === tunnelItem.remoteHost))) ?
return (this._editable &&
((!tunnelItem && (tunnelItem === this._editable.tunnelItem)) ||
(tunnelItem && (this._editable.tunnelItem?.remotePort === tunnelItem.remotePort) && (this._editable.tunnelItem.remoteHost === tunnelItem.remoteHost)))) ?
this._editable.data : undefined;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册