-
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 58 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
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
60 changes: 60 additions & 0 deletions
60
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,60 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * 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 * 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> { | ||
| const srcPath: string | undefined = (await context.ui.showQuickPick(this.getPicks(context), { | ||
| placeHolder: localize('sourceDirectoryPick', 'Choose your source code directory'), | ||
| suppressPersistence: true | ||
| })).data; | ||
|
|
||
| context.srcPath = srcPath ?? (await context.ui.showOpenDialog({ | ||
| defaultUri: context.rootFolder?.uri, | ||
| canSelectFiles: false, | ||
| canSelectFolders: true | ||
| }))[0].fsPath; | ||
| } | ||
|
|
||
| public async configureBeforePrompt(context: BuildImageInAzureImageSourceContext): Promise<void> { | ||
| if (this.hasRootDockerfile(context)) { | ||
| context.srcPath = context.rootFolder.uri.fsPath; | ||
| } | ||
| } | ||
|
|
||
| public shouldPrompt(context: BuildImageInAzureImageSourceContext): boolean { | ||
| return !context.srcPath; | ||
| } | ||
|
|
||
| private getPicks(context: BuildImageInAzureImageSourceContext): IAzureQuickPickItem<string | undefined>[] { | ||
| const rootPath: string = context.rootFolder.uri.fsPath; | ||
| const directories: string[] = path.relative(rootPath, path.dirname(context.dockerfilePath)).split(path.sep); | ||
| const picks: IAzureQuickPickItem<string | undefined>[] = [{ label: '.' + path.sep, description: 'root', data: rootPath }]; | ||
|
|
||
| let p: string = ''; | ||
| for (const directory of directories) { | ||
| p += path.sep + directory; | ||
| picks.push({ label: '.' + p, data: rootPath + p }); | ||
| } | ||
|
|
||
| (picks.at(-1) as IAzureQuickPickItem).description = 'dockerfile'; | ||
| picks.push(browseItem); | ||
| return picks; | ||
| } | ||
|
|
||
| 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); | ||
| } | ||
| } | ||
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.
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.
Would it be more helpful to show the name of the dockerfile instead? I'm not sure exactly what the intention of the description is.
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.
By this step, the user has already chosen a Dockerfile. This description is just indicating to the user that the chosen Dockerfile is present at this folder level.
Yeah, we could show the full name of the Dockerfile instead
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.
Ohh, I see. 🤔
Shoot, I don't feel like that is super obvious based on just that description. I don't really have any great alternative suggestions.
Part of me is wondering how useful that information is to the user? Because where their dockerfile is may not really be that relevant to where their source code is anyway.
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.
Yeah, think it's worth waiting for PM feedback for this one then? I don't really have strong opinions either way tbh. I was also on the fence about whether it looked good / was useful.
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 we'd be safe to just remove it to be honest. My gut feeling is that they won't really care.
I think it's more likely to confuse a user and I don't think knowing that is where the dockerfile is located is super relevant for this step anyway.