@@ -19,14 +19,13 @@ import { SamCliBuildInvocation } from '../../shared/sam/cli/samCliBuild'
1919import { getSamCliContext } from '../../shared/sam/cli/samCliContext'
2020import { SamTemplateGenerator } from '../../shared/templates/sam/samTemplateGenerator'
2121import { addCodiconToString } from '../../shared/utilities/textUtilities'
22- import { getLambdaEditFromNameRegion , getLambdaDetails , listLambdaFunctions } from '../utils'
22+ import { getLambdaDetails , listLambdaFunctions } from '../utils'
2323import { getIdeProperties } from '../../shared/extensionUtilities'
2424import { createQuickPick , DataQuickPickItem } from '../../shared/ui/pickerPrompter'
2525import { createCommonButtons } from '../../shared/ui/buttons'
2626import { StepEstimator , Wizard , WIZARD_BACK } from '../../shared/wizards/wizard'
2727import { createSingleFileDialog } from '../../shared/ui/common/openDialog'
2828import { Prompter , PromptResult } from '../../shared/ui/prompter'
29- import { SkipPrompter } from '../../shared/ui/common/skipPrompter'
3029import { ToolkitError } from '../../shared/errors'
3130import { FunctionConfiguration } from 'aws-sdk/clients/lambda'
3231import globals from '../../shared/extensionGlobals'
@@ -104,13 +103,6 @@ export async function uploadLambdaCommand(lambdaArg?: LambdaFunction, path?: vsc
104103 } else if ( response . uploadType === 'directory' && response . directoryBuildType ) {
105104 result = ( await runUploadDirectory ( lambda , response . directoryBuildType , response . targetUri ) ) ?? result
106105 result = 'Succeeded'
107- } else if ( response . uploadType === 'edit' ) {
108- const functionPath = getLambdaEditFromNameRegion ( lambda . name , lambda . region ) ?. location
109- if ( ! functionPath ) {
110- throw new ToolkitError ( 'Function had a local copy before, but not anymore' )
111- } else {
112- await runUploadDirectory ( lambda , 'zip' , vscode . Uri . file ( functionPath ) )
113- }
114106 }
115107 // TODO(sijaden): potentially allow the wizard to easily support tagged-union states
116108 } catch ( err ) {
@@ -139,8 +131,8 @@ export async function uploadLambdaCommand(lambdaArg?: LambdaFunction, path?: vsc
139131/**
140132 * Selects the type of file to upload (zip/dir) and proceeds with the rest of the workflow.
141133 */
142- function createUploadTypePrompter ( lambda ?: LambdaFunction ) {
143- const items : DataQuickPickItem < 'edit' | ' zip' | 'directory' > [ ] = [
134+ function createUploadTypePrompter ( ) {
135+ const items : DataQuickPickItem < 'zip' | 'directory' > [ ] = [
144136 {
145137 label : addCodiconToString ( 'file-zip' , localize ( 'AWS.generic.filetype.zipfile' , 'ZIP Archive' ) ) ,
146138 data : 'zip' ,
@@ -151,17 +143,6 @@ function createUploadTypePrompter(lambda?: LambdaFunction) {
151143 } ,
152144 ]
153145
154- if ( lambda !== undefined ) {
155- const { region, name : functionName } = lambda
156- const lambdaEdit = getLambdaEditFromNameRegion ( functionName , region )
157- if ( lambdaEdit ) {
158- items . unshift ( {
159- label : addCodiconToString ( 'edit' , localize ( 'AWS.generic.filetype.edit' , 'Local edit' ) ) ,
160- data : 'edit' ,
161- } )
162- }
163- }
164-
165146 return createQuickPick ( items , {
166147 title : localize ( 'AWS.lambda.upload.title' , 'Select Upload Type' ) ,
167148 buttons : createCommonButtons ( ) ,
@@ -215,7 +196,7 @@ function createConfirmDeploymentPrompter(lambda: LambdaFunction) {
215196}
216197
217198export interface UploadLambdaWizardState {
218- readonly uploadType : 'edit' | ' zip' | 'directory'
199+ readonly uploadType : 'zip' | 'directory'
219200 readonly targetUri : vscode . Uri
220201 readonly directoryBuildType : 'zip' | 'sam'
221202 readonly confirmedDeploy : boolean
@@ -234,23 +215,23 @@ export class UploadLambdaWizard extends Wizard<UploadLambdaWizardState> {
234215 this . form . targetUri . setDefault ( this . invokePath )
235216 }
236217 } else {
237- this . form . uploadType . bindPrompter ( ( ) => createUploadTypePrompter ( this . lambda ) )
238- this . form . targetUri . bindPrompter (
239- ( { uploadType } ) => {
240- if ( uploadType === 'directory' ) {
241- return createSingleFileDialog ( {
242- canSelectFolders : false ,
243- canSelectFiles : true ,
244- filters : {
245- 'ZIP archive' : [ 'zip' ] ,
246- } ,
247- } )
248- } else {
249- return new SkipPrompter ( )
250- }
251- } ,
252- { showWhen : ( { uploadType } ) => uploadType !== 'edit' }
253- )
218+ this . form . uploadType . bindPrompter ( ( ) => createUploadTypePrompter ( ) )
219+ this . form . targetUri . bindPrompter ( ( { uploadType } ) => {
220+ if ( uploadType === 'directory' ) {
221+ return createSingleFileDialog ( {
222+ canSelectFolders : true ,
223+ canSelectFiles : false ,
224+ } )
225+ } else {
226+ return createSingleFileDialog ( {
227+ canSelectFolders : false ,
228+ canSelectFiles : true ,
229+ filters : {
230+ 'ZIP archive' : [ 'zip' ] ,
231+ } ,
232+ } )
233+ }
234+ } )
254235 }
255236
256237 this . form . lambda . name . bindPrompter ( ( state ) => {
@@ -277,12 +258,7 @@ export class UploadLambdaWizard extends Wizard<UploadLambdaWizardState> {
277258 this . form . directoryBuildType . setDefault ( 'zip' )
278259 }
279260
280- this . form . confirmedDeploy . bindPrompter (
281- ( state ) => {
282- return createConfirmDeploymentPrompter ( state . lambda ! )
283- } ,
284- { showWhen : ( { uploadType } ) => uploadType !== 'edit' }
285- )
261+ this . form . confirmedDeploy . bindPrompter ( ( state ) => createConfirmDeploymentPrompter ( state . lambda ! ) )
286262
287263 return this
288264 }
0 commit comments