Skip to content

Commit 7ddd75d

Browse files
Add confirmation webview to "Deploy to Container App..." command with copilot support (#897)
* Add Confirmation web view (#886) * initial commit * small changes * requested changes to commonChannel * small changes and revert previous commit * remove line * prod changes * Rename confirmationViewController.ts to ConfirmationViewController.ts * Add confirmation view to 'Deploy to Container App..." command (#887) * initial commit * small changes * add deploy changes * requested changes to commonChannel * cancel bug fix * small changes and revert previous commit * remove line * prod changes * Rename confirmationViewController.ts to ConfirmationViewController.ts * Implement utils changes (#890) * change copilot button location * small changes after merge * pass in view description * Add functionality to copilot button (#896) * initial * small changes * requested changes * small change --------- Co-authored-by: Alex Weininger <alex.weininger@live.com> * try to fix build * try again * again? * remove and fix small bug * make dependency optional * small change * fix package-lock * dumb mistake * requested changes * requested changes * pass in tab title --------- Co-authored-by: Alex Weininger <alex.weininger@live.com>
1 parent 0153b09 commit 7ddd75d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8985
-2267
lines changed

gulpfile.ts

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

66
import { gulp_webpack } from '@microsoft/vscode-azext-dev';
7+
import * as child_process from 'child_process';
78
import * as fse from 'fs-extra';
89
import * as gulp from 'gulp';
910
import * as path from 'path';
@@ -26,6 +27,14 @@ async function cleanReadme(): Promise<void> {
2627
await fse.writeFile(readmePath, data);
2728
}
2829

30+
async function installSwcCore(): Promise<void> {
31+
// Our pipelies run on Linux so we need to install the correct @swc/core package for te pipelines to pass.
32+
if (process.platform === 'linux') {
33+
child_process.execSync('npm install @swc/core-linux-x64-gnu --save-dev')
34+
}
35+
}
36+
2937
exports['webpack-dev'] = gulp.series(prepareForWebpack, () => gulp_webpack('development'));
3038
exports['webpack-prod'] = gulp.series(prepareForWebpack, () => gulp_webpack('production'));
3139
exports.cleanReadme = cleanReadme;
40+
exports.installSwcCore = installSwcCore;

package-lock.json

Lines changed: 5461 additions & 2243 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,27 +805,35 @@
805805
"lint-fix": "eslint --ext .ts . --fix",
806806
"pretest": "npm run webpack-prod",
807807
"test": "node ./dist/test/runTest.js",
808+
"watch:views": "webpack serve --mode development --config ./webpack.config.views.js",
808809
"webpack": "npm run build && gulp webpack-dev",
809-
"webpack-prod": "npm run build && gulp webpack-prod",
810+
"webpack-prod": "npm run build && gulp webpack-prod && npm run webpack-prod-wv ",
811+
"webpack-prod-wv": "webpack --mode production --config ./webpack.config.views.js",
810812
"webpack-profile": "webpack --profile --json --mode production > webpack-stats.json && echo Use http://webpack.github.io/analyse to analyze the stats",
811-
"prepare": "husky install"
813+
"prepare": "husky install",
814+
"preinstall": "gulp installSwcCore"
812815
},
813816
"devDependencies": {
814817
"@azure/ms-rest-azure-env": "^2.0.0",
815818
"@microsoft/eslint-config-azuretools": "^0.2.2",
816819
"@microsoft/vscode-azext-dev": "^2.1.0",
820+
"@swc/core": "^1.7.36",
817821
"@types/deep-eql": "^4.0.0",
818822
"@types/fs-extra": "^8.1.1",
819823
"@types/gulp": "^4.0.6",
820824
"@types/mocha": "^8.2.2",
821825
"@types/node": "^16.18.36",
822826
"@types/semver": "^7.3.8",
823827
"@types/tar": "^6.1.11",
828+
"@types/uuid": "^10.0.0",
824829
"@types/vscode": "^1.95.0",
830+
"@types/vscode-webview": "^1.57.5",
825831
"@typescript-eslint/eslint-plugin": "^5.59.11",
826832
"@vscode/test-electron": "^2.3.8",
827833
"@vscode/vsce": "^2.19.0",
828834
"assert": "^2.0.0",
835+
"copy-webpack-plugin": "^12.0.2",
836+
"css-loader": "^7.1.2",
829837
"eslint": "^8.42.0",
830838
"eslint-plugin-import": "^2.27.5",
831839
"glob": "^7.1.6",
@@ -834,10 +842,13 @@
834842
"mocha": "^10.1.0",
835843
"mocha-junit-reporter": "^2.0.0",
836844
"mocha-multi-reporters": "^1.1.7",
845+
"style-loader": "^4.0.0",
846+
"swc-loader": "^0.2.6",
837847
"ts-node": "^10.9.1",
838848
"typescript": "^5.1.3",
839849
"webpack": "^5.94.0",
840-
"webpack-cli": "^4.6.0"
850+
"webpack-cli": "^5.1.4",
851+
"webpack-dev-server": "^5.1.0"
841852
},
842853
"dependencies": {
843854
"@azure/arm-appcontainers": "^2.1.0-beta.1",
@@ -848,6 +859,8 @@
848859
"@azure/container-registry": "1.0.0-beta.5",
849860
"@azure/core-rest-pipeline": "1.10.3",
850861
"@azure/storage-blob": "^12.4.1",
862+
"@fluentui/react-components": "^9.56.2",
863+
"@fluentui/react-icons": "^2.0.265",
851864
"@microsoft/vscode-azext-azureutils": "^3.3.3",
852865
"@microsoft/vscode-azext-github": "^1.0.2",
853866
"@microsoft/vscode-azext-utils": "^3.2.1",
@@ -857,9 +870,15 @@
857870
"deep-eql": "^4.1.3",
858871
"dotenv": "^16.0.0",
859872
"fs-extra": "^8.1.0",
873+
"monaco-editor": "~0.51.0",
860874
"p-retry": "^4.6.2",
875+
"react": "^18.3.1",
876+
"react-dom": "^18.3.1",
877+
"sass": "~1.79.6",
878+
"sass-loader": "^16.0.2",
861879
"semver": "^7.5.2",
862880
"tar": "^6.2.1",
881+
"uuid": "^10.0.0",
863882
"vscode-nls": "^4.1.1",
864883
"vscode-uri": "^3.0.2"
865884
},

src/commands/deployContainerApp/deployContainerApp.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { getManagedEnvironmentFromContainerApp } from "../../utils/getResourceUt
1313
import { getVerifyProvidersStep } from "../../utils/getVerifyProvidersStep";
1414
import { localize } from "../../utils/localize";
1515
import { pickContainerApp } from "../../utils/pickItem/pickContainerApp";
16+
import { OpenConfirmationViewStep } from "../../webviews/OpenConfirmationViewStep";
1617
import { ContainerAppOverwriteConfirmStep } from "../ContainerAppOverwriteConfirmStep";
1718
import { deployWorkspaceProject } from "../deployWorkspaceProject/deployWorkspaceProject";
1819
import { editContainerCommandName } from "../editContainer/editContainer";
@@ -56,18 +57,23 @@ export async function deployContainerApp(context: IActionContext, node?: Contain
5657
}
5758
wizardContext.telemetry.properties.revisionMode = item.containerApp.revisionsMode;
5859

60+
const confirmationViewTitle: string = localize('summary', 'Summary');
61+
const confirmationViewDescription: string = localize('viewDescription', 'Please select an input you would like to change. Otherwise click "Confirm" to deploy.');
62+
const confirmationViewTabTitle: string = localize('deployContainerAppTabTitle', 'Summary - Deploy Image to Container App');
63+
const title: string = localize('deployContainerAppTitle', 'Deploy image to container app');
64+
5965
const wizard: AzureWizard<ContainerAppDeployContext> = new AzureWizard(wizardContext, {
60-
title: localize('deployContainerAppTitle', 'Deploy image to container app'),
66+
title: title,
6167
promptSteps: [
6268
new ContainerAppDeployStartingResourcesLogStep(),
6369
new ImageSourceListStep(),
6470
new ContainerAppOverwriteConfirmStep(),
71+
new OpenConfirmationViewStep(confirmationViewTitle, confirmationViewTabTitle, confirmationViewDescription, title, () => wizard.confirmationViewProperties)
6572
],
6673
executeSteps: [
6774
getVerifyProvidersStep<ContainerAppDeployContext>(),
6875
new ContainerAppUpdateStep(),
6976
],
70-
showLoadingPrompt: true
7177
});
7278

7379
await wizard.prompt();

src/commands/deployWorkspaceProject/internal/startingConfiguration/getStartingConfiguration.ts

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

66
import { KnownSkuName } from "@azure/arm-containerregistry";
7-
import { AzureWizard } from "@microsoft/vscode-azext-utils";
7+
import { AzureWizard, type AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
88
import { ImageSource } from "../../../../constants";
99
import { EnvFileListStep } from "../../../image/imageSource/EnvFileListStep";
1010
import { DockerfileItemStep } from "../../../image/imageSource/buildImageInAzure/DockerfileItemStep";
@@ -19,7 +19,7 @@ import { getResourcesFromContainerAppHelper, getResourcesFromManagedEnvironmentH
1919
export async function getStartingConfiguration(context: DeployWorkspaceProjectInternalContext, options: DeployWorkspaceProjectInternalOptions): Promise<Partial<DeployWorkspaceProjectInternalContext>> {
2020
await tryAddMissingAzureResourcesToContext(context);
2121

22-
const promptSteps = [
22+
const promptSteps: AzureWizardPromptStep<DeployWorkspaceProjectInternalContext>[] = [
2323
new RootFolderStep(),
2424
new DockerfileItemStep(),
2525
new DwpManagedEnvironmentListStep(),

src/commands/image/imageSource/EnvFileListStep.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { type EnvironmentVar } from "@azure/arm-appcontainers";
7-
import { ActivityChildItem, ActivityChildType, AzExtFsExtra, AzureWizardPromptStep, activityInfoContext, activityInfoIcon, activitySuccessContext, activitySuccessIcon, createContextValue } from "@microsoft/vscode-azext-utils";
7+
import { ActivityChildItem, ActivityChildType, AzExtFsExtra, AzureWizardPromptStep, activityInfoContext, activityInfoIcon, activitySuccessContext, activitySuccessIcon, createContextValue, type ConfirmationViewProperty } from "@microsoft/vscode-azext-utils";
88
import { parse, type DotenvParseOutput } from "dotenv";
99
import { RelativePattern, workspace, type Uri, type WorkspaceFolder } from "vscode";
1010
import { ImageSource, envFileGlobPattern } from "../../../constants";
@@ -73,6 +73,14 @@ export class EnvFileListStep<T extends EnvFileListContext> extends AzureWizardPr
7373
return context.imageSource !== ImageSource.QuickstartImage && context.environmentVariables === undefined;
7474
}
7575

76+
public confirmationViewProperty(context: T): ConfirmationViewProperty {
77+
return {
78+
name: localize('environmentVariables', 'Environment Variables'),
79+
value: context.envPath ?? localize('useExisting', 'Use existing configuration'),
80+
contextPropertyName: 'envPath'
81+
};
82+
}
83+
7684
private async promptForEnvPath(context: T, showHasExistingData?: boolean): Promise<string | undefined> {
7785
const placeHolder: string = localize('setEnvVar', 'Select a {0} file to set the environment variables for the container instance', '.env');
7886
const skipLabel: string | undefined = showHasExistingData ? localize('useExisting', 'Use existing configuration') : undefined;

src/commands/image/imageSource/containerRegistry/ContainerRegistryListStep.ts

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

6-
import { AzureWizardPromptStep, type IAzureQuickPickItem, type IWizardOptions } from "@microsoft/vscode-azext-utils";
6+
import { AzureWizardPromptStep, type ConfirmationViewProperty, type IAzureQuickPickItem, type IWizardOptions } from "@microsoft/vscode-azext-utils";
77
import { UIKind, env } from "vscode";
88
import { acrDomain, dockerHubDomain, type SupportedRegistries } from "../../../../constants";
99
import { localize } from "../../../../utils/localize";
@@ -18,6 +18,7 @@ import { RegistryImageInputStep } from "./RegistryImageInputStep";
1818

1919
export class ContainerRegistryListStep extends AzureWizardPromptStep<ContainerRegistryImageSourceContext> {
2020
public hideStepCount: boolean = true;
21+
public pickLabel: string | undefined;
2122

2223
public async prompt(context: ContainerRegistryImageSourceContext): Promise<void> {
2324
const placeHolder: string = localize('selectTag', 'Select a container registry');
@@ -31,13 +32,23 @@ export class ContainerRegistryListStep extends AzureWizardPromptStep<ContainerRe
3132
// there is a chance that this will fail in vscode.dev due to CORS, but we should still allow the user to enter a custom registry
3233
picks.push({ label: localize('otherPublicRegistry', 'Other public registry'), data: undefined });
3334

34-
context.registryDomain = (await context.ui.showQuickPick(picks, { placeHolder })).data;
35+
const pick: IAzureQuickPickItem<SupportedRegistries | undefined> | undefined = await context.ui.showQuickPick(picks, { placeHolder });
36+
this.pickLabel = pick?.label;
37+
context.registryDomain = pick.data;
3538
}
3639

3740
public shouldPrompt(context: ContainerRegistryImageSourceContext): boolean {
3841
return !context.image && !context.registryDomain;
3942
}
4043

44+
public confirmationViewProperty(_context: ContainerRegistryImageSourceContext): ConfirmationViewProperty {
45+
return {
46+
name: localize('containerRegistryDomain', 'Container Registry Domain'),
47+
value: this.pickLabel ?? '',
48+
contextPropertyName: 'registryDomain'
49+
};
50+
}
51+
4152
public async getSubWizard(context: ContainerRegistryImageSourceContext): Promise<IWizardOptions<ContainerRegistryImageSourceContext> | undefined> {
4253
if (context.image) {
4354
return undefined;

src/commands/image/imageSource/containerRegistry/RegistryImageInputStep.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
6+
import { AzureWizardPromptStep, type ConfirmationViewProperty } from "@microsoft/vscode-azext-utils";
77
import { acrDomain, quickStartImageName } from "../../../../constants";
88
import { parseImageName } from "../../../../utils/imageNameUtils";
99
import { localize } from "../../../../utils/localize";
@@ -38,4 +38,12 @@ export class RegistryImageInputStep extends AzureWizardPromptStep<ContainerRegis
3838
public shouldPrompt(context: ContainerRegistryImageSourceContext): boolean {
3939
return context.image === undefined;
4040
}
41+
42+
public confirmationViewProperty(context: ContainerRegistryImageSourceContext): ConfirmationViewProperty {
43+
return {
44+
name: localize('containerImage', 'Container Image'),
45+
value: context.image ?? '',
46+
contextPropertyName: 'image'
47+
};
48+
}
4149
}

src/commands/image/imageSource/containerRegistry/RegistryRepositoriesListBaseStep.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
6+
import { AzureWizardPromptStep, type ConfirmationViewProperty } from "@microsoft/vscode-azext-utils";
77
import { type QuickPickItem } from "vscode";
88
import { loadMoreQp, noMatchingResourcesQp, type QuickPicksCache } from "../../../../constants";
99
import { localize } from "../../../../utils/localize";
@@ -31,5 +31,13 @@ export abstract class RegistryRepositoriesListStepBase extends AzureWizardPrompt
3131
return !context.repositoryName;
3232
}
3333

34+
public confirmationViewProperty(context: ContainerRegistryImageSourceContext): ConfirmationViewProperty {
35+
return {
36+
name: localize('repository', 'Repository'),
37+
value: context.repositoryName ?? '',
38+
contextPropertyName: 'repositoryName'
39+
}
40+
}
41+
3442
public abstract getPicks(context: ContainerRegistryImageSourceContext, picksCache: QuickPicksCache | undefined): Promise<QuickPickItem[]>
3543
}

src/commands/image/imageSource/containerRegistry/RepositoryTagListStepBase.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
6+
import { AzureWizardPromptStep, type ConfirmationViewProperty } from "@microsoft/vscode-azext-utils";
77
import { type QuickPickItem } from "vscode";
88
import { loadMoreQp, type QuickPicksCache } from "../../../../constants";
99
import { localize } from "../../../../utils/localize";
@@ -26,5 +26,13 @@ export abstract class RepositoryTagListStepBase extends AzureWizardPromptStep<Co
2626
return !context.tag;
2727
}
2828

29+
public confirmationViewProperty(context: ContainerRegistryImageSourceContext): ConfirmationViewProperty {
30+
return {
31+
name: localize('tag', 'Tag'),
32+
value: context.tag ?? '',
33+
contextPropertyName: 'tag'
34+
};
35+
}
36+
2937
public abstract getPicks(context: ContainerRegistryImageSourceContext, picksCache: QuickPicksCache | undefined): Promise<QuickPickItem[]>
3038
}

0 commit comments

Comments
 (0)