diff --git a/package.json b/package.json index 4bb131ffd..b7277b780 100644 --- a/package.json +++ b/package.json @@ -241,8 +241,8 @@ "title": "Run Kubectl Commands" }, { - "command": "aks.aksTCPDumpFromLinux", - "title": "Collect TCP Dump from Linux Node" + "command": "aks.aksTCPDump", + "title": "Collect TCP Dumps" } ], "menus": { @@ -307,17 +307,11 @@ "group": "9@4" }, { - "submenu": "aks.tcpDataCollectionSubMenu", - "when": "view == kubernetes.cloudExplorer && viewItem =~ /aks\\.cluster/i", + "command": "aks.aksTCPDump", + "when": "view == kubernetes.cloudExplorer && viewItem =~ /aks\\.cluster/i || view == extension.vsKubernetesExplorer && viewItem =~ /vsKubernetes\\.\\w*cluster$/i", "group": "9@5" } ], - "aks.tcpDataCollectionSubMenu": [ - { - "command": "aks.aksTCPDumpFromLinux", - "group": "navigation" - } - ], "aks.createClusterSubMenu": [ { "command": "aks.createClusterNavToAzurePortal", diff --git a/src/commands/aksTCPCollection/tcpDumpCollectionFromLinuxNode.ts b/src/commands/aksTCPCollection/tcpDumpCollection.ts similarity index 84% rename from src/commands/aksTCPCollection/tcpDumpCollectionFromLinuxNode.ts rename to src/commands/aksTCPCollection/tcpDumpCollection.ts index bfa72fb40..ee8435423 100644 --- a/src/commands/aksTCPCollection/tcpDumpCollectionFromLinuxNode.ts +++ b/src/commands/aksTCPCollection/tcpDumpCollection.ts @@ -5,10 +5,10 @@ import { getKubernetesClusterInfo } from '../utils/clusters'; import { getExtension } from '../utils/host'; import { Errorable, failed, map as errmap } from '../utils/errorable'; import * as tmpfile from '../utils/tempfile'; -import { TCPDataCollection, TCPDataCollectionDataProvider } from '../../panels/TCPDataCollection'; +import { TcpDumpDataProvider, TcpDumpPanel } from '../../panels/TcpDumpPanel'; import { invokeKubectlCommand } from '../utils/kubectl'; -export async function aksTCPDumpFromLinux(_context: IActionContext, target: any) { +export async function aksTCPDump(_context: IActionContext, target: any) { const kubectl = await k8s.extension.kubectl.v1; const cloudExplorer = await k8s.extension.cloudExplorer.v1; const clusterExplorer = await k8s.extension.clusterExplorer.v1; @@ -47,8 +47,8 @@ export async function aksTCPDumpFromLinux(_context: IActionContext, target: any) return; } - const dataProvider = new TCPDataCollectionDataProvider(kubectl, kubeConfigFile.filePath, clusterInfo.result.name, linuxNodesList.result); - const panel = new TCPDataCollection(extension.result.extensionUri); + const dataProvider = new TcpDumpDataProvider(kubectl, kubeConfigFile.filePath, clusterInfo.result.name, linuxNodesList.result); + const panel = new TcpDumpPanel(extension.result.extensionUri); panel.show(dataProvider, kubeConfigFile); } diff --git a/src/extension.ts b/src/extension.ts index d7aacf7e5..46b43f85b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -31,7 +31,7 @@ import aksRotateClusterCert from './commands/aksRotateClusterCert/aksRotateClust import { aksInspektorGadgetShow } from './commands/aksInspektorGadget/aksInspektorGadget'; import aksCreateCluster from './commands/aksCreateCluster/aksCreateCluster'; import aksAbortLastOperation from './commands/aksAbortLastOperation/aksAbortLastOperation'; -import { aksTCPDumpFromLinux } from './commands/aksTCPCollection/tcpDumpCollectionFromLinuxNode'; +import { aksTCPDump } from './commands/aksTCPCollection/tcpDumpCollection'; export async function activate(context: vscode.ExtensionContext) { const cloudExplorer = await k8s.extension.cloudExplorer.v1; @@ -76,7 +76,7 @@ export async function activate(context: vscode.ExtensionContext) { registerCommandWithTelemetry('aks.aksAbortLastOperationInCluster', aksAbortLastOperation); registerCommandWithTelemetry('aks.aksInspektorGadgetShow', aksInspektorGadgetShow); registerCommandWithTelemetry('aks.createCluster', aksCreateCluster); - registerCommandWithTelemetry('aks.aksTCPDumpFromLinux', aksTCPDumpFromLinux); + registerCommandWithTelemetry('aks.aksTCPDump', aksTCPDump); await registerAzureServiceNodes(context); diff --git a/src/panels/TCPDataCollection.ts b/src/panels/TcpDumpPanel.ts similarity index 98% rename from src/panels/TCPDataCollection.ts rename to src/panels/TcpDumpPanel.ts index c391eea22..add27d617 100644 --- a/src/panels/TCPDataCollection.ts +++ b/src/panels/TcpDumpPanel.ts @@ -37,7 +37,7 @@ function getCaptureFromFilePath(filePath: string): string | null { return fileMatch && fileMatch[1]; } -export class TCPDataCollection extends BasePanel<"tcpDump"> { +export class TcpDumpPanel extends BasePanel<"tcpDump"> { constructor(extensionUri: Uri) { super(extensionUri, "tcpDump", { checkNodeStateResponse: null, @@ -50,7 +50,7 @@ export class TCPDataCollection extends BasePanel<"tcpDump"> { } } -export class TCPDataCollectionDataProvider implements PanelDataProvider<"tcpDump"> { +export class TcpDumpDataProvider implements PanelDataProvider<"tcpDump"> { constructor( readonly kubectl: k8s.APIAvailable, readonly kubeConfigFilePath: string, @@ -59,7 +59,7 @@ export class TCPDataCollectionDataProvider implements PanelDataProvider<"tcpDump ) { } getTitle(): string { - return `TCP Data Collection ${this.clusterName} for Linux Node`; + return `TCP Capture on ${this.clusterName}`; } getInitialState(): InitialState { diff --git a/webview-ui/src/TCPDump/TcpDump.tsx b/webview-ui/src/TCPDump/TcpDump.tsx index eccffb0c2..115a744d9 100644 --- a/webview-ui/src/TCPDump/TcpDump.tsx +++ b/webview-ui/src/TCPDump/TcpDump.tsx @@ -76,7 +76,7 @@ export function TcpDump(initialState: InitialState) { return ( <>
-

TCP Dump from Linux Node {state.clusterName}

+

TCP Capture on {state.clusterName}