Skip to content

Commit

Permalink
file and command renames
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbom committed Oct 26, 2023
1 parent fbdeef4 commit d04be9b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<k8s.KubectlV1>,
readonly kubeConfigFilePath: string,
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/TCPDump/TcpDump.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function TcpDump(initialState: InitialState) {
return (
<>
<header>
<h2>TCP Dump from Linux Node {state.clusterName}</h2>
<h2>TCP Capture on {state.clusterName}</h2>
<VSCodeDivider />
</header>
<div className={styles.content}>
Expand Down

0 comments on commit d04be9b

Please sign in to comment.