diff --git a/packages/core/src/awsService/cloudformation/commands/cfnCommands.ts b/packages/core/src/awsService/cloudformation/commands/cfnCommands.ts index ee7c829cf1c..b2f2ac875cc 100644 --- a/packages/core/src/awsService/cloudformation/commands/cfnCommands.ts +++ b/packages/core/src/awsService/cloudformation/commands/cfnCommands.ts @@ -135,7 +135,8 @@ export function viewChangeSetCommand(client: LanguageClient, diffProvider: DiffW params.changeSetName, true, [], - describeChangeSetResult.deploymentMode + describeChangeSetResult.deploymentMode, + describeChangeSetResult.status ) void commands.executeCommand(commandKey('diff.focus')) } catch (error) { @@ -483,7 +484,7 @@ async function changeSetSteps( try { environmentFile = await environmentManager.selectEnvironmentFile(templateUri, paramDefinition) } catch (error) { - getLogger().warn(`Failed to select environment file:: ${extractErrorMessage(error)}`) + getLogger().warn(`Failed to select environment file: ${extractErrorMessage(error)}`) } if (paramDefinition.length > 0) { diff --git a/packages/core/src/awsService/cloudformation/stacks/actions/validationWorkflow.ts b/packages/core/src/awsService/cloudformation/stacks/actions/validationWorkflow.ts index 1586f2a53ed..70f0565678a 100644 --- a/packages/core/src/awsService/cloudformation/stacks/actions/validationWorkflow.ts +++ b/packages/core/src/awsService/cloudformation/stacks/actions/validationWorkflow.ts @@ -4,7 +4,7 @@ */ import { v4 as uuidv4 } from 'uuid' -import { Parameter, Capability } from '@aws-sdk/client-cloudformation' +import { Parameter, Capability, ChangeSetStatus } from '@aws-sdk/client-cloudformation' import { StackActionPhase, StackChange, @@ -163,7 +163,8 @@ export class Validation { this.changeSetName, this.shouldEnableDeployment, validationDetail, - deploymentMode + deploymentMode, + ChangeSetStatus.CREATE_COMPLETE ) void commands.executeCommand(commandKey('diff.focus')) } diff --git a/packages/core/src/awsService/cloudformation/ui/diffWebviewProvider.ts b/packages/core/src/awsService/cloudformation/ui/diffWebviewProvider.ts index 3a70650eccd..f7c06f5f6f8 100644 --- a/packages/core/src/awsService/cloudformation/ui/diffWebviewProvider.ts +++ b/packages/core/src/awsService/cloudformation/ui/diffWebviewProvider.ts @@ -9,6 +9,7 @@ import { DiffViewHelper } from './diffViewHelper' import { commandKey } from '../utils' import { StackViewCoordinator } from './stackViewCoordinator' import { showWarningConfirmation } from './message' +import { ChangeSetStatus } from '@aws-sdk/client-cloudformation' const webviewCommandOpenDiff = 'openDiff' @@ -24,6 +25,7 @@ export class DiffWebviewProvider implements WebviewViewProvider, Disposable { private readonly disposables: Disposable[] = [] private validationDetail: ValidationDetail[] = [] private deploymentMode?: DeploymentMode + private changeSetStatus?: string constructor(private readonly coordinator: StackViewCoordinator) { this.disposables.push( @@ -46,7 +48,8 @@ export class DiffWebviewProvider implements WebviewViewProvider, Disposable { changeSetName?: string, enableDeployments = false, validationDetail?: ValidationDetail[], - deploymentMode?: DeploymentMode + deploymentMode?: DeploymentMode, + changeSetStatus?: string ) { this.stackName = stackName this.changes = changes @@ -58,6 +61,7 @@ export class DiffWebviewProvider implements WebviewViewProvider, Disposable { this.validationDetail = validationDetail } this.deploymentMode = deploymentMode + this.changeSetStatus = changeSetStatus await this.coordinator.setChangeSetMode(stackName, true) if (this._view) { @@ -120,6 +124,23 @@ export class DiffWebviewProvider implements WebviewViewProvider, Disposable { const displayedChanges = changes.slice(startIndex, endIndex) const hasNext = this.currentPage < this.totalPages - 1 const hasPrev = this.currentPage > 0 + const terminalChangeSetStatuses: string[] = [ + ChangeSetStatus.CREATE_COMPLETE, + ChangeSetStatus.FAILED, + ChangeSetStatus.DELETE_FAILED, + ] + + const deletionButton = ` + + ` if (!changes || changes.length === 0) { return ` @@ -137,6 +158,23 @@ export class DiffWebviewProvider implements WebviewViewProvider, Disposable {
No changes detected for stack: ${this.stackName}
+ ${ + this.changeSetName && + this.changeSetStatus && + terminalChangeSetStatuses.includes(this.changeSetStatus) + ? ` + + + ` + : '' + }