Skip to content
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

Improve Event Grid Local Development Experience #3984

Merged
merged 33 commits into from
Mar 13, 2024

Conversation

hossam-nasr
Copy link
Contributor

@hossam-nasr hossam-nasr commented Feb 20, 2024

Improve the local development experience for EventGrid functions.

What this PR does:

  • When customer clicks on "Execute Function Now..." button, if it's an EventGrid function, the user is prompted to choose an event type from a list of supported file types:
    image

  • The customer then selects one of sample event types under that event source, pulled from this repo:

image

  • After selecting an event type, user is prompted to either modify the sample file or send as-is:

image

  • If "send sample request" is selected, EventGrid function gets triggered with sample request.

  • If "modify sample request" is selected, a new window opens with the sample request:

image

  • Once the user makes any necessary modifications, clicking on the "save and send request..." button on the top right of the editor, or on the "Save and send request" code lens would save the modified contents of the sample file and trigger the function. The file is then closed, and the temp file created is deleted after.

image

image

Missing / Next steps:

  • Try remove the styling contributions this PR makes. For some reason, I couldn't find a .prettierrc file configuration that would keeping the existing styling as-is. Any help there is appreciated.
  • Customize and refine the experience specifically for EventGrid-based blob trigger functions
  • Double check the "source of truth" for supported EG event sources and sample requests for each event type under each event source.
  • Come up with a mechanism to streamline the process if the user is doing the same thing over and over again, and remember the modifications from last execution. Right now, nothing is remembered besides the choices for the different prompts.

Open questions:

❓Do I need to do something extra to make localization work? I followed the pattern I saw of using the localize function, but I'm not sure how the code I used as the first argument gets used.
❓Right now, I create the temp files that store these sample files in the .vscode directory. Would it be better if I saved it elsewhere, such as the OS temp file directory, by default?
❓Because of the way the button and code lens need to be registered at the extension level, they appear in any .eventgrid.json file, even if no function is currently being executed or the function app is even running. Is there a way to stop them from showing unless the function app is running and a function is being executed?

@hossam-nasr hossam-nasr requested a review from a team as a code owner February 20, 2024 14:38
@MicroFish91
Copy link
Contributor

MicroFish91 commented Feb 20, 2024

For some reason, I couldn't find a .prettierrc file configuration that would keeping the existing styling as-is. Any help there is appreciated.

Yeah, we don't use prettier defaults in our extensions. I tended to use it as well in my own projects but had to turn off a lot of the default formatting to keep our work projects from getting auto formatted on save 😋

Do I need to do something extra to make localization work? I followed the pattern I saw of using the localize function, but I'm not sure how the code I used as the first argument gets used.

At first glance, the way you're using it looks okay to me. I wouldn't worry too much about the string id, the new vscode.l10n localization method we should eventually be migrating to will no longer be requiring us to designate the id to be passed at all anymore if I recall correctly.

Copy link
Member

@nturinski nturinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For files that are edited due to your prettier, I think you can unstage those changes and just not push them up. I can't be sure, but it looks like there are some files that are only formatting changes, right?

As far as directory structure goes, I think there are enough EventGrid specific files that we should just create an executeFunction/eventGrid folder.

package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
src/commands/executeFunction/EventGridCodeLensProvider.ts Outdated Show resolved Hide resolved
src/commands/executeFunction/executeEventGridFunction.ts Outdated Show resolved Hide resolved
src/commands/executeFunction/executeEventGridFunction.ts Outdated Show resolved Hide resolved
src/commands/executeFunction/executeEventGridFunction.ts Outdated Show resolved Hide resolved
src/commands/executeFunction/executeEventGridFunction.ts Outdated Show resolved Hide resolved
src/commands/executeFunction/sendEventGridRequest.ts Outdated Show resolved Hide resolved
package.nls.json Outdated Show resolved Hide resolved
Copy link
Member

@nturinski nturinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking great. Most of my comments are just nits or small questions. Nice work!

@hossam-nasr hossam-nasr enabled auto-merge (squash) March 13, 2024 20:09
@hossam-nasr hossam-nasr merged commit 839622d into main Mar 13, 2024
1 of 2 checks passed
@hossam-nasr hossam-nasr deleted the hossamnasr/eventgrid-lde branch March 13, 2024 20:10
@microsoft microsoft locked and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants