-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create from Deploy feature and some local UX changes #4130
Changes from 17 commits
138f6c7
a03c9ed
77a1d7a
30370b0
e41ed65
0cd040f
402bcc1
f7507c7
6362c06
2daa8f2
cbac861
ac66289
ec6a50d
9c29a96
01d9864
77d3490
13782f8
e324d96
a357727
1c260b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,8 @@ export async function getCommands(): Promise<(WizardCommandConfig | SimpleComman | |
{ | ||
type: "simple", | ||
name: createFunctionProjectCommandName, | ||
commandId: "azureFunctions.createNewProject", | ||
displayName: "Create Function Project", | ||
commandId: "azureFunctions.createFunction", | ||
displayName: "Create Function Locally", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you remember if there was a reason we couldn't do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if there was a reason or not, but personally if I see (Local), it makes me think that there is another version of Create Function. Probably Create Function (Remote) or something like that. |
||
intentDescription: "This is best when users ask to create a new function project in VS Code. They may also refer to creating a function project by asking to create a project based upon a function project template.", | ||
requiresAzureLogin: true, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { AzureWizardPromptStep, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; | ||
import { type AzureSubscription } from "@microsoft/vscode-azureresources-api"; | ||
import { l10n } from "vscode"; | ||
import { ext } from "../extensionVariables"; | ||
import { type IFuncDeployContext } from "./deploy/deploy"; | ||
|
||
export class SubscriptionListStep extends AzureWizardPromptStep<IFuncDeployContext> { | ||
private _picks: IAzureQuickPickItem<AzureSubscription>[] = []; | ||
private _oneSubscription: boolean = false; | ||
public async prompt(context: IFuncDeployContext): Promise<void> { | ||
context.subscription = (await context.ui.showQuickPick(this._picks, { placeHolder: l10n.t("Select a subscription") })).data; | ||
} | ||
|
||
public shouldPrompt(_: IFuncDeployContext): boolean { | ||
return !this._oneSubscription; | ||
} | ||
|
||
public async configureBeforePrompt(context: IFuncDeployContext): Promise<void> { | ||
this._picks = await this.getPicks(context); | ||
// auto select if only one subscription | ||
if (this._picks.length === 1) { | ||
this._oneSubscription = true; | ||
context.subscription = this._picks[0].data; | ||
} | ||
} | ||
|
||
private async getPicks(_: IFuncDeployContext): Promise<IAzureQuickPickItem<AzureSubscription>[]> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason we didn't just remove the parameter if it's not being used? |
||
return (await ext.rgApi.getSubscriptions(true)).map(s => { | ||
return { label: s.name, description: s.subscriptionId, data: s }; | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { type IAppServiceWizardContext } from "@microsoft/vscode-azext-azureappservice"; | ||
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils"; | ||
import { localize } from "../../localize"; | ||
import { setConsumptionPlanProperties } from "./FunctionAppHostingPlanStep"; | ||
import { type IFunctionAppWizardContext } from "./IFunctionAppWizardContext"; | ||
|
||
export class ConfigureCommonNamesStep extends AzureWizardPromptStep<IAppServiceWizardContext> { | ||
public async prompt(_context: IAppServiceWizardContext): Promise<void> { | ||
// do nothing, will be handled in configuration | ||
} | ||
|
||
public shouldPrompt(_context: IAppServiceWizardContext): boolean { | ||
// never prompt | ||
return false; | ||
} | ||
|
||
public async configureBeforePrompt(context: IFunctionAppWizardContext): Promise<void> { | ||
if (!context.advancedCreation) { | ||
const newName: string | undefined = await context.relatedNameTask; | ||
if (!newName) { | ||
throw new Error(localize('noUniqueName', 'Failed to generate unique name for resources. Use advanced creation to manually enter resource names.')); | ||
} | ||
context.newResourceGroupName = context.newResourceGroupName || newName; | ||
setConsumptionPlanProperties(context); | ||
context.newStorageAccountName = newName; | ||
context.newAppInsightsName = newName; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it supposed to be "Deploy to Azure..." or "Deploy function to Azure..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think we originally went with "Deploy function to Azure..." but after more discussion, just went with a more generic "Deploy to Azure..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't think we need to give more context to users on what they are deploying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I mean you're in the workspace part of the extension so I think it's kind of clear. That being said, I think it still prompts you for a workspace folder.
I'm thinking of adding a right-click context item on the local project node though that also has "Deploy to Azure..." on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I was thinking that they might need to know that the command is for deploying Functions to Azure and not App Service or anything else. But maybe they should already know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you click the Functions symbol to open the menu for the commands. I thought that was kind of the reason we had those buttons there to give them that context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that's fine