Fix expected child context values (#373)
This commit is contained in:
Родитель
da4224dd61
Коммит
e893a88416
|
@ -18,8 +18,13 @@ export async function addSshKey(context: IActionContext, node?: ResolvedVirtualM
|
|||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.linuxContextValue)
|
||||
// TODO: only show Linux VMs
|
||||
// expectedChildContextValue: new RegExp(VirtualMachineTreeItem.linuxContextValue)
|
||||
});
|
||||
|
||||
if (!node.contextValue.includes(VirtualMachineTreeItem.linuxContextValue)) {
|
||||
throw new Error(localize('addSshKeyNotLinux', 'Only Linux VMs are supported.'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
|
|
|
@ -8,13 +8,12 @@ import * as vscode from 'vscode';
|
|||
import { vmFilter } from '../constants';
|
||||
import { ext } from '../extensionVariables';
|
||||
import { localize } from '../localize';
|
||||
import { ResolvedVirtualMachineTreeItem, VirtualMachineTreeItem } from '../tree/VirtualMachineTreeItem';
|
||||
import { ResolvedVirtualMachineTreeItem } from '../tree/VirtualMachineTreeItem';
|
||||
|
||||
export async function copyIpAddress(context: IActionContext, node?: ResolvedVirtualMachineTreeItem): Promise<void> {
|
||||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.allOSContextValue)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
import { IActionContext } from "@microsoft/vscode-azext-utils";
|
||||
import { vmFilter } from "../../constants";
|
||||
import { ext } from "../../extensionVariables";
|
||||
import { ResolvedVirtualMachineTreeItem, VirtualMachineTreeItem } from "../../tree/VirtualMachineTreeItem";
|
||||
import { ResolvedVirtualMachineTreeItem } from "../../tree/VirtualMachineTreeItem";
|
||||
import { IDeleteChildImplContext } from "./deleteConstants";
|
||||
|
||||
export async function deleteVirtualMachine(context: IActionContext & Partial<IDeleteChildImplContext>, node?: ResolvedVirtualMachineTreeItem): Promise<void> {
|
||||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>({ ...context, suppressCreatePick: true }, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.allOSContextValue)
|
||||
});
|
||||
}
|
||||
// context.telemetry.properties.numOfResources = resourcesToDelete.length.toString();
|
||||
|
|
|
@ -19,8 +19,13 @@ export async function openInRemoteSsh(context: IActionContext & { canPickMany?:
|
|||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.linuxContextValue)
|
||||
// TODO: only show Linux VMs
|
||||
// expectedChildContextValue: new RegExp(VirtualMachineTreeItem.linuxContextValue)
|
||||
});
|
||||
|
||||
if (!node.contextValue.includes(VirtualMachineTreeItem.linuxContextValue)) {
|
||||
throw new Error(localize('addSshKeyNotLinux', 'Only Linux VMs are supported.'));
|
||||
}
|
||||
}
|
||||
|
||||
await verifyRemoteSshExtension(context);
|
||||
|
|
|
@ -8,14 +8,13 @@ import { IActionContext, nonNullValue } from "@microsoft/vscode-azext-utils";
|
|||
import { vmFilter } from "../constants";
|
||||
import { ext } from "../extensionVariables";
|
||||
import { localize } from "../localize";
|
||||
import { ResolvedVirtualMachineTreeItem, VirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { ResolvedVirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { createComputeClient } from "../utils/azureClients";
|
||||
|
||||
export async function restartVirtualMachine(context: IActionContext, node?: ResolvedVirtualMachineTreeItem): Promise<void> {
|
||||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.allOSContextValue)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,14 +8,13 @@ import { IActionContext, nonNullValue } from "@microsoft/vscode-azext-utils";
|
|||
import { vmFilter } from "../constants";
|
||||
import { ext } from "../extensionVariables";
|
||||
import { localize } from "../localize";
|
||||
import { ResolvedVirtualMachineTreeItem, VirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { ResolvedVirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { createComputeClient } from "../utils/azureClients";
|
||||
|
||||
export async function startVirtualMachine(context: IActionContext, node?: ResolvedVirtualMachineTreeItem): Promise<void> {
|
||||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.allOSContextValue)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,14 +8,13 @@ import { IActionContext, nonNullValue } from "@microsoft/vscode-azext-utils";
|
|||
import { vmFilter } from "../constants";
|
||||
import { ext } from "../extensionVariables";
|
||||
import { localize } from "../localize";
|
||||
import { ResolvedVirtualMachineTreeItem, VirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { ResolvedVirtualMachineTreeItem } from "../tree/VirtualMachineTreeItem";
|
||||
import { createComputeClient } from "../utils/azureClients";
|
||||
|
||||
export async function stopVirtualMachine(context: IActionContext, node?: ResolvedVirtualMachineTreeItem): Promise<void> {
|
||||
if (!node) {
|
||||
node = await ext.rgApi.pickAppResource<ResolvedVirtualMachineTreeItem>(context, {
|
||||
filter: vmFilter,
|
||||
expectedChildContextValue: new RegExp(VirtualMachineTreeItem.allOSContextValue)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче