Skip to content

Commit 6a38c72

Browse files
authored
Always show warning before destroying a bundle (#1614)
## Changes WIP: need to update integ tests ## Tests <!-- How is this tested? -->
1 parent 86fc551 commit 6a38c72

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/databricks-vscode/src/test/e2e/destroy.e2e.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,13 @@ describe("Deploy and destroy", async function () {
128128
assert(found, `Job ${jobName} not found in workspace`);
129129

130130
await browser.executeWorkbench(async (vscode) => {
131-
await vscode.commands.executeCommand("databricks.bundle.destroy");
131+
await vscode.commands.executeCommand(
132+
"databricks.bundle.destroy",
133+
false, // Don't force it
134+
false // Skip the modal warning dialog, as they don't work in tests
135+
);
132136
});
137+
133138
console.log("Waiting for bundle to destroy");
134139
// Wait for status to reach success
135140
await browser.waitUntil(

packages/databricks-vscode/src/ui/bundle-resource-explorer/BundleCommands.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,15 @@ export class BundleCommands implements Disposable {
313313
this.bundleRunStatusManager.cancel(treeNode.resourceKey);
314314
}
315315

316-
async destroy(force = false) {
317-
if ((await this.configModel.get("mode")) !== "development") {
318-
const confirm = await window.showErrorMessage(
316+
async destroy(force = false, warn = true) {
317+
if (warn) {
318+
const choice = await window.showWarningMessage(
319319
"Are you sure you want to destroy this bundle and all resources associated with it?",
320320
{modal: true},
321321
"Yes, continue",
322322
"No"
323323
);
324-
325-
if (confirm !== "Yes, continue") {
324+
if (choice !== "Yes, continue") {
326325
return;
327326
}
328327
}

0 commit comments

Comments
 (0)