|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | import { type Revision } from "@azure/arm-appcontainers"; |
7 | | -import { AzureWizard, createSubscriptionContext, type IActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils"; |
| 7 | +import { type ResourceGroup } from "@azure/arm-resources"; |
| 8 | +import { LocationListStep, ResourceGroupListStep } from "@microsoft/vscode-azext-azureutils"; |
| 9 | +import { activityInfoIcon, activitySuccessContext, AzureWizard, createSubscriptionContext, createUniversallyUniqueContextValue, GenericTreeItem, nonNullValue, type IActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils"; |
| 10 | +import { ext } from "../../../extensionVariables"; |
8 | 11 | import { type ContainerAppModel } from "../../../tree/ContainerAppItem"; |
9 | 12 | import { type ImageItem } from "../../../tree/containers/ImageItem"; |
10 | 13 | import { createActivityContext } from "../../../utils/activityUtils"; |
| 14 | +import { isAzdExtensionInstalled } from "../../../utils/azdUtils"; |
11 | 15 | import { getManagedEnvironmentFromContainerApp } from "../../../utils/getResourceUtils"; |
12 | 16 | import { getVerifyProvidersStep } from "../../../utils/getVerifyProvidersStep"; |
13 | 17 | import { localize } from "../../../utils/localize"; |
@@ -45,6 +49,38 @@ export async function editContainerImage(context: IActionContext, node?: ImageIt |
45 | 49 | }; |
46 | 50 | wizardContext.telemetry.properties.revisionMode = containerApp.revisionsMode; |
47 | 51 |
|
| 52 | + if (isAzdExtensionInstalled()) { |
| 53 | + wizardContext.telemetry.properties.isAzdExtensionInstalled = 'true'; |
| 54 | + } |
| 55 | + |
| 56 | + const resourceGroups: ResourceGroup[] = await ResourceGroupListStep.getResourceGroups(wizardContext); |
| 57 | + wizardContext.resourceGroup = nonNullValue( |
| 58 | + resourceGroups.find(rg => rg.name === item.containerApp.resourceGroup), |
| 59 | + localize('containerAppResourceGroup', 'Expected to find the container app\'s resource group.'), |
| 60 | + ); |
| 61 | + |
| 62 | + // Log resource group |
| 63 | + wizardContext.activityChildren?.push( |
| 64 | + new GenericTreeItem(undefined, { |
| 65 | + contextValue: createUniversallyUniqueContextValue(['useExistingResourceGroupInfoItem', activitySuccessContext]), |
| 66 | + label: localize('useResourceGroup', 'Using resource group "{0}"', wizardContext.resourceGroup.name), |
| 67 | + iconPath: activityInfoIcon |
| 68 | + }) |
| 69 | + ); |
| 70 | + ext.outputChannel.appendLog(localize('usingResourceGroup', 'Using resource group "{0}".', wizardContext.resourceGroup.name)); |
| 71 | + |
| 72 | + // Log container app |
| 73 | + wizardContext.activityChildren?.push( |
| 74 | + new GenericTreeItem(undefined, { |
| 75 | + contextValue: createUniversallyUniqueContextValue(['useExistingContainerAppInfoItem', activitySuccessContext]), |
| 76 | + label: localize('useContainerApp', 'Using container app "{0}"', wizardContext.containerApp?.name), |
| 77 | + iconPath: activityInfoIcon |
| 78 | + }) |
| 79 | + ); |
| 80 | + ext.outputChannel.appendLog(localize('usingContainerApp', 'Using container app "{0}".', wizardContext.containerApp?.name)); |
| 81 | + |
| 82 | + await LocationListStep.setLocation(wizardContext, item.containerApp.location); |
| 83 | + |
48 | 84 | const wizard: AzureWizard<ContainerEditUpdateContext> = new AzureWizard(wizardContext, { |
49 | 85 | title: localize('editContainerImage', 'Edit container image for "{0}" (draft)', parentResource.name), |
50 | 86 | promptSteps: [ |
|
0 commit comments