import { MessageItem } from 'vscode' ; import { AzureWizardPromptStep , ISubscriptionActionContext , IWizardOptions , StorageAccountKind , StorageAccountListStep , StorageAccountPerformance , StorageAccountReplication } from 'vscode-azureextensionui' ; import { ext } from '../../extensionVariables' ; import { localize } from '../../localize' ; import { IAzureWebJobsStorageWizardContext } from './IAzureWebJobsStorageWizardContext' ; export class AzureWebJobsStoragePromptStep < T extends IAzureWebJobsStorageWizardContext > extends AzureWizardPromptStep < T > { private readonly _suppressSkipForNow ? : boolean ; public constructor ( suppressSkipForNow ? ) { super ( ) ; this . _suppressSkipForNow = suppressSkipForNow ; } public async prompt ( context ) { const selectAccount = { title : localize ( 'selectAzureAccount' , 'Select storage account' ) } ; const useEmulator = { title : localize ( 'userEmulator' , 'Use local emulator' ) } ; const skipForNow = { title : localize ( 'skipForNow' , 'Skip for now' ) } ; const message = localize ( 'selectAzureWebJobsStorage' , 'In order to debug, you must select a storage account for internal use by the Azure Functions runtime.' ) ; const buttons = [ selectAccount ] ; if ( process . platform === 'win32' ) { buttons . push ( useEmulator ) ; } if ( ! this . _suppressSkipForNow ) { buttons . push ( skipForNow ) ; } const result = await context . ui . showWarningMessage ( message , { modal : true } , ... buttons ) ; if ( result === selectAccount ) { context . azureWebJobsStorageType = 'azure' ; } else if ( result === useEmulator ) { context . azureWebJobsStorageType = 'emulator' ; } context . telemetry . properties . azureWebJobsStorageType = context . azureWebJobsStorageType || 'skipForNow' ; } public shouldPrompt ( context ) { return ! context . azureWebJobsStorageType ; } public async getSubWizard ( context ) { if ( context . azureWebJobsStorageType === 'azure' ) { const promptSteps = [ ] ; const subscriptionPromptStep = await ext . azureAccountTreeItem . getSubscriptionPromptStep ( context ) ; if ( subscriptionPromptStep ) { promptSteps . push ( subscriptionPromptStep ) ; } promptSteps . push ( new StorageAccountListStep ( { kind : StorageAccountKind . Storage , performance : StorageAccountPerformance . Standard , replication : StorageAccountReplication . LRS } , { kind : [ StorageAccountKind . BlobStorage ] , performance : [ StorageAccountPerformance . Premium ] , replication : [ StorageAccountReplication . ZRS ] , learnMoreLink : 'https://aka.ms/Cfqnrc' } ) ) ; return { promptSteps } ; } else { return undefined ; } } }