Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show 'report issue' in docker commands on volume and network inspect and delete #1571

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/commands/containers/inspectContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export async function inspectContainer(context: IActionContext, node?: Container

const container = node.getContainer();
// eslint-disable-next-line @typescript-eslint/promise-function-async
let inspectInfo: ContainerInspectInfo = await callDockerodeWithErrorHandling(() => container.inspect(), context);

const inspectInfo: ContainerInspectInfo = await callDockerodeWithErrorHandling(() => container.inspect(), context);
await openReadOnlyJson(node, inspectInfo);
}
7 changes: 5 additions & 2 deletions src/commands/networks/inspectNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Network } from "dockerode";
import { IActionContext, openReadOnlyJson } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { NetworkTreeItem } from "../../tree/networks/NetworkTreeItem";
import { callDockerodeWithErrorHandling } from "../../utils/callDockerodeWithErrorHandling";

export async function inspectNetwork(context: IActionContext, node?: NetworkTreeItem): Promise<void> {
if (!node) {
Expand All @@ -15,7 +17,8 @@ export async function inspectNetwork(context: IActionContext, node?: NetworkTree
});
}

// tslint:disable-next-line: no-unsafe-any
const inspectInfo: {} = await node.getNetwork().inspect(); // inspect is missing type in @types/dockerode
const network: Network = node.getNetwork()
// eslint-disable-next-line @typescript-eslint/promise-function-async, @typescript-eslint/tslint/config
const inspectInfo: {} = await callDockerodeWithErrorHandling(() => network.inspect(), context); // inspect is missing type in @types/dockerode
await openReadOnlyJson(node, inspectInfo);
}
6 changes: 5 additions & 1 deletion src/commands/volumes/inspectVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Volume } from "dockerode";
import { IActionContext, openReadOnlyJson } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { VolumeTreeItem } from "../../tree/volumes/VolumeTreeItem";
import { callDockerodeWithErrorHandling } from "../../utils/callDockerodeWithErrorHandling";

export async function inspectVolume(context: IActionContext, node?: VolumeTreeItem): Promise<void> {
if (!node) {
node = await ext.volumesTree.showTreeItemPicker<VolumeTreeItem>(VolumeTreeItem.contextValue, { ...context, noItemFoundErrorMessage: 'No volumes are available to inspect' });
}

const inspectInfo = await node.getVolume().inspect();
const volume: Volume = node.getVolume();
// eslint-disable-next-line @typescript-eslint/promise-function-async
const inspectInfo = await callDockerodeWithErrorHandling(() => volume.inspect(), context);
await openReadOnlyJson(node, inspectInfo);
}
9 changes: 6 additions & 3 deletions src/tree/networks/NetworkTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import { Network } from "dockerode";
import { AzExtParentTreeItem, AzExtTreeItem } from "vscode-azureextensionui";
import { AzExtParentTreeItem, AzExtTreeItem, IActionContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { callDockerodeWithErrorHandling } from "../../utils/callDockerodeWithErrorHandling";
import { getThemedIconPath, IconPath } from '../IconPath';
import { LocalNetworkInfo } from "./LocalNetworkInfo";

Expand Down Expand Up @@ -47,7 +48,9 @@ export class NetworkTreeItem extends AzExtTreeItem {
return ext.dockerode.getNetwork(this.networkId);
}

public async deleteTreeItemImpl(): Promise<void> {
await this.getNetwork().remove({ force: true });
public async deleteTreeItemImpl(context: IActionContext): Promise<void> {
const network: Network = this.getNetwork();
// eslint-disable-next-line @typescript-eslint/promise-function-async
await callDockerodeWithErrorHandling(() => network.remove({ force: true }), context);
}
}
9 changes: 6 additions & 3 deletions src/tree/volumes/VolumeTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import { Volume } from "dockerode";
import { AzExtParentTreeItem, AzExtTreeItem } from "vscode-azureextensionui";
import { AzExtParentTreeItem, AzExtTreeItem, IActionContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { callDockerodeWithErrorHandling } from "../../utils/callDockerodeWithErrorHandling";
import { getThemedIconPath, IconPath } from "../IconPath";
import { LocalVolumeInfo } from "./LocalVolumeInfo";

Expand Down Expand Up @@ -47,7 +48,9 @@ export class VolumeTreeItem extends AzExtTreeItem {
return ext.dockerode.getVolume(this.volumeName);
}

public async deleteTreeItemImpl(): Promise<void> {
await this.getVolume().remove({ force: true });
public async deleteTreeItemImpl(context: IActionContext): Promise<void> {
const volume: Volume = this.getVolume();
// eslint-disable-next-line @typescript-eslint/promise-function-async
await callDockerodeWithErrorHandling(() => volume.remove({ force: true }), context);
}
}