44 *--------------------------------------------------------------------------------------------*/
55
66import { type AzExtClientContext , createAzureClient , type ILocationWizardContext , type IResourceGroupWizardContext , LocationListStep , parseClientContext , ResourceGroupCreateStep , ResourceGroupListStep , VerifyProvidersStep } from "@microsoft/vscode-azext-azureutils" ;
7- import { AzureWizard , AzureWizardExecuteStep , AzureWizardPromptStep , createSubscriptionContext , type ExecuteActivityContext , type IActionContext , type ISubscriptionActionContext , subscriptionExperience } from "@microsoft/vscode-azext-utils" ;
7+ import { AzureWizard , AzureWizardExecuteStep , AzureWizardPromptStep , createSubscriptionContext , type ExecuteActivityContext , type IAzureQuickPickItem , type IActionContext , type ISubscriptionActionContext , subscriptionExperience } from "@microsoft/vscode-azext-utils" ;
88import { type AzureSubscription } from "@microsoft/vscode-azureresources-api" ;
99import { DurableTaskProvider , DurableTaskSchedulersResourceType } from "../../constants" ;
10+ import { defaultDescription } from "../../constants-nls" ;
1011import { ext } from '../../extensionVariables' ;
1112import { localize } from '../../localize' ;
12- import { type DurableTaskSchedulerClient } from "../../tree/durableTaskScheduler/DurableTaskSchedulerClient" ;
13+ import { DurableTaskSchedulerSku , type DurableTaskSchedulerClient } from "../../tree/durableTaskScheduler/DurableTaskSchedulerClient" ;
1314import { type DurableTaskSchedulerDataBranchProvider } from "../../tree/durableTaskScheduler/DurableTaskSchedulerDataBranchProvider" ;
1415import { createActivityContext } from "../../utils/activityUtils" ;
1516import { withCancellation } from "../../utils/cancellation" ;
16- import { workspace , type Progress } from "vscode" ;
17+ import { type Progress } from "vscode" ;
1718import { type ResourceManagementClient } from '@azure/arm-resources' ;
1819
1920interface ICreateSchedulerContext extends ISubscriptionActionContext , ILocationWizardContext , IResourceGroupWizardContext , ExecuteActivityContext {
2021 subscription ?: AzureSubscription ;
22+ schedulerSku ?: DurableTaskSchedulerSku ;
2123 schedulerName ?: string ;
2224}
2325
@@ -33,6 +35,22 @@ class SchedulerNamingStep extends AzureWizardPromptStep<ICreateSchedulerContext>
3335 }
3436}
3537
38+ class SchedulerSkuStep extends AzureWizardPromptStep < ICreateSchedulerContext > {
39+ async prompt ( wizardContext : ICreateSchedulerContext ) : Promise < void > {
40+ const picks : IAzureQuickPickItem < DurableTaskSchedulerSku > [ ] = [
41+ { label : localize ( 'dtsSkuConsumption' , 'Consumption' ) , description : defaultDescription , data : DurableTaskSchedulerSku . Consumption } ,
42+ { label : localize ( 'dtsSkuDedicated' , 'Dedicated' ) , data : DurableTaskSchedulerSku . Dedicated } ,
43+ ] ;
44+ wizardContext . schedulerSku = ( await wizardContext . ui . showQuickPick ( picks , {
45+ placeHolder : localize ( 'schedulerSkuPrompt' , 'Select a plan for the scheduler' ) ,
46+ } ) ) . data ;
47+ }
48+
49+ shouldPrompt ( wizardContext : ICreateSchedulerContext ) : boolean {
50+ return ! wizardContext . schedulerSku ;
51+ }
52+ }
53+
3654class SchedulerCreationStep extends AzureWizardExecuteStep < ICreateSchedulerContext > {
3755 priority : number = 1 ;
3856
@@ -47,7 +65,8 @@ class SchedulerCreationStep extends AzureWizardExecuteStep<ICreateSchedulerConte
4765 wizardContext . subscription as AzureSubscription ,
4866 wizardContext . resourceGroup ?. name as string ,
4967 location . name ,
50- wizardContext . schedulerName as string
68+ wizardContext . schedulerName as string ,
69+ wizardContext . schedulerSku
5170 ) ;
5271
5372 const status = await withCancellation ( token => response . status . waitForCompletion ( token ) , 1000 * 60 * 30 ) ;
@@ -72,12 +91,6 @@ export async function createResourcesClient(context: AzExtClientContext): Promis
7291 }
7392}
7493
75- export function isDtsPreviewFeaturesEnabled ( ) : boolean {
76- const configuration = workspace . getConfiguration ( 'azureFunctions' ) ;
77-
78- return configuration . get < boolean > ( 'durableTaskScheduler.enablePreviewFeatures' ) === true ;
79- }
80-
8194export async function isDtsProviderRegistered ( context : AzExtClientContext ) : Promise < boolean > {
8295 const resourcesClient = await createResourcesClient ( context ) ;
8396
@@ -99,10 +112,6 @@ export function createSchedulerCommandFactory(dataBranchProvider: DurableTaskSch
99112 ...await createActivityContext ( )
100113 } ;
101114
102- if ( ! isDtsPreviewFeaturesEnabled ( ) ) {
103- throw new Error ( localize ( 'dtsPreviewFeaturesNotEnabled' , 'Durable Task Scheduler preview features have not been enabled in settings.' ) ) ;
104- }
105-
106115 if ( ! await isDtsProviderRegistered ( wizardContext ) ) {
107116 await actionContext . ui . showWarningMessage (
108117 localize ( 'dtsProviderNotRegistered' , 'The Durable Task Scheduler provider ({0}) is not registered for the subscription ({1}).' , DurableTaskProvider , subscription . subscriptionId ) ,
@@ -115,6 +124,7 @@ export function createSchedulerCommandFactory(dataBranchProvider: DurableTaskSch
115124
116125 const promptSteps : AzureWizardPromptStep < ICreateSchedulerContext > [ ] = [
117126 new SchedulerNamingStep ( ) ,
127+ new SchedulerSkuStep ( ) ,
118128 new ResourceGroupListStep ( )
119129 ] ;
120130
0 commit comments