-
Notifications
You must be signed in to change notification settings - Fork 749
feat(lambda): download serverless land patterns in IDE #6612
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
feat(lambda): download serverless land patterns in IDE #6612
Conversation
|
a20965f to
1e35324
Compare
1e35324 to
e23a824
Compare
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.
Questions in Wizard part, also please add test
packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts
Outdated
Show resolved
Hide resolved
packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts
Outdated
Show resolved
Hide resolved
packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts
Outdated
Show resolved
Hide resolved
| }).run() | ||
| } | ||
|
|
||
| async function downloadPatternCode(config: CreateServerlessLandWizardForm): Promise<void> { |
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.
Seems you are providing a Official Serverless Land experience here, could you help to update the Download SL logic I have in walkthrough to use your logic here?
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.
If this is going to be used in other places as well, I suggest bringing these function outside of main.py and into another file in this folder for readability.
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.
In this file, I am using the same getPattern() function that is defined in the shared/utilities/downloadPattern. The only difference is that I am appending the .zip extension to the asset_name to ensure the pattern code is downloaded correctly. In the metadata file, I am saving the asset_name without the extension, while for the Getting Started project, the asset_name was saved with the extension. If we plan to use the metadata for the Getting Started patterns in the future, we can update the approach there as well.
| if (patterns.length === 0) { | ||
| throw new ToolkitError('No patterns found in metadata') | ||
| } | ||
| let step = 'pattern' |
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.
for line 40, IMO we should avoid public override async run(): when possible. Just put all the async prework out of the wizard. the override async run() has cause difficulties in testing as my experience.
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.
The code has been simplified, and the logic that was previously executed within the public override async run() method has been moved to the public constructor. No longer need to override the run() function.
e23a824 to
c8e7703
Compare
|
| }).run() | ||
| } | ||
|
|
||
| async function downloadPatternCode(config: CreateServerlessLandWizardForm): Promise<void> { |
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.
If this is going to be used in other places as well, I suggest bringing these function outside of main.py and into another file in this folder for readability.
packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts
Outdated
Show resolved
Hide resolved
packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts
Outdated
Show resolved
Hide resolved
3e3a123 to
c5104e2
Compare
| export class CreateServerlessLandWizard extends Wizard<CreateServerlessLandWizardForm> { | ||
| private metadataManager: MetadataManager | ||
| async function loadMetadata(): Promise<MetadataManager> { | ||
| const metadataManager = MetadataManager.getInstance() |
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.
does it make sense for this to live inside of the metadataManager? Or do you envision the metadata manager loading multiple different types of metadata
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.
The project will utilize a single metadata file. I have made the changes to utilize loadMetadata() inside the metadataManager.ts file.
| super({ | ||
| exitPrompterProvider: createExitPrompter, | ||
| }) | ||
| loadMetadata().catch((err: any) => { |
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.
shouldn't the form have the metadata before the load the form loads rather than loading it afterwords?
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 don't fully understand what you're talking about here. Can you please explain it more? Thanks!
| }, | ||
| { | ||
| iconPath: new vscode.ThemeIcon('open-preview'), | ||
| tooltip: 'Open in Serverless Land', |
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.
| tooltip: 'Open in Serverless Land', | |
| tooltip: 'Show Serverless Land webview', |
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 technically show the web view of Serverless Land page in VS Code web view.
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.
does "webview" mean anything to customers?
c5104e2 to
c67fc2e
Compare
| private static instance: MetadataManager | ||
| private metadata: ProjectMetadata | undefined | ||
| private static readonly metadataPath = path.join( | ||
| path.resolve(__dirname, '../../../../../'), |
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.
you're probably going to wait to integrate with our copyFiles scripts. This path probably exists in the extension debug mode but I don't think it exists in the actual build. Instead, you will need to copy this file to the resources file and pull from that
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.
Yes, I have made the changes in the path with the copyFiles scripts in the next PR and it is working correctly too.
roger-zhangg
left a comment
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.
LGTM, we should review again once we have the whole feature ready
2335204
into
aws:feature/serverlessland
This pull request introduces the functionality to allow users to download the selected pattern from the Serverless Land QuickPick flow into a directory of their choice. The key changes made are as follows: 1. The `metadata.json` file was updated to accommodate the addition of an `asset_name` field for each IaC and Runtime pair. 2. Consequently, the way the metadata is extracted in the `metadataManager.ts` file had to be modified to account for these changes in the `metadata.json` file. 3. To enable users to navigate back to the previous QuickPick options, a switch functionality was implemented in the `wizard.ts` file. This helps maintain the state of the current QuickPick and directs the user to the previous QuickPick. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Vandita Patidar <[email protected]> Building Quick Pick structure Arranging file structure Review revision Download code Updating wizard file Download code
## Problem This pull request introduces the functionality to allow users to download the selected pattern from the Serverless Land QuickPick flow into a directory of their choice. ## Solution The key changes made are as follows: 1. The `metadata.json` file was updated to accommodate the addition of an `asset_name` field for each IaC and Runtime pair. 2. Consequently, the way the metadata is extracted in the `metadataManager.ts` file had to be modified to account for these changes in the `metadata.json` file. 3. To enable users to navigate back to the previous QuickPick options, a switch functionality was implemented in the `wizard.ts` file. This helps maintain the state of the current QuickPick and directs the user to the previous QuickPick. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Vandita Patidar <[email protected]>
## Problem This pull request introduces the functionality to allow users to download the selected pattern from the Serverless Land QuickPick flow into a directory of their choice. ## Solution The key changes made are as follows: 1. The `metadata.json` file was updated to accommodate the addition of an `asset_name` field for each IaC and Runtime pair. 2. Consequently, the way the metadata is extracted in the `metadataManager.ts` file had to be modified to account for these changes in the `metadata.json` file. 3. To enable users to navigate back to the previous QuickPick options, a switch functionality was implemented in the `wizard.ts` file. This helps maintain the state of the current QuickPick and directs the user to the previous QuickPick. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Vandita Patidar <[email protected]>
Problem
This pull request introduces the functionality to allow users to download the selected pattern from the Serverless Land QuickPick flow into a directory of their choice.
Solution
The key changes made are as follows:
metadata.jsonfile was updated to accommodate the addition of anasset_namefield for each IaC and Runtime pair.metadataManager.tsfile had to be modified to account for these changes in themetadata.jsonfile.wizard.tsfile. This helps maintain the state of the current QuickPick and directs the user to the previous QuickPick.feature/xbranches will not be squash-merged at release time.