|
4 | 4 |
|
5 | 5 | import { GitpodExtensionContext, setupGitpodContext, registerTasks, registerIpcHookCli, ExposedServedGitpodWorkspacePort, GitpodWorkspacePort, isExposedServedGitpodWorkspacePort } from 'gitpod-shared';
|
6 | 6 | import { PortsStatus, PortVisibility } from '@gitpod/supervisor-api-grpc/lib/status_pb';
|
7 |
| -import { TunnelVisiblity} from '@gitpod/supervisor-api-grpc/lib/port_pb'; |
| 7 | +import { TunnelVisiblity } from '@gitpod/supervisor-api-grpc/lib/port_pb'; |
8 | 8 | import type * as keytarType from 'keytar';
|
9 | 9 | import fetch from 'node-fetch';
|
10 | 10 | import * as vscode from 'vscode';
|
@@ -313,21 +313,27 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
|
313 | 313 | const portsStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
314 | 314 | context.subscriptions.push(portsStatusBarItem);
|
315 | 315 | async function updateStatusBar(): Promise<void> {
|
316 |
| - const exposedPorts: number[] = []; |
| 316 | + const publicExposedPorts: number[] = []; |
| 317 | + const privateExposedPorts: number[] = []; |
317 | 318 |
|
318 | 319 | for (const port of portMap.values()) {
|
319 | 320 | if (isExposedServedGitpodWorkspacePort(port)) {
|
320 |
| - exposedPorts.push(port.status.localPort); |
| 321 | + if (port.status.exposed.visibility === PortVisibility.PUBLIC) { |
| 322 | + publicExposedPorts.push(port.status.localPort); |
| 323 | + } else { |
| 324 | + privateExposedPorts.push(port.status.localPort); |
| 325 | + } |
321 | 326 | }
|
322 | 327 | }
|
323 | 328 |
|
324 | 329 | let text: string;
|
325 | 330 | let tooltip = 'Click to open "Ports View"';
|
326 |
| - if (exposedPorts.length) { |
| 331 | + if (publicExposedPorts.length + privateExposedPorts.length) { |
327 | 332 | text = 'Ports:';
|
328 | 333 | tooltip += '\n\nPorts';
|
329 |
| - text += ` ${exposedPorts.join(', ')}`; |
330 |
| - tooltip += `\nPublic: ${exposedPorts.join(', ')}`; |
| 334 | + text += ` ${[...publicExposedPorts, ...privateExposedPorts].join(', ')}`; |
| 335 | + tooltip += publicExposedPorts.length ? `\nPublic: ${publicExposedPorts.join(', ')}` : ''; |
| 336 | + tooltip += privateExposedPorts.length ? `\nPrivate: ${privateExposedPorts.join(', ')}` : ''; |
331 | 337 | } else {
|
332 | 338 | text = '$(circle-slash) No open ports';
|
333 | 339 | }
|
|
0 commit comments