|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
| 6 | +import { type ResourceManagementClient } from '@azure/arm-resources'; |
6 | 7 | import { 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 IAzureQuickPickItem, type IActionContext, type ISubscriptionActionContext, subscriptionExperience } from "@microsoft/vscode-azext-utils"; |
| 8 | +import { AzureWizard, AzureWizardExecuteStepWithActivityOutput, AzureWizardPromptStep, createSubscriptionContext, type ExecuteActivityContext, type ExecuteActivityOutput, type IActionContext, type IAzureQuickPickItem, type ISubscriptionActionContext, subscriptionExperience } from "@microsoft/vscode-azext-utils"; |
8 | 9 | import { type AzureSubscription } from "@microsoft/vscode-azureresources-api"; |
| 10 | +import { type Progress } from "vscode"; |
9 | 11 | import { DurableTaskProvider, DurableTaskSchedulersResourceType } from "../../constants"; |
10 | 12 | import { defaultDescription } from "../../constants-nls"; |
11 | 13 | import { ext } from '../../extensionVariables'; |
12 | 14 | import { localize } from '../../localize'; |
13 | | -import { DurableTaskSchedulerSku, type DurableTaskSchedulerClient } from "../../tree/durableTaskScheduler/DurableTaskSchedulerClient"; |
| 15 | +import { type DurableTaskSchedulerClient, DurableTaskSchedulerSku } from "../../tree/durableTaskScheduler/DurableTaskSchedulerClient"; |
14 | 16 | import { type DurableTaskSchedulerDataBranchProvider } from "../../tree/durableTaskScheduler/DurableTaskSchedulerDataBranchProvider"; |
15 | 17 | import { createActivityContext } from "../../utils/activityUtils"; |
16 | 18 | import { withCancellation } from "../../utils/cancellation"; |
17 | | -import { type Progress } from "vscode"; |
18 | | -import { type ResourceManagementClient } from '@azure/arm-resources'; |
19 | 19 |
|
20 | 20 | interface ICreateSchedulerContext extends ISubscriptionActionContext, ILocationWizardContext, IResourceGroupWizardContext, ExecuteActivityContext { |
21 | 21 | subscription?: AzureSubscription; |
@@ -51,16 +51,30 @@ class SchedulerSkuStep extends AzureWizardPromptStep<ICreateSchedulerContext> { |
51 | 51 | } |
52 | 52 | } |
53 | 53 |
|
54 | | -class SchedulerCreationStep extends AzureWizardExecuteStep<ICreateSchedulerContext> { |
55 | | - priority: number = 1; |
| 54 | +class SchedulerCreationStep extends AzureWizardExecuteStepWithActivityOutput<ICreateSchedulerContext> { |
| 55 | + priority: number = 110; |
| 56 | + readonly stepName: string = 'schedulerCreationStep'; |
| 57 | + |
| 58 | + protected getTreeItemLabel = (context: ICreateSchedulerContext) => localize('createSchedulerLabel', 'Create Durable Task Scheduler "{0}"', context.schedulerName); |
| 59 | + protected getOutputLogSuccess = (context: ICreateSchedulerContext) => localize('createSchedulerSuccess', 'Successfully created Durable Task Scheduler "{0}".', context.schedulerName); |
| 60 | + protected getOutputLogFail = (context: ICreateSchedulerContext) => localize('createSchedulerFail', 'Failed to create Durable Task Scheduler "{0}".', context.schedulerName); |
| 61 | + |
| 62 | + public createProgressOutput(context: ICreateSchedulerContext): ExecuteActivityOutput { |
| 63 | + const output = super.createProgressOutput(context); |
| 64 | + if (output.item) { |
| 65 | + output.item.description = localize('schedulerProgressDescription', 'This may take a while...'); |
| 66 | + } |
| 67 | + return output; |
| 68 | + } |
56 | 69 |
|
57 | 70 | constructor(private readonly schedulerClient: DurableTaskSchedulerClient) { |
58 | 71 | super(); |
59 | 72 | } |
60 | 73 |
|
61 | | - async execute(wizardContext: ICreateSchedulerContext, _: Progress<{ message?: string; increment?: number; }>): Promise<void> { |
62 | | - const location = await LocationListStep.getLocation(wizardContext); |
| 74 | + async execute(wizardContext: ICreateSchedulerContext, progress: Progress<{ message?: string; increment?: number; }>): Promise<void> { |
| 75 | + progress.report({ message: localize('creatingScheduler', 'Creating Durable Task Scheduler...') }); |
63 | 76 |
|
| 77 | + const location = await LocationListStep.getLocation(wizardContext); |
64 | 78 | const response = await this.schedulerClient.createScheduler( |
65 | 79 | wizardContext.subscription as AzureSubscription, |
66 | 80 | wizardContext.resourceGroup?.name as string, |
@@ -109,7 +123,7 @@ export function createSchedulerCommandFactory(dataBranchProvider: DurableTaskSch |
109 | 123 |
|
110 | 124 | ...actionContext, |
111 | 125 | ...createSubscriptionContext(subscription), |
112 | | - ...await createActivityContext() |
| 126 | + ...await createActivityContext({ withChildren: true }), |
113 | 127 | }; |
114 | 128 |
|
115 | 129 | if (!await isDtsProviderRegistered(wizardContext)) { |
|
0 commit comments