Skip to content

Commit

Permalink
Moving deployment confirmation to before showing 'Deploying...' (#521)
Browse files Browse the repository at this point in the history
It just makes more sense to ask for confirmation before changing the node state to 'Deploying...' and before showing the long running notification. Also before the dialog to 'default' to this going forward
  • Loading branch information
ejizba authored Jul 12, 2018
1 parent 017e7c1 commit b636a3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
"portfinder": "^1.0.13",
"request": "^2.83.0",
"request-promise": "^4.2.2",
"vscode-azureappservice": "~0.18.0",
"vscode-azureappservice": "~0.19.0",
"vscode-azureextensionui": "~0.16.0",
"vscode-azurekudu": "~0.1.6",
"vscode-debugadapter": "^1.24.0",
Expand Down
13 changes: 11 additions & 2 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as path from 'path';
import { join } from 'path';
import * as vscode from 'vscode';
import * as appservice from 'vscode-azureappservice';
import { IActionContext, IAzureNode, IAzureQuickPickItem, IAzureTreeItem, parseError, TelemetryProperties, UserCancelledError } from 'vscode-azureextensionui';
import { DialogResponses, IActionContext, IAzureNode, IAzureQuickPickItem, IAzureTreeItem, parseError, TelemetryProperties, UserCancelledError } from 'vscode-azureextensionui';
import * as constants from '../constants';
import { SiteTreeItem } from '../explorer/SiteTreeItem';
import { WebAppTreeItem } from '../explorer/WebAppTreeItem';
Expand Down Expand Up @@ -115,14 +115,23 @@ export async function deploy(context: IActionContext, target?: vscode.Uri | IAzu
await node.treeItem.enableScmDoBuildDuringDeploy(fsPath, constants.runtimes[siteConfig.linuxFxVersion.substring(0, siteConfig.linuxFxVersion.indexOf('|'))], context.properties);
}
}

if (confirmDeployment && siteConfig.scmType !== constants.ScmType.LocalGit && siteConfig !== constants.ScmType.GitHub) {
const warning: string = `Are you sure you want to deploy to "${node.treeItem.client.fullName}"? This will overwrite any previous deployment and cannot be undone.`;
context.properties.cancelStep = 'confirmDestructiveDeployment';
const deployButton: vscode.MessageItem = { title: 'Deploy' };
await ext.ui.showWarningMessage(warning, { modal: true }, deployButton, DialogResponses.cancel);
context.properties.cancelStep = '';
}

if (!defaultWebAppToDeploy && currentWorkspace && (isPathEqual(currentWorkspace.uri.fsPath, fsPath) || isSubpath(currentWorkspace.uri.fsPath, fsPath))) {
// tslint:disable-next-line:no-floating-promises
node.treeItem.promptToSaveDeployDefaults(node, currentWorkspace.uri.fsPath, fsPath, context.properties);
}
cancelWebsiteValidation(node.treeItem);
await node.runWithTemporaryDescription("Deploying...", async () => {
// tslint:disable-next-line:no-non-null-assertion
await appservice.deploy(node!.treeItem.client, <string>fsPath, constants.extensionPrefix, confirmDeployment, context.properties);
await appservice.deploy(node!.treeItem.client, <string>fsPath, constants.extensionPrefix, context.properties);
});
// Don't wait
validateWebSite(correlationId, node.treeItem).then(
Expand Down
6 changes: 6 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ export enum configurationSettings {
advancedCreation = 'advancedCreation',
defaultWebAppToDeploy = 'defaultWebAppToDeploy'
}

export enum ScmType {
None = 'None', // default scmType
LocalGit = 'LocalGit',
GitHub = 'GitHub'
}

0 comments on commit b636a3b

Please sign in to comment.