diff --git a/package-lock.json b/package-lock.json index f5afc020fa2..335f510f9ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5171,13 +5171,15 @@ } }, "node_modules/@aws/mynah-ui": { - "version": "4.15.11", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.18.0.tgz", + "integrity": "sha512-oa26D9QtGxw9kZnDBq7OrVEPdBvmwK+MjlTIjW8L/TnlDTIYL3SBhU87iQCwkCRxWXckrjiSvW6Rexc2oasgvw==", "hasInstallScript": true, "license": "Apache License 2.0", "dependencies": { "escape-html": "^1.0.3", "just-clone": "^6.2.0", - "marked": "^12.0.2", + "marked": "^14.1.0", "prismjs": "1.29.0", "sanitize-html": "^2.12.1", "unescape-html": "^1.1.0" @@ -5192,7 +5194,9 @@ } }, "node_modules/@aws/mynah-ui/node_modules/marked": { - "version": "12.0.2", + "version": "14.1.4", + "resolved": "https://registry.npmjs.org/marked/-/marked-14.1.4.tgz", + "integrity": "sha512-vkVZ8ONmUdPnjCKc5uTRvmkRbx4EAi2OkTOXmfTDhZz3OFqMNBM1oTTWwTr4HY4uAEojhzPf+Fy8F1DWa3Sndg==", "license": "MIT", "bin": { "marked": "bin/marked.js" @@ -20001,7 +20005,7 @@ }, "packages/amazonq": { "name": "amazon-q-vscode", - "version": "1.34.0-SNAPSHOT", + "version": "1.36.0-SNAPSHOT", "license": "Apache-2.0", "dependencies": { "aws-core-vscode": "file:../core/" @@ -20030,7 +20034,7 @@ "@aws-sdk/property-provider": "3.46.0", "@aws-sdk/smithy-client": "^3.46.0", "@aws-sdk/util-arn-parser": "^3.46.0", - "@aws/mynah-ui": "^4.15.11", + "@aws/mynah-ui": "^4.18.0", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "@iarna/toml": "^2.2.5", "@smithy/middleware-retry": "^2.3.1", @@ -20160,7 +20164,7 @@ }, "packages/toolkit": { "name": "aws-toolkit-vscode", - "version": "3.32.0-SNAPSHOT", + "version": "3.34.0-SNAPSHOT", "license": "Apache-2.0", "dependencies": { "aws-core-vscode": "file:../core/" diff --git a/packages/core/src/awsService/appBuilder/explorer/openTemplate.ts b/packages/core/src/awsService/appBuilder/explorer/openTemplate.ts index 9526e098119..00ed697f6d3 100644 --- a/packages/core/src/awsService/appBuilder/explorer/openTemplate.ts +++ b/packages/core/src/awsService/appBuilder/explorer/openTemplate.ts @@ -7,7 +7,7 @@ import { CloudFormationTemplateRegistry } from '../../../shared/fs/templateRegis import { syncMementoRootKey } from '../../../shared/sam/sync' import { createExitPrompter } from '../../../shared/ui/common/exitPrompter' -import { createTemplatePrompter, TemplateItem } from '../../../shared/ui/common/samTemplate' +import { createTemplatePrompter, TemplateItem } from '../../../shared/ui/sam/samTemplate' import { Wizard } from '../../../shared/wizards/wizard' export interface OpenTemplateParams { diff --git a/packages/core/src/shared/sam/build.ts b/packages/core/src/shared/sam/build.ts index 0d91df01a26..8f68da4a194 100644 --- a/packages/core/src/shared/sam/build.ts +++ b/packages/core/src/shared/sam/build.ts @@ -4,7 +4,7 @@ */ import * as vscode from 'vscode' -import { TemplateItem, createTemplatePrompter } from '../ui/common/samTemplate' +import { TemplateItem, createTemplatePrompter } from '../ui/sam/samTemplate' import { ChildProcess } from '../utilities/processUtils' import { addTelemetryEnvVar } from './cli/samCliInvokerUtils' import { Wizard } from '../wizards/wizard' diff --git a/packages/core/src/shared/sam/deploy.ts b/packages/core/src/shared/sam/deploy.ts index 8ff813209fc..c3bb48c99b2 100644 --- a/packages/core/src/shared/sam/deploy.ts +++ b/packages/core/src/shared/sam/deploy.ts @@ -22,11 +22,11 @@ import { CancellationError } from '../utilities/timeoutUtils' import { Wizard } from '../wizards/wizard' import { addTelemetryEnvVar } from './cli/samCliInvokerUtils' import { validateSamDeployConfig, SamConfig, writeSamconfigGlobal } from './config' -import { BucketSource, createBucketSourcePrompter, createBucketPrompter } from '../ui/common/bucket' -import { createStackPrompter } from '../ui/common/stack' -import { TemplateItem, createTemplatePrompter } from '../ui/common/samTemplate' +import { BucketSource, createBucketSourcePrompter, createBucketPrompter } from '../ui/sam/bucket' +import { createStackPrompter } from '../ui/sam/stack' +import { TemplateItem, createTemplatePrompter } from '../ui/sam/samTemplate' import { getProjectRoot, getRecentResponse, getSamCliPathAndVersion, getSource, updateRecentResponse } from './utils' -import { createDeployParamsSourcePrompter, ParamsSource } from '../ui/common/paramsSource' +import { createDeployParamsSourcePrompter, ParamsSource } from '../ui/sam/paramsSource' import { runInTerminal } from './processTerminal' export interface DeployParams { diff --git a/packages/core/src/shared/sam/sync.ts b/packages/core/src/shared/sam/sync.ts index 9d08b9e13aa..192492ea3d2 100644 --- a/packages/core/src/shared/sam/sync.ts +++ b/packages/core/src/shared/sam/sync.ts @@ -45,11 +45,11 @@ import { getSource, updateRecentResponse, } from './utils' -import { TemplateItem, createTemplatePrompter } from '../ui/common/samTemplate' -import { createStackPrompter } from '../ui/common/stack' -import { ParamsSource, createSyncParamsSourcePrompter } from '../ui/common/paramsSource' -import { createEcrPrompter } from '../ui/common/ecr' -import { BucketSource, createBucketPrompter } from '../ui/common/bucket' +import { TemplateItem, createTemplatePrompter } from '../ui/sam/samTemplate' +import { createStackPrompter } from '../ui/sam/stack' +import { ParamsSource, createSyncParamsSourcePrompter } from '../ui/sam/paramsSource' +import { createEcrPrompter } from '../ui/sam/ecr' +import { BucketSource, createBucketPrompter } from '../ui/sam/bucket' import { runInTerminal } from './processTerminal' export interface SyncParams { @@ -67,8 +67,6 @@ export interface SyncParams { readonly syncFlags?: string } -export const prefixNewBucketName = (name: string) => `newbucket:${name}` -export const prefixNewRepoName = (name: string) => `newrepo:${name}` export const syncMementoRootKey = 'samcli.sync.params' // TODO: hook this up so it prompts the user when more than 1 environment is present in `samconfig.toml` diff --git a/packages/core/src/shared/sam/utils.ts b/packages/core/src/shared/sam/utils.ts index b562be81c31..74bb3101e66 100644 --- a/packages/core/src/shared/sam/utils.ts +++ b/packages/core/src/shared/sam/utils.ts @@ -8,7 +8,7 @@ import * as path from 'path' import { AWSTreeNodeBase } from '../treeview/nodes/awsTreeNodeBase' import { TreeNode, isTreeNode } from '../treeview/resourceTreeDataProvider' import * as CloudFormation from '../cloudformation/cloudformation' -import { TemplateItem } from '../ui/common/samTemplate' +import { TemplateItem } from '../ui/sam/samTemplate' import { RuntimeFamily, getFamily } from '../../lambda/models/samLambdaRuntime' import { SamCliSettings } from './cli/samCliSettings' import { ToolkitError } from '../errors' diff --git a/packages/core/src/shared/ui/common/bucket.ts b/packages/core/src/shared/ui/sam/bucket.ts similarity index 94% rename from packages/core/src/shared/ui/common/bucket.ts rename to packages/core/src/shared/ui/sam/bucket.ts index bcaa1dde36e..9b8c00bfa82 100644 --- a/packages/core/src/shared/ui/common/bucket.ts +++ b/packages/core/src/shared/ui/sam/bucket.ts @@ -6,11 +6,12 @@ import { DefaultS3Client } from '../../clients/s3Client' import { samDeployUrl, samSyncUrl } from '../../constants' import { createCommonButtons } from '../buttons' import { createQuickPick, DataQuickPickItem } from '../pickerPrompter' -import { SyncParams, prefixNewBucketName } from '../../sam/sync' +import type { SyncParams } from '../../sam/sync' import * as nls from 'vscode-nls' import { getRecentResponse } from '../../sam/utils' const localize = nls.loadMessageBundle() +export const prefixNewBucketName = (name: string) => `newbucket:${name}` export enum BucketSource { SamCliManaged, diff --git a/packages/core/src/shared/ui/common/ecr.ts b/packages/core/src/shared/ui/sam/ecr.ts similarity index 96% rename from packages/core/src/shared/ui/common/ecr.ts rename to packages/core/src/shared/ui/sam/ecr.ts index 094ad3ffb83..41b2b898a46 100644 --- a/packages/core/src/shared/ui/common/ecr.ts +++ b/packages/core/src/shared/ui/sam/ecr.ts @@ -7,11 +7,12 @@ import { DefaultEcrClient } from '../../clients/ecrClient' import { samSyncUrl } from '../../constants' import { createCommonButtons } from '../buttons' import { createQuickPick } from '../pickerPrompter' -import { prefixNewRepoName } from '../../sam/sync' + import * as nls from 'vscode-nls' import { getRecentResponse } from '../../sam/utils' export const localize = nls.loadMessageBundle() +export const prefixNewRepoName = (name: string) => `newrepo:${name}` export function createEcrPrompter(client: DefaultEcrClient, mementoRootKey: string) { const recentEcrRepo = getRecentResponse(mementoRootKey, client.regionCode, 'ecrRepoUri') diff --git a/packages/core/src/shared/ui/common/paramsSource.ts b/packages/core/src/shared/ui/sam/paramsSource.ts similarity index 93% rename from packages/core/src/shared/ui/common/paramsSource.ts rename to packages/core/src/shared/ui/sam/paramsSource.ts index a986701eea6..7456568786d 100644 --- a/packages/core/src/shared/ui/common/paramsSource.ts +++ b/packages/core/src/shared/ui/sam/paramsSource.ts @@ -38,7 +38,7 @@ export function createDeployParamsSourcePrompter(existValidSamconfig: boolean | const items = loadParamsSourcePrompterItems(existValidSamconfig) return createQuickPick(items, { - title: 'Specify parameters for deploy', + title: 'Specify parameter source for deploy', placeholder: 'Press enter to proceed with highlighted option', buttons: createCommonButtons(samDeployUrl), }) @@ -48,7 +48,7 @@ export function createSyncParamsSourcePrompter(existValidSamconfig: boolean | un const items = loadParamsSourcePrompterItems(existValidSamconfig) return createQuickPick(items, { - title: 'Specify parameters for sync', + title: 'Specify parameter source for sync', placeholder: 'Press enter to proceed with highlighted option', buttons: createCommonButtons(samSyncUrl), }) diff --git a/packages/core/src/shared/ui/common/samTemplate.ts b/packages/core/src/shared/ui/sam/samTemplate.ts similarity index 100% rename from packages/core/src/shared/ui/common/samTemplate.ts rename to packages/core/src/shared/ui/sam/samTemplate.ts diff --git a/packages/core/src/shared/ui/common/stack.ts b/packages/core/src/shared/ui/sam/stack.ts similarity index 100% rename from packages/core/src/shared/ui/common/stack.ts rename to packages/core/src/shared/ui/sam/stack.ts diff --git a/packages/core/src/test/awsService/appBuilder/wizards/deployTypeWizard.test.ts b/packages/core/src/test/awsService/appBuilder/wizards/deployTypeWizard.test.ts index 86292ebe856..a75c7c8b9a2 100644 --- a/packages/core/src/test/awsService/appBuilder/wizards/deployTypeWizard.test.ts +++ b/packages/core/src/test/awsService/appBuilder/wizards/deployTypeWizard.test.ts @@ -69,7 +69,7 @@ describe('DeployTypeWizard', function () { .handleInputBox('Specify SAM parameter value for DestinationBucketName', (inputBox) => { inputBox.acceptValue('my-destination-bucket-name') }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() assert.strictEqual(quickPick.items[2].label, 'Use default values from samconfig') @@ -98,7 +98,7 @@ describe('DeployTypeWizard', function () { assert.strictEqual(picker.items.length, 2) picker.acceptItem(picker.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for sync', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() assert.strictEqual(quickPick.items[2].label, 'Use default values from samconfig') diff --git a/packages/core/src/test/shared/sam/build.test.ts b/packages/core/src/test/shared/sam/build.test.ts index a8323bea890..144c70d670e 100644 --- a/packages/core/src/test/shared/sam/build.test.ts +++ b/packages/core/src/test/shared/sam/build.test.ts @@ -21,7 +21,7 @@ import { getProjectRootUri } from '../../../shared/sam/utils' import sinon from 'sinon' import { createMultiPick, DataQuickPickItem } from '../../../shared/ui/pickerPrompter' import * as config from '../../../shared/sam/config' -import { getTestWindow } from '../vscode/window' +import { PrompterTester } from '../wizards/prompterTester' describe('BuildWizard', async function () { const createTester = async (params?: Partial, arg?: TreeNode | undefined) => @@ -135,20 +135,22 @@ describe('getBuildFlags', () => { }) it('should return flags from buildFlagsPrompter when paramsSource is Specify', async () => { - getTestWindow().onDidShowQuickPick(async (picker) => { - await picker.untilReady() - assert.strictEqual(picker.items.length, 9) - assert.strictEqual(picker.title, 'Select build flags') - assert.deepStrictEqual(picker.items, quickPickItems) - const betaFeatures = picker.items[0] - const buildInSource = picker.items[1] - const cached = picker.items[2] - assert.strictEqual(betaFeatures.data, '--beta-features') - assert.strictEqual(buildInSource.data, '--build-in-source') - assert.strictEqual(cached.data, '--cached') - const acceptedItems = [betaFeatures, buildInSource, cached] - picker.acceptItems(...acceptedItems) - }) + PrompterTester.init() + .handleQuickPick('Select build flags', async (picker) => { + await picker.untilReady() + assert.strictEqual(picker.items.length, 9) + assert.strictEqual(picker.title, 'Select build flags') + assert.deepStrictEqual(picker.items, quickPickItems) + const betaFeatures = picker.items[0] + const buildInSource = picker.items[1] + const cached = picker.items[2] + assert.strictEqual(betaFeatures.data, '--beta-features') + assert.strictEqual(buildInSource.data, '--build-in-source') + assert.strictEqual(cached.data, '--cached') + const acceptedItems = [betaFeatures, buildInSource, cached] + picker.acceptItems(...acceptedItems) + }) + .build() const flags = await createMultiPick(quickPickItems, { title: 'Select build flags', diff --git a/packages/core/src/test/shared/sam/deploy.test.ts b/packages/core/src/test/shared/sam/deploy.test.ts index 7a720b4c332..0b54c462e9d 100644 --- a/packages/core/src/test/shared/sam/deploy.test.ts +++ b/packages/core/src/test/shared/sam/deploy.test.ts @@ -30,9 +30,9 @@ import { UserAgent as __UserAgent } from '@smithy/types' import { SamAppLocation } from '../../../awsService/appBuilder/explorer/samProject' import { CancellationError } from '../../../shared/utilities/timeoutUtils' -import { TemplateItem } from '../../../shared/ui/common/samTemplate' -import { ParamsSource } from '../../../shared/ui/common/paramsSource' -import { BucketSource } from '../../../shared/ui/common/bucket' +import { TemplateItem } from '../../../shared/ui/sam/samTemplate' +import { ParamsSource } from '../../../shared/ui/sam/paramsSource' +import { BucketSource } from '../../../shared/ui/sam/bucket' describe('DeployWizard', async function () { let sandbox: sinon.SinonSandbox @@ -95,7 +95,7 @@ describe('DeployWizard', async function () { .handleInputBox('Specify SAM parameter value for DestinationBucketName', (inputBox) => { inputBox.acceptValue('my-destination-bucket-name') }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -166,7 +166,7 @@ describe('DeployWizard', async function () { .handleInputBox('Specify SAM parameter value for DestinationBucketName', (inputBox) => { inputBox.acceptValue('my-destination-bucket-name') }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -224,7 +224,7 @@ describe('DeployWizard', async function () { // provide testWindow so that we can call other api const testWindow = getTestWindow() - PrompterTester.init(testWindow) + PrompterTester.init({ testWindow }) .handleQuickPick('Select a SAM/CloudFormation Template', async (quickPick) => { // Need sometime to wait for the template to search for template file await quickPick.untilReady() @@ -232,7 +232,7 @@ describe('DeployWizard', async function () { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -306,7 +306,7 @@ describe('DeployWizard', async function () { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -367,7 +367,7 @@ describe('DeployWizard', async function () { .handleInputBox('Specify SAM parameter value for DestinationBucketName', (inputBox) => { inputBox.acceptValue('my-destination-bucket-name') }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -438,7 +438,7 @@ describe('DeployWizard', async function () { .handleInputBox('Specify SAM parameter value for DestinationBucketName', (inputBox) => { inputBox.acceptValue('my-destination-bucket-name') }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() @@ -495,7 +495,7 @@ describe('DeployWizard', async function () { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() assert.strictEqual(quickPick.items.length, 2) @@ -579,7 +579,7 @@ describe('DeployWizard', async function () { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for deploy', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() assert.strictEqual(quickPick.items.length, 3) diff --git a/packages/core/src/test/shared/sam/sync.test.ts b/packages/core/src/test/shared/sam/sync.test.ts index c7724f0f146..af32d363455 100644 --- a/packages/core/src/test/shared/sam/sync.test.ts +++ b/packages/core/src/test/shared/sam/sync.test.ts @@ -55,8 +55,8 @@ import { AppNode } from '../../../awsService/appBuilder/explorer/nodes/appNode' import * as Cfn from '../../../shared/cloudformation/cloudformation' //import { beforeEach } from 'mocha' import { getWorkspaceFolder, TestFolder } from '../../testUtil' -import { TemplateItem } from '../../../shared/ui/common/samTemplate' -import { ParamsSource } from '../../../shared/ui/common/paramsSource' +import { TemplateItem } from '../../../shared/ui/sam/samTemplate' +import { ParamsSource } from '../../../shared/ui/sam/paramsSource' import { CloudFormationTemplateRegistry } from '../../../shared/fs/templateRegistry' import { samconfigCompleteData, samconfigInvalidData, validTemplateData } from '../../shared/sam/samTestUtils' @@ -559,7 +559,7 @@ describe('SyncWizard', async () => { await testFolder.write('samconfig.toml', samconfigInvalidData) const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -632,7 +632,7 @@ describe('SyncWizard', async () => { await testFolder.write('samconfig.toml', samconfigCompleteData) const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (quickPick) => { + .handleQuickPick('Specify parameter source for sync', async (quickPick) => { // Need time to check samconfig.toml file and generate options await quickPick.untilReady() assert.strictEqual(quickPick.items.length, 3) @@ -685,7 +685,7 @@ describe('SyncWizard', async () => { */ const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -755,7 +755,7 @@ describe('SyncWizard', async () => { await testFolder.write('samconfig.toml', samconfigCompleteData) const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -815,7 +815,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -888,7 +888,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -938,7 +938,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -985,7 +985,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -1060,7 +1060,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -1137,7 +1137,7 @@ describe('SyncWizard', async () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() @@ -1269,7 +1269,7 @@ describe('SAM Sync', () => { assert.strictEqual(quickPick.items[0].label, templateFile.fsPath) quickPick.acceptItem(quickPick.items[0]) }) - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() assert.strictEqual(picker.items[0].label, 'Specify required parameters and save as defaults') @@ -1347,7 +1347,7 @@ describe('SAM Sync', () => { it('[entry: template file] specify flag should instantiate correct process in terminal', async () => { const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() assert.strictEqual(picker.items[1].label, 'Specify required parameters') @@ -1431,7 +1431,7 @@ describe('SAM Sync', () => { const samconfigFile = vscode.Uri.file(await testFolder.write('samconfig.toml', samconfigCompleteData)) const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() assert.strictEqual(picker.items[2].label, 'Use default values from samconfig') @@ -1533,7 +1533,7 @@ describe('SAM Sync', () => { getTestWindow().onDidShowMessage((m) => m.items.find((i) => i.title === 'OK')?.select()) const prompterTester = PrompterTester.init() - .handleQuickPick('Specify parameters for deploy', async (picker) => { + .handleQuickPick('Specify parameter source for sync', async (picker) => { // Need time to check samconfig.toml file and generate options await picker.untilReady() assert.strictEqual(picker.items[2].label, 'Use default values from samconfig') diff --git a/packages/core/src/test/shared/sam/utils.test.ts b/packages/core/src/test/shared/sam/utils.test.ts index b17780a2019..c8fbe6f7d8f 100644 --- a/packages/core/src/test/shared/sam/utils.test.ts +++ b/packages/core/src/test/shared/sam/utils.test.ts @@ -12,7 +12,7 @@ import { RegionNode } from '../../../awsexplorer/regionNode' import { Region } from '../../../shared/regions/endpoints' import { RegionProvider } from '../../../shared' import { DeployedResource, DeployedResourceNode } from '../../../awsService/appBuilder/explorer/nodes/deployedNode' -import { TemplateItem } from '../../../shared/ui/common/samTemplate' +import { TemplateItem } from '../../../shared/ui/sam/samTemplate' describe('SAM utils', async function () { it('returns the projectRoot', async function () { diff --git a/packages/core/src/test/shared/ui/prompters/bucket.test.ts b/packages/core/src/test/shared/ui/sam/bucket.test.ts similarity index 97% rename from packages/core/src/test/shared/ui/prompters/bucket.test.ts rename to packages/core/src/test/shared/ui/sam/bucket.test.ts index d9482132718..e140b3312f7 100644 --- a/packages/core/src/test/shared/ui/prompters/bucket.test.ts +++ b/packages/core/src/test/shared/ui/sam/bucket.test.ts @@ -8,7 +8,7 @@ import { S3 } from 'aws-sdk' import sinon from 'sinon' import { DefaultS3Client } from '../../../../shared/clients/s3Client' import * as SamUtilsModule from '../../../../shared/sam/utils' -import { createBucketPrompter } from '../../../../shared/ui/common/bucket' +import { createBucketPrompter } from '../../../../shared/ui/sam/bucket' import { AsyncCollection } from '../../../../shared/utilities/asyncCollection' import { RequiredProps } from '../../../../shared/utilities/tsUtils' diff --git a/packages/core/src/test/shared/ui/prompters/ecr.test.ts b/packages/core/src/test/shared/ui/sam/ecr.test.ts similarity index 98% rename from packages/core/src/test/shared/ui/prompters/ecr.test.ts rename to packages/core/src/test/shared/ui/sam/ecr.test.ts index 568795dcb4b..afb795bc50d 100644 --- a/packages/core/src/test/shared/ui/prompters/ecr.test.ts +++ b/packages/core/src/test/shared/ui/sam/ecr.test.ts @@ -10,7 +10,7 @@ import { DefaultEcrClient, EcrRepository } from '../../../../shared/clients/ecrC import { samSyncUrl } from '../../../../shared/constants' import * as SamUtilsModule from '../../../../shared/sam/utils' import * as ButtonsModule from '../../../../shared/ui/buttons' -import { createEcrPrompter } from '../../../../shared/ui/common/ecr' +import { createEcrPrompter } from '../../../../shared/ui/sam/ecr' import { intoCollection } from '../../../../shared/utilities/collectionUtils' describe('createEcrPrompter', () => { diff --git a/packages/core/src/test/shared/ui/prompters/paramSource.test.ts b/packages/core/src/test/shared/ui/sam/paramSource.test.ts similarity index 91% rename from packages/core/src/test/shared/ui/prompters/paramSource.test.ts rename to packages/core/src/test/shared/ui/sam/paramSource.test.ts index deff40f3eeb..7ab6bd44c3b 100644 --- a/packages/core/src/test/shared/ui/prompters/paramSource.test.ts +++ b/packages/core/src/test/shared/ui/sam/paramSource.test.ts @@ -8,7 +8,7 @@ import { createDeployParamsSourcePrompter, createSyncParamsSourcePrompter, ParamsSource, -} from '../../../../shared/ui/common/paramsSource' +} from '../../../../shared/ui/sam/paramsSource' import { DataQuickPickItem } from '../../../../shared/ui/pickerPrompter' describe('createSyncParamsSourcePrompter', () => { @@ -25,7 +25,7 @@ describe('createSyncParamsSourcePrompter', () => { ] const prompter = createSyncParamsSourcePrompter(false) const quickPick = prompter.quickPick - assert.strictEqual(quickPick.title, 'Specify parameters for sync') + assert.strictEqual(quickPick.title, 'Specify parameter source for sync') assert.strictEqual(quickPick.placeholder, 'Press enter to proceed with highlighted option') assert.strictEqual(quickPick.items.length, 2) assert.deepStrictEqual(quickPick.items, expectedItems) @@ -48,7 +48,7 @@ describe('createSyncParamsSourcePrompter', () => { ] const prompter = createSyncParamsSourcePrompter(true) const quickPick = prompter.quickPick - assert.strictEqual(quickPick.title, 'Specify parameters for sync') + assert.strictEqual(quickPick.title, 'Specify parameter source for sync') assert.strictEqual(quickPick.placeholder, 'Press enter to proceed with highlighted option') assert.strictEqual(quickPick.items.length, 3) assert.deepStrictEqual(quickPick.items, expectedItems) @@ -69,7 +69,7 @@ describe('createDeployParamsSourcePrompter', () => { ] const prompter = createDeployParamsSourcePrompter(false) const quickPick = prompter.quickPick - assert.strictEqual(quickPick.title, 'Specify parameters for deploy') + assert.strictEqual(quickPick.title, 'Specify parameter source for deploy') assert.strictEqual(quickPick.placeholder, 'Press enter to proceed with highlighted option') assert.strictEqual(quickPick.items.length, 2) assert.deepStrictEqual(quickPick.items, expectedItems) @@ -92,7 +92,7 @@ describe('createDeployParamsSourcePrompter', () => { ] const prompter = createDeployParamsSourcePrompter(true) const quickPick = prompter.quickPick - assert.strictEqual(quickPick.title, 'Specify parameters for deploy') + assert.strictEqual(quickPick.title, 'Specify parameter source for deploy') assert.strictEqual(quickPick.placeholder, 'Press enter to proceed with highlighted option') assert.strictEqual(quickPick.items.length, 3) assert.deepStrictEqual(quickPick.items, expectedItems) diff --git a/packages/core/src/test/shared/ui/prompters/samTemplate.test.ts b/packages/core/src/test/shared/ui/sam/samTemplate.test.ts similarity index 96% rename from packages/core/src/test/shared/ui/prompters/samTemplate.test.ts rename to packages/core/src/test/shared/ui/sam/samTemplate.test.ts index da83861e9c6..3667c48161b 100644 --- a/packages/core/src/test/shared/ui/prompters/samTemplate.test.ts +++ b/packages/core/src/test/shared/ui/sam/samTemplate.test.ts @@ -11,7 +11,7 @@ import * as Cfn from '../../../../shared/cloudformation/cloudformation' import { CloudFormationTemplateRegistry } from '../../../../shared/fs/templateRegistry' import { WatchedItem } from '../../../../shared/fs/watchedFiles' import * as SamUtilsModule from '../../../../shared/sam/utils' -import { createTemplatePrompter } from '../../../../shared/ui/common/samTemplate' +import { createTemplatePrompter } from '../../../../shared/ui/sam/samTemplate' import { assertEqualPaths } from '../../../testUtil' describe('createTemplatePrompter', () => { diff --git a/packages/core/src/test/shared/ui/prompters/stack.test.ts b/packages/core/src/test/shared/ui/sam/stack.test.ts similarity index 98% rename from packages/core/src/test/shared/ui/prompters/stack.test.ts rename to packages/core/src/test/shared/ui/sam/stack.test.ts index 673ec6d0c74..1b962c2cb6e 100644 --- a/packages/core/src/test/shared/ui/prompters/stack.test.ts +++ b/packages/core/src/test/shared/ui/sam/stack.test.ts @@ -12,7 +12,7 @@ import * as SamUtilsModule from '../../../../shared/sam/utils' import * as ButtonsModule from '../../../../shared/ui/buttons' import { DefaultCloudFormationClient } from '../../../../shared/clients/cloudFormationClient' import { samSyncUrl } from '../../../../shared/constants' -import { createStackPrompter } from '../../../../shared/ui/common/stack' +import { createStackPrompter } from '../../../../shared/ui/sam/stack' import { intoCollection } from '../../../../shared/utilities/collectionUtils' describe('createStackPrompter', () => { diff --git a/packages/core/src/test/shared/wizards/prompterTester.ts b/packages/core/src/test/shared/wizards/prompterTester.ts index 432944ce947..cac7e031003 100644 --- a/packages/core/src/test/shared/wizards/prompterTester.ts +++ b/packages/core/src/test/shared/wizards/prompterTester.ts @@ -7,19 +7,26 @@ import assert from 'assert' import { TestInputBox, TestQuickPick } from '../vscode/quickInput' import { getTestWindow, TestWindow } from '../vscode/window' +interface PrompterTesterConfig { + testWindow?: TestWindow + handlerTimeout?: number +} + export class PrompterTester { private quickPickHandlers: Map void> = new Map() private inputBoxHanlder: Map void> = new Map() private testWindow: TestWindow private callLog = Array() + private handlerTimout: number = 3000 // Default timeout to 3 seconds private callLogCount = new Map() - private constructor(testWindow?: TestWindow) { - this.testWindow = testWindow || getTestWindow() + private constructor(config?: PrompterTesterConfig) { + this.testWindow = config?.testWindow || getTestWindow() + this.handlerTimout = config?.handlerTimeout || this.handlerTimout } - static init(testWindow?: TestWindow): PrompterTester { - return new PrompterTester(testWindow) + static init(config?: PrompterTesterConfig): PrompterTester { + return new PrompterTester(config) } handleQuickPick(titlePattern: string, handler: (input: TestQuickPick) => void): PrompterTester { @@ -96,15 +103,27 @@ export class PrompterTester { return [...this.quickPickHandlers.keys(), ...this.inputBoxHanlder.keys()] } - private handle(input: any, handlers: any) { - for (const [pattern, handler] of handlers) { - if (input.title?.includes(pattern)) { - handler(input) - this.record(pattern) - return - } + private async handle(input: any, handlers: any) { + const handler = handlers.get(input.title) + + if (handler === undefined) { + return this.handleUnknownPrompter(input) + } + + try { + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => { + reject(new Error(`Handler for "${input.title}" exceeded ${this.handlerTimout}ms timeout`)) + }, this.handlerTimout) + }) + + await Promise.race([handler(input), timeoutPromise]) + } catch (e) { + // clean up UI on callback function early exit (e.g assertion failure) + await input.dispose() + throw e } - this.handleUnknownPrompter(input) + this.record(input.title) } private handleUnknownPrompter(input: any) { diff --git a/packages/toolkit/.changes/next-release/Bug Fix-6d959757-2d07-40a7-af18-f1b52473ec2d.json b/packages/toolkit/.changes/next-release/Bug Fix-6d959757-2d07-40a7-af18-f1b52473ec2d.json new file mode 100644 index 00000000000..132bf3bab6b --- /dev/null +++ b/packages/toolkit/.changes/next-release/Bug Fix-6d959757-2d07-40a7-af18-f1b52473ec2d.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "SAM: Update Sync and Deploy prompter titles for parameter source" +} diff --git a/packages/toolkit/.changes/next-release/Bug Fix-a60cf459-c957-4a38-9d77-2fc512fbac4a.json b/packages/toolkit/.changes/next-release/Bug Fix-a60cf459-c957-4a38-9d77-2fc512fbac4a.json new file mode 100644 index 00000000000..7470f82d4b7 --- /dev/null +++ b/packages/toolkit/.changes/next-release/Bug Fix-a60cf459-c957-4a38-9d77-2fc512fbac4a.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "SAM: Update Sync prompter title for sync parameters" +} diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index 6e08f21cf09..e4279eb0686 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -4066,277 +4066,270 @@ "fontCharacter": "\\f1b4" } }, - "aws-amazonq-transform-landing-page-icon": { - "description": "AWS Contributed Icon", - "default": { - "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1b5" - } - }, "aws-amazonq-transform-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1b6" + "fontCharacter": "\\f1b5" } }, "aws-amazonq-transform-step-into-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1b7" + "fontCharacter": "\\f1b6" } }, "aws-amazonq-transform-step-into-light": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1b8" + "fontCharacter": "\\f1b7" } }, "aws-amazonq-transform-variables-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1b9" + "fontCharacter": "\\f1b8" } }, "aws-amazonq-transform-variables-light": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ba" + "fontCharacter": "\\f1b9" } }, "aws-applicationcomposer-icon": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bb" + "fontCharacter": "\\f1ba" } }, "aws-applicationcomposer-icon-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bc" + "fontCharacter": "\\f1bb" } }, "aws-apprunner-service": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bd" + "fontCharacter": "\\f1bc" } }, "aws-cdk-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1be" + "fontCharacter": "\\f1bd" } }, "aws-cloudformation-stack": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bf" + "fontCharacter": "\\f1be" } }, "aws-cloudwatch-log-group": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c0" + "fontCharacter": "\\f1bf" } }, "aws-codecatalyst-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c1" + "fontCharacter": "\\f1c0" } }, "aws-codewhisperer-icon-black": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c2" + "fontCharacter": "\\f1c1" } }, "aws-codewhisperer-icon-white": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c3" + "fontCharacter": "\\f1c2" } }, "aws-codewhisperer-learn": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c4" + "fontCharacter": "\\f1c3" } }, "aws-ecr-registry": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c5" + "fontCharacter": "\\f1c4" } }, "aws-ecs-cluster": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c6" + "fontCharacter": "\\f1c5" } }, "aws-ecs-container": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c7" + "fontCharacter": "\\f1c6" } }, "aws-ecs-service": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c8" + "fontCharacter": "\\f1c7" } }, "aws-generic-attach-file": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c9" + "fontCharacter": "\\f1c8" } }, "aws-iot-certificate": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ca" + "fontCharacter": "\\f1c9" } }, "aws-iot-policy": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cb" + "fontCharacter": "\\f1ca" } }, "aws-iot-thing": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cc" + "fontCharacter": "\\f1cb" } }, "aws-lambda-function": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cd" + "fontCharacter": "\\f1cc" } }, "aws-mynah-MynahIconBlack": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ce" + "fontCharacter": "\\f1cd" } }, "aws-mynah-MynahIconWhite": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cf" + "fontCharacter": "\\f1ce" } }, "aws-mynah-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d0" + "fontCharacter": "\\f1cf" } }, "aws-redshift-cluster": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d1" + "fontCharacter": "\\f1d0" } }, "aws-redshift-cluster-connected": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d2" + "fontCharacter": "\\f1d1" } }, "aws-redshift-database": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d3" + "fontCharacter": "\\f1d2" } }, "aws-redshift-redshift-cluster-connected": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d4" + "fontCharacter": "\\f1d3" } }, "aws-redshift-schema": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d5" + "fontCharacter": "\\f1d4" } }, "aws-redshift-table": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d6" + "fontCharacter": "\\f1d5" } }, "aws-s3-bucket": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d7" + "fontCharacter": "\\f1d6" } }, "aws-s3-create-bucket": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d8" + "fontCharacter": "\\f1d7" } }, "aws-schemas-registry": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d9" + "fontCharacter": "\\f1d8" } }, "aws-schemas-schema": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1da" + "fontCharacter": "\\f1d9" } }, "aws-stepfunctions-preview": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1db" + "fontCharacter": "\\f1da" } } },