@@ -7,6 +7,7 @@ import globals from '../extensionGlobals'
7
7
8
8
import * as vscode from 'vscode'
9
9
import * as path from 'path'
10
+ import * as nls from 'vscode-nls'
10
11
import * as localizedText from '../localizedText'
11
12
import { DefaultS3Client } from '../clients/s3Client'
12
13
import { Wizard } from '../wizards/wizard'
@@ -40,7 +41,10 @@ import { parse } from 'semver'
40
41
import { isAutomation } from '../vscode/env'
41
42
import { getOverriddenParameters } from '../../lambda/config/parameterUtils'
42
43
import { addTelemetryEnvVar } from './cli/samCliInvokerUtils'
43
- import { samSyncUrl } from '../constants'
44
+ import { samSyncUrl , samInitDocUrl } from '../constants'
45
+ import { getAwsConsoleUrl } from '../awsConsole'
46
+
47
+ const localize = nls . loadMessageBundle ( )
44
48
45
49
export interface SyncParams {
46
50
readonly region : string
@@ -68,13 +72,22 @@ function createBucketPrompter(client: DefaultS3Client) {
68
72
69
73
return createQuickPick ( items , {
70
74
title : 'Select an S3 Bucket' ,
71
- placeholder : 'Filter or enter a new bucket name ' ,
75
+ placeholder : 'Select a bucket ( or enter a name to create one) ' ,
72
76
buttons : createCommonButtons ( samSyncUrl ) ,
73
77
filterBoxInputSettings : {
74
78
label : 'Create a New Bucket' ,
75
79
// This is basically a hack. I need to refactor `createQuickPick` a bit.
76
80
transform : v => prefixNewBucketName ( v ) ,
77
81
} ,
82
+ noItemsFoundItem : {
83
+ label : localize (
84
+ 'aws.cfn.noStacks' ,
85
+ 'No S3 buckets for region "{0}". Enter a name to create a new one.' ,
86
+ client . regionCode
87
+ ) ,
88
+ data : undefined ,
89
+ onClick : undefined ,
90
+ } ,
78
91
} )
79
92
}
80
93
@@ -84,6 +97,7 @@ const canShowStack = (s: StackSummary) =>
84
97
85
98
function createStackPrompter ( client : DefaultCloudFormationClient ) {
86
99
const recentStack = getRecentResponse ( client . regionCode , 'stackName' )
100
+ const consoleUrl = getAwsConsoleUrl ( 'cloudformation' , client . regionCode )
87
101
const items = client . listAllStacks ( ) . map ( stacks =>
88
102
stacks . filter ( canShowStack ) . map ( s => ( {
89
103
label : s . StackName ,
@@ -96,17 +110,27 @@ function createStackPrompter(client: DefaultCloudFormationClient) {
96
110
97
111
return createQuickPick ( items , {
98
112
title : 'Select a CloudFormation Stack' ,
99
- placeholder : 'Filter or enter a new stack name ' ,
113
+ placeholder : 'Select a stack ( or enter a name to create one) ' ,
100
114
filterBoxInputSettings : {
101
115
label : 'Create a New Stack' ,
102
116
transform : v => v ,
103
117
} ,
104
- buttons : createCommonButtons ( samSyncUrl ) ,
118
+ buttons : createCommonButtons ( samSyncUrl , consoleUrl ) ,
119
+ noItemsFoundItem : {
120
+ label : localize (
121
+ 'aws.cfn.noStacks' ,
122
+ 'No stacks in region "{0}". Enter a name to create a new one.' ,
123
+ client . regionCode
124
+ ) ,
125
+ data : undefined ,
126
+ onClick : undefined ,
127
+ } ,
105
128
} )
106
129
}
107
130
108
131
function createEcrPrompter ( client : DefaultEcrClient ) {
109
132
const recentEcrRepo = getRecentResponse ( client . regionCode , 'ecrRepoUri' )
133
+ const consoleUrl = getAwsConsoleUrl ( 'ecr' , client . regionCode )
110
134
const items = client . listAllRepositories ( ) . map ( list =>
111
135
list . map ( repo => ( {
112
136
label : repo . repositoryName ,
@@ -118,12 +142,21 @@ function createEcrPrompter(client: DefaultEcrClient) {
118
142
119
143
return createQuickPick ( items , {
120
144
title : 'Select an ECR Repository' ,
121
- placeholder : 'Filter or enter an existing repository URI' ,
122
- buttons : createCommonButtons ( samSyncUrl ) ,
145
+ placeholder : 'Select a repository ( or enter repository URI) ' ,
146
+ buttons : createCommonButtons ( samSyncUrl , consoleUrl ) ,
123
147
filterBoxInputSettings : {
124
148
label : 'Existing repository URI' ,
125
149
transform : v => v ,
126
150
} ,
151
+ noItemsFoundItem : {
152
+ label : localize (
153
+ 'aws.ecr.noRepos' ,
154
+ 'No ECR repositories in region "{0}". Enter a name to create a new one.' ,
155
+ client . regionCode
156
+ ) ,
157
+ data : undefined ,
158
+ onClick : undefined ,
159
+ } ,
127
160
} )
128
161
}
129
162
@@ -138,6 +171,7 @@ export function createEnvironmentPrompter(config: SamConfig, environments = conf
138
171
139
172
return createQuickPick ( items , {
140
173
title : 'Select an Environment to Use' ,
174
+ placeholder : 'Select an environment' ,
141
175
buttons : createCommonButtons ( samSyncUrl ) ,
142
176
} )
143
177
}
@@ -166,8 +200,14 @@ function createTemplatePrompter() {
166
200
167
201
const trimmedItems = folders . size === 1 ? items . map ( item => ( { ...item , description : undefined } ) ) : items
168
202
return createQuickPick ( trimmedItems , {
169
- title : 'Select a CloudFormation Template' ,
203
+ title : 'Select a SAM CloudFormation Template' ,
204
+ placeholder : 'Select a SAM template.yaml file' ,
170
205
buttons : createCommonButtons ( samSyncUrl ) ,
206
+ noItemsFoundItem : {
207
+ label : localize ( 'aws.sam.noWorkspace' , 'No SAM template.yaml file(s) found. Select for help' ) ,
208
+ data : undefined ,
209
+ onClick : ( ) => vscode . env . openExternal ( samInitDocUrl ) ,
210
+ } ,
171
211
} )
172
212
}
173
213
0 commit comments