-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathBuildFromProjectListStep.ts
More file actions
60 lines (52 loc) · 3.04 KB
/
BuildFromProjectListStep.ts
File metadata and controls
60 lines (52 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureWizardExecuteStep, AzureWizardPromptStep, IAzureQuickPickItem, IWizardOptions } from "@microsoft/vscode-azext-utils";
import { localize } from "../../../utils/localize";
import { IDeployBaseContext } from "../IDeployBaseContext";
import { AcrListStep } from "../deployFromRegistry/acr/AcrListStep";
import { BuildImageStep } from "./BuildImageStep";
import { DockerFileItemStep } from "./DockerFileItemStep";
import { IBuildImageInAzureContext } from "./IBuildImageInAzureContext";
import { ImageNameStep } from "./ImageNameStep";
import { OSPickStep } from "./OSPickStep";
import { RootFolderStep } from "./RootFolderStep";
import { RunStep } from "./RunStep";
import { TarFileStep } from "./TarFileStep";
import { UploadSourceCodeStep } from "./UploadSourceCodeStep";
const buildImageInAzure = 'buildImageInAzure';
const buildFromProjectLabels: string[] = [
localize('azure', 'Build from project remotely using Azure Container Registry')
//localize('docker', 'Build from project locally using Docker')
];
export class BuildFromProjectListStep extends AzureWizardPromptStep<IDeployBaseContext> {
public async prompt(context: IDeployBaseContext): Promise<void> {
const placeHolder: string = localize('buildType', 'Select how you want to build your project');
const picks: IAzureQuickPickItem<string | undefined>[] = [
{ label: buildFromProjectLabels[0], data: buildImageInAzure, suppressPersistence: true },
//{ label: buildFromProjectLabels[1], data: buildFromProjectLabels[1], suppressPersistence: true }
];
context.buildType = (await context.ui.showQuickPick(picks, { placeHolder })).data;
}
public async configureBeforePrompt(context: IDeployBaseContext): Promise<void> {
if (buildFromProjectLabels.length === 1) {
context.buildType = buildImageInAzure;
}
}
public shouldPrompt(context: IDeployBaseContext): boolean {
return !context.buildType;
}
public async getSubWizard(context: IBuildImageInAzureContext): Promise<IWizardOptions<IDeployBaseContext> | undefined> {
const promptSteps: AzureWizardPromptStep<IDeployBaseContext>[] = [];
const executeSteps: AzureWizardExecuteStep<IDeployBaseContext>[] = [];
switch (context.buildType) {
case buildImageInAzure:
promptSteps.push(new AcrListStep(), new RootFolderStep(), new DockerFileItemStep(), new ImageNameStep(), new OSPickStep());
executeSteps.push(new TarFileStep(), new UploadSourceCodeStep(), new RunStep(), new BuildImageStep());
break;
//TODO: case for 'Build from project locally using Docker'
}
return { promptSteps, executeSteps };
}
}