Skip to content

Commit

Permalink
Respect suppressNotification when deleting CosmosDBAccount (#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonYeMSFT authored Sep 21, 2023
1 parent 9bbf104 commit 266299d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/commands/deleteDatabaseAccount/deleteCosmosDBAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ export async function deleteCosmosDBAccount(context: IDeleteWizardContext, node:
const client: CosmosDBManagementClient = await createCosmosDBClient([context, node.subscription]);
const resourceGroup: string = getResourceGroupFromId(node.fullId);
const accountName: string = getDatabaseAccountNameFromId(node.fullId);
const deletingMessage: string = `Deleting account "${accountName}"...`;
await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: deletingMessage }, async () => {
await client.databaseAccounts.beginDeleteAndWait(resourceGroup, accountName);
const deleteMessage: string = localize("deleteAccountMsg", `Successfully deleted account "{0}".`, accountName);
void vscode.window.showInformationMessage(deleteMessage);
ext.outputChannel.appendLog(deleteMessage);
});
const deletePromise = client.databaseAccounts.beginDeleteAndWait(resourceGroup, accountName);
if (!context.suppressNotification) {
const deletingMessage: string = `Deleting account "${accountName}"...`;
await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: deletingMessage }, async () => {
await deletePromise;
const deleteMessage: string = localize("deleteAccountMsg", `Successfully deleted account "{0}".`, accountName);
void vscode.window.showInformationMessage(deleteMessage);
ext.outputChannel.appendLog(deleteMessage);
});
} else {
await deletePromise;
}
}

0 comments on commit 266299d

Please sign in to comment.