Skip to content

Commit e0d9e70

Browse files
committed
Feedback
1 parent 283c86a commit e0d9e70

File tree

3 files changed

+32
-37
lines changed

3 files changed

+32
-37
lines changed

src/commands/api/deployWorkspaceProjectApi.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { type ResourceGroup } from "@azure/arm-resources";
77
import { ResourceGroupListStep, parseAzureResourceGroupId } from "@microsoft/vscode-azext-azureutils";
8-
import { createSubscriptionContext, subscriptionExperience, type IActionContext, type ISubscriptionActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils";
8+
import { callWithTelemetryAndErrorHandling, createSubscriptionContext, subscriptionExperience, type IActionContext, type ISubscriptionActionContext, type ISubscriptionContext } from "@microsoft/vscode-azext-utils";
99
import { type AzureSubscription } from "@microsoft/vscode-azureresources-api";
1010
import { Uri, type WorkspaceFolder } from "vscode";
1111
import { ext } from "../../extensionVariables";
@@ -14,40 +14,40 @@ import { deployWorkspaceProjectInternal, type DeployWorkspaceProjectInternalCont
1414
import { getDeployWorkspaceProjectResults, type DeployWorkspaceProjectResults } from "../deployWorkspaceProject/getDeployWorkspaceProjectResults";
1515
import type * as api from "./vscode-azurecontainerapps.api";
1616

17-
export async function deployWorkspaceProjectApi(context: IActionContext, deployWorkspaceProjectOptions: api.DeployWorkspaceProjectOptionsContract): Promise<DeployWorkspaceProjectResults> {
18-
const { resourceGroupId, rootPath, dockerfilePath, srcPath, suppressConfirmation, suppressContainerAppCreation, ignoreExistingDeploySettings, shouldSaveDeploySettings } = deployWorkspaceProjectOptions;
17+
export async function deployWorkspaceProjectApi(deployWorkspaceProjectOptions: api.DeployWorkspaceProjectOptionsContract): Promise<DeployWorkspaceProjectResults> {
18+
return await callWithTelemetryAndErrorHandling('containerApps.api.deployWorkspaceProject', async (context: IActionContext): Promise<DeployWorkspaceProjectResults> => {
19+
const { resourceGroupId, rootPath, dockerfilePath, srcPath, suppressConfirmation, suppressContainerAppCreation, ignoreExistingDeploySettings, shouldSaveDeploySettings } = deployWorkspaceProjectOptions;
1920

20-
const subscription: AzureSubscription = await subscriptionExperience(context, ext.rgApiV2.resources.azureResourceTreeDataProvider, {
21-
selectBySubscriptionId: getSubscriptionIdFromOptions(deployWorkspaceProjectOptions),
22-
showLoadingPrompt: false
23-
});
24-
const subscriptionContext: ISubscriptionContext = createSubscriptionContext(subscription);
21+
const subscription: AzureSubscription = await subscriptionExperience(context, ext.rgApiV2.resources.azureResourceTreeDataProvider, {
22+
selectBySubscriptionId: getSubscriptionIdFromOptions(deployWorkspaceProjectOptions),
23+
showLoadingPrompt: false
24+
});
25+
const subscriptionContext: ISubscriptionContext = createSubscriptionContext(subscription);
2526

26-
const rootFolder: WorkspaceFolder | undefined = rootPath ? getWorkspaceFolderFromPath(rootPath) : undefined;
27-
const resourceGroup: ResourceGroup | undefined = resourceGroupId ? await getResourceGroupFromId({ ...context, ...subscriptionContext }, resourceGroupId) : undefined;
27+
const rootFolder: WorkspaceFolder | undefined = rootPath ? getWorkspaceFolderFromPath(rootPath) : undefined;
28+
const resourceGroup: ResourceGroup | undefined = resourceGroupId ? await getResourceGroupFromId({ ...context, ...subscriptionContext }, resourceGroupId) : undefined;
2829

29-
const deployWorkspaceProjectInternalContext: DeployWorkspaceProjectInternalContext = Object.assign(context, {
30-
...subscriptionContext,
31-
subscription,
32-
resourceGroup,
33-
rootFolder,
34-
srcPath: srcPath ? Uri.file(srcPath).fsPath : undefined,
35-
dockerfilePath: dockerfilePath ? Uri.file(dockerfilePath).fsPath : undefined,
36-
ignoreExistingDeploySettings,
37-
shouldSaveDeploySettings: !!shouldSaveDeploySettings,
38-
});
30+
const deployWorkspaceProjectInternalContext: DeployWorkspaceProjectInternalContext = Object.assign(context, {
31+
...subscriptionContext,
32+
subscription,
33+
resourceGroup,
34+
rootFolder,
35+
srcPath: srcPath ? Uri.file(srcPath).fsPath : undefined,
36+
dockerfilePath: dockerfilePath ? Uri.file(dockerfilePath).fsPath : undefined,
37+
ignoreExistingDeploySettings,
38+
shouldSaveDeploySettings: !!shouldSaveDeploySettings,
39+
});
3940

40-
const deployWorkspaceProjectResultContext = await deployWorkspaceProjectInternal(deployWorkspaceProjectInternalContext, undefined, {
41-
// Don't show activity log updates in ACA when another client extension calls into this API.
42-
// Let each client decide how it wants to show its own activity log updates.
43-
suppressActivity: true,
44-
suppressConfirmation,
45-
suppressContainerAppCreation,
46-
suppressProgress: true,
47-
suppressWizardTitle: true,
48-
});
41+
const deployWorkspaceProjectResultContext = await deployWorkspaceProjectInternal(deployWorkspaceProjectInternalContext, undefined, {
42+
suppressActivity: true,
43+
suppressConfirmation,
44+
suppressContainerAppCreation,
45+
suppressProgress: true,
46+
suppressWizardTitle: true,
47+
});
4948

50-
return await getDeployWorkspaceProjectResults(deployWorkspaceProjectResultContext);
49+
return await getDeployWorkspaceProjectResults(deployWorkspaceProjectResultContext);
50+
}) ?? {};
5151
}
5252

5353
function getSubscriptionIdFromOptions(deployWorkspaceProjectOptions: api.DeployWorkspaceProjectOptionsContract): string | undefined {

src/commands/api/getAzureContainerAppsApiProvider.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
* Licensed under the MIT License. See License.md in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { callWithTelemetryAndErrorHandling, createApiProvider, type IActionContext, type apiUtils } from "@microsoft/vscode-azext-utils";
6+
import { createApiProvider, type apiUtils } from "@microsoft/vscode-azext-utils";
77
import { deployWorkspaceProjectApi } from "./deployWorkspaceProjectApi";
88
import type * as api from "./vscode-azurecontainerapps.api";
99

1010
export function getAzureContainerAppsApiProvider(): apiUtils.AzureExtensionApiProvider {
1111
return createApiProvider([<api.AzureContainerAppsExtensionApi>{
1212
apiVersion: '0.0.1',
13-
14-
deployWorkspaceProject: async (options: api.DeployWorkspaceProjectOptionsContract) => await callWithTelemetryAndErrorHandling('containerApps.api.deployWorkspaceProject', async (context: IActionContext) => {
15-
return await deployWorkspaceProjectApi(context, options);
16-
})
13+
deployWorkspaceProject: deployWorkspaceProjectApi
1714
}]);
1815
}

src/commands/registerCommands.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { registerCommand, registerCommandWithTreeNodeUnwrapping, registerErrorHandler, registerReportIssueCommand } from '@microsoft/vscode-azext-utils';
7-
import { deployWorkspaceProjectApi } from './api/deployWorkspaceProjectApi';
87
import { browseContainerAppNode } from './browseContainerApp';
98
import { createContainerApp } from './createContainerApp/createContainerApp';
109
import { createManagedEnvironment } from './createManagedEnvironment/createManagedEnvironment';
@@ -60,7 +59,6 @@ export function registerCommands(): void {
6059
registerCommandWithTreeNodeUnwrapping('containerApps.deployRevisionDraft', deployRevisionDraft);
6160
registerCommandWithTreeNodeUnwrapping('containerApps.deployWorkspaceProject', deployWorkspaceProject);
6261
registerCommandWithTreeNodeUnwrapping('containerApps.deployWorkspaceProjectToContainerApp', deployWorkspaceProject);
63-
registerCommand('containerApps.deployWorkspaceProjectApi', deployWorkspaceProjectApi);
6462

6563
// github
6664
registerCommandWithTreeNodeUnwrapping('containerApps.connectToGitHub', connectToGitHub);

0 commit comments

Comments
 (0)