suppressed "Create..." option for delete commands (#1607)

This commit is contained in:
Neelima Potharaj 2020-07-10 16:03:42 -07:00 коммит произвёл GitHub
Родитель 8da0dce017
Коммит 68167f48a5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 39 добавлений и 9 удалений

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { commands } from "vscode";
import { IActionContext, registerCommand } from "vscode-azureextensionui";
import { IActionContext, ITreeItemPickerContext, registerCommand } from "vscode-azureextensionui";
import { doubleClickDebounceDelay } from "../constants";
import { ext } from "../extensionVariables";
import { AttachedAccountSuffix } from "../tree/AttachedAccountsTreeItem";
@ -47,12 +47,16 @@ export function registerDocDBCommands(): void {
});
registerCommand('cosmosDB.deleteDocDBDatabase', async (context: IActionContext, node?: DocDBDatabaseTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <DocDBDatabaseTreeItem>await ext.tree.showTreeItemPicker(DocDBDatabaseTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.deleteDocDBCollection', async (context: IActionContext, node?: DocDBCollectionTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <DocDBCollectionTreeItem>await ext.tree.showTreeItemPicker(DocDBCollectionTreeItem.contextValue, context);
}
@ -66,12 +70,16 @@ export function registerDocDBCommands(): void {
// tslint:disable-next-line:align
}, doubleClickDebounceDelay);
registerCommand('cosmosDB.deleteDocDBDocument', async (context: IActionContext, node?: DocDBDocumentTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <DocDBDocumentTreeItem>await ext.tree.showTreeItemPicker(DocDBDocumentTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.deleteDocDBStoredProcedure', async (context: IActionContext, node?: DocDBStoredProcedureTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <DocDBStoredProcedureTreeItem>await ext.tree.showTreeItemPicker(DocDBStoredProcedureTreeItem.contextValue, context);
}

Просмотреть файл

@ -7,7 +7,7 @@
import { platform } from 'os';
import * as vscode from 'vscode';
import { AzExtTreeDataProvider, AzExtTreeItem, AzureTreeItem, AzureUserInput, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, IActionContext, registerCommand, registerEvent, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { AzExtTreeDataProvider, AzExtTreeItem, AzureTreeItem, AzureUserInput, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, IActionContext, ITreeItemPickerContext, registerCommand, registerEvent, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { AzureExtensionApi, AzureExtensionApiProvider } from 'vscode-azureextensionui/api';
import { findTreeItem } from './commands/api/findTreeItem';
import { pickTreeItem } from './commands/api/pickTreeItem';
@ -80,6 +80,8 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
await node.createChild(actionContext);
});
registerCommand('cosmosDB.deleteAccount', async (actionContext: IActionContext, node?: AzureTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = actionContext;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = await ext.tree.showTreeItemPicker<AzureTreeItem>(cosmosDBTopLevelContextValues, actionContext);
}

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, registerCommand } from "vscode-azureextensionui";
import { IActionContext, ITreeItemPickerContext, registerCommand } from "vscode-azureextensionui";
import { doubleClickDebounceDelay } from '../constants';
import { ext } from '../extensionVariables';
import { GraphAccountTreeItem } from "./tree/GraphAccountTreeItem";
@ -25,12 +25,16 @@ export function registerGraphCommands(): void {
await node.createChild(context);
});
registerCommand('cosmosDB.deleteGraphDatabase', async (context: IActionContext, node?: GraphDatabaseTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <GraphDatabaseTreeItem>await ext.tree.showTreeItemPicker(GraphDatabaseTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.deleteGraph', async (context: IActionContext, node?: GraphCollectionTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <GraphCollectionTreeItem>await ext.tree.showTreeItemPicker(GraphCollectionTreeItem.contextValue, context);
}

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { AzureTreeItem, callWithTelemetryAndErrorHandling, IActionContext, IErrorHandlerContext, registerCommand, registerErrorHandler, registerEvent } from "vscode-azureextensionui";
import { AzureTreeItem, callWithTelemetryAndErrorHandling, IActionContext, IErrorHandlerContext, ITreeItemPickerContext, registerCommand, registerErrorHandler, registerEvent } from "vscode-azureextensionui";
import { ext } from "../extensionVariables";
import { AttachedAccountSuffix } from '../tree/AttachedAccountsTreeItem';
import * as vscodeUtil from '../utils/vscodeUtils';
@ -79,6 +79,8 @@ export function registerMongoCommands(): MongoCodeLensProvider {
}
});
registerCommand('cosmosDB.deleteMongoDB', async (context: IActionContext, node?: MongoDatabaseTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <MongoDatabaseTreeItem>await ext.tree.showTreeItemPicker(MongoDatabaseTreeItem.contextValue, context);
}
@ -90,12 +92,16 @@ export function registerMongoCommands(): MongoCodeLensProvider {
}
});
registerCommand('cosmosDB.deleteMongoCollection', async (context: IActionContext, node?: MongoCollectionTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <MongoCollectionTreeItem>await ext.tree.showTreeItemPicker(MongoCollectionTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);
});
registerCommand('cosmosDB.deleteMongoDocument', async (context: IActionContext, node?: MongoDocumentTreeItem) => {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <MongoDocumentTreeItem>await ext.tree.showTreeItemPicker(MongoDocumentTreeItem.contextValue, context);
}

Просмотреть файл

@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { DialogResponses, IActionContext } from "vscode-azureextensionui";
import { DialogResponses, IActionContext, ITreeItemPickerContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { PostgresDatabaseTreeItem } from "../tree/PostgresDatabaseTreeItem";
export async function deletePostgresDatabase(context: IActionContext, node?: PostgresDatabaseTreeItem): Promise<void> {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <PostgresDatabaseTreeItem>await ext.tree.showTreeItemPicker(PostgresDatabaseTreeItem.contextValue, context);
}

Просмотреть файл

@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import { window } from 'vscode';
import { DialogResponses, IActionContext } from "vscode-azureextensionui";
import { DialogResponses, IActionContext, ITreeItemPickerContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { PostgresFunctionTreeItem } from "../tree/PostgresFunctionTreeItem";
export async function deletePostgresFunction(context: IActionContext, treeItem?: PostgresFunctionTreeItem): Promise<void> {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!treeItem) {
treeItem = <PostgresFunctionTreeItem>await ext.tree.showTreeItemPicker(PostgresFunctionTreeItem.contextValue, { ...context, suppressCreatePick: true });
}

Просмотреть файл

@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { DialogResponses, IActionContext } from 'vscode-azureextensionui';
import { DialogResponses, IActionContext, ITreeItemPickerContext } from 'vscode-azureextensionui';
import { ext } from '../../extensionVariables';
import { localize } from '../../utils/localize';
import { PostgresServerTreeItem } from '../tree/PostgresServerTreeItem';
export async function deletePostgresServer(context: IActionContext, node?: PostgresServerTreeItem): Promise<void> {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <PostgresServerTreeItem>await ext.tree.showTreeItemPicker(PostgresServerTreeItem.contextValue, context);
}

Просмотреть файл

@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import { window } from 'vscode';
import { DialogResponses, IActionContext } from "vscode-azureextensionui";
import { DialogResponses, IActionContext, ITreeItemPickerContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { PostgresStoredProcedureTreeItem } from '../tree/PostgresStoredProcedureTreeItem';
export async function deletePostgresStoredProcedure(context: IActionContext, treeItem?: PostgresStoredProcedureTreeItem): Promise<void> {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!treeItem) {
treeItem = <PostgresStoredProcedureTreeItem>await ext.tree.showTreeItemPicker(PostgresStoredProcedureTreeItem.contextValue, { ...context, suppressCreatePick: true });
}

Просмотреть файл

@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import { window } from 'vscode';
import { DialogResponses, IActionContext } from "vscode-azureextensionui";
import { DialogResponses, IActionContext, ITreeItemPickerContext } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { PostgresTableTreeItem } from "../tree/PostgresTableTreeItem";
export async function deletePostgresTable(context: IActionContext, node?: PostgresTableTreeItem): Promise<void> {
const suppressCreateContext: ITreeItemPickerContext = context;
suppressCreateContext.suppressCreatePick = true;
if (!node) {
node = <PostgresTableTreeItem>await ext.tree.showTreeItemPicker(PostgresTableTreeItem.contextValue, context);
}