-
Notifications
You must be signed in to change notification settings - Fork 17
Add support for choosing a source directory when deploying from a workspace project #586
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
Merged
Merged
Changes from 51 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
3f97bf8
Wip
MicroFish91 63327a8
Wip
MicroFish91 c141c41
Wip
MicroFish91 4d4d245
Update verbiage
MicroFish91 9a2ac95
Remove activity context for api
MicroFish91 dcfb0e0
Clean up misc
MicroFish91 0535237
Revert
MicroFish91 9bca1f4
Hide api command from palette
MicroFish91 d5f09fc
Api context
MicroFish91 cc614bf
Misc
MicroFish91 6238290
Skip checking workspace settings from api entry point
MicroFish91 3617d8e
Change to fsPath
MicroFish91 a4941db
invokedFromApi
MicroFish91 5aaa76e
Add api.d.ts
MicroFish91 63bc92a
Remove api loading prompt
MicroFish91 dd588b9
Add subscription ID support
MicroFish91 8b57bae
Update option name
MicroFish91 4c98107
Update deployWorkspaceProjectResults
MicroFish91 976aadb
Misc
MicroFish91 6cb885a
Updates with shared tools changes
MicroFish91 c8d93c3
Merge branch 'main' of https://github.com/microsoft/vscode-azureconta…
MicroFish91 5b04b68
Reset package deps
MicroFish91 dffdff2
Upgrade deps
MicroFish91 99c8007
Update comment
MicroFish91 9928198
Update comments
MicroFish91 fb52b44
Update comment
MicroFish91 b3ba7b6
Microsoft header
MicroFish91 f45ff07
suppressConfirmation
MicroFish91 645863c
No skip create message
MicroFish91 ca46995
Merge with main
MicroFish91 72f5bdc
Simplify output messages
MicroFish91 1b4c909
Misc
MicroFish91 64d237a
Add ignoreExistingDeploySettings
MicroFish91 1da6c7a
Decouple API from deployWorkspaceProject
MicroFish91 b889b70
Add promptForEnvironmentResources comments
MicroFish91 4d2afd2
Expose a proper API interface using api provider
MicroFish91 6436c7b
Update changelog
MicroFish91 1fd1c21
Remove comment
MicroFish91 bdcdb92
Change type
MicroFish91 27e2fa2
Add dwp internal
MicroFish91 fa02fd4
Revert
MicroFish91 3521e6f
Merge with internal branch
MicroFish91 19bee17
centralize getDeployWorkspaceProjectResults
MicroFish91 17dd935
Remove unused values
MicroFish91 cdd88f6
Remove unused values
MicroFish91 e22058d
Merge branch 'mwf/dwp-internal' of https://github.com/microsoft/vscod…
MicroFish91 ce947c3
Merge branch 'main' of https://github.com/microsoft/vscode-azureconta…
MicroFish91 8518640
Merge branch 'mwf/dwp-internal' of https://github.com/microsoft/vscod…
MicroFish91 7f70697
Impl
MicroFish91 af67aa9
Merge with main
MicroFish91 c3b466d
Fix merge carryover
MicroFish91 551513f
Improve source path step
MicroFish91 251a8e4
Single quote
MicroFish91 827b864
Feedback
MicroFish91 dcc8fbe
Add correct path sep
MicroFish91 aee6b17
better var name
MicroFish91 bed00a7
Remove promise
MicroFish91 7499452
Add dockerfile relative path
MicroFish91 9692af0
Feedback
MicroFish91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/commands/image/imageSource/buildImageInAzure/SourcePathStep.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.md in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils'; | ||
| import * as path from 'path'; | ||
| import { browseItem } from '../../../../constants'; | ||
| import { localize } from '../../../../utils/localize'; | ||
| import { type BuildImageInAzureImageSourceContext } from './BuildImageInAzureImageSourceContext'; | ||
|
|
||
| export class SourcePathStep extends AzureWizardPromptStep<BuildImageInAzureImageSourceContext> { | ||
| public async prompt(context: BuildImageInAzureImageSourceContext): Promise<void> { | ||
| await context.ui.showQuickPick([browseItem], { | ||
| placeHolder: localize('sourceDirectoryPick', 'Choose your source code directory') | ||
| }); | ||
|
|
||
| context.srcPath = (await context.ui.showOpenDialog({ | ||
| defaultUri: context.rootFolder?.uri, | ||
| canSelectFiles: false, | ||
| canSelectFolders: true | ||
| }))[0].fsPath; | ||
|
|
||
| context.telemetry.properties.sourceDepth = String(this.getRelativePathDepthFromRoot(context.srcPath)); | ||
| } | ||
|
|
||
| public async configureBeforePrompt(context: BuildImageInAzureImageSourceContext): Promise<void> { | ||
| if (context.srcPath) { | ||
| context.telemetry.properties.sourceDepth = String(this.getRelativePathDepthFromRoot(context.srcPath)); | ||
| } | ||
| } | ||
|
|
||
| public shouldPrompt(context: BuildImageInAzureImageSourceContext): boolean { | ||
| return !context.srcPath && !this.hasRootDockerfile(context); | ||
| } | ||
|
|
||
| // If a provided dockerfile is not at the project root, we need to acquire the project's source context | ||
| private hasRootDockerfile(context: BuildImageInAzureImageSourceContext): boolean { | ||
| if (!context.rootFolder || !context.dockerfilePath) { | ||
| return false; | ||
| } | ||
|
|
||
| const rootPath: string = context.rootFolder.uri.fsPath; | ||
| return path.relative(rootPath, context.dockerfilePath) === path.basename(context.dockerfilePath); | ||
| } | ||
|
|
||
| private getRelativePathDepthFromRoot(relativePath: string): number { | ||
| return relativePath === '.' ? 0 : relativePath.split(path.sep).length; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
I'd prefer we show a workspace quickpick with the folders (including
.) in the workspace first, and then allow the user to browse to the folder if they don't have it opened.The reason being that it's always jarring to have the open folder dialog come up in the middle of a wizard and it's kind of hard to give context to the user as to what they need to open since there's no placeholder or anything.
I see that's the point of having the first quickpick that only contains browse, but I think that's still a less than ideal experience.
EDIT: Or actually maybe we default them to the folder where their dockerfile is located, and then let them browse if they'd want to change it.
Uh oh!
There was an error while loading. Please reload this page.
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.
That's fair, my only question is, if we end up suggesting the wrong location using the Dockerfile as reference, do you think most people will think it intuitive enough to hit browse to pick the correct location? Or do you think people would just automatically pick what we suggested without double checking?
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.
Oh I see you also mentioned showing "." first, let's maybe talking offline so I can fully understand which places could make sense to show
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.
I think users would understand it.
I think it's similar to Static Web Apps, but basically, it shows your root folder and every sub-directory as a quickpick with browse at the bottom.
I don't think it would be anymore confusing that just asking where the source folder is, at least. It's also an additional click which may be annoying (especially if the src folder is one that we could list for users from the get-go).