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

Show endpoints in aspire run table as the localhost addresses #8307

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Mar 26, 2025

Switch to displaying the localhost URLs in the endpoints column in the aspire run CLI command.

Fixes #8205

image

@Copilot Copilot bot review requested due to automatic review settings March 26, 2025 02:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the way resource endpoints are displayed by switching from a simple array of URL strings to a tuple containing (EndpointName, EndpointUri) across both the server (Backchannel) and CLI components. Key changes include:

  • Updating the GetResourceStatesAsync method in both the backchannel and CLI to return a tuple for endpoints.
  • Adding endpoint extraction logic in the backchannel with proper logging when endpoints are missing.
  • Adjusting the CLI command to render endpoint links using the new tuple structure.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting/Backchannel/AppHostRpcTarget.cs Modified endpoint tuple type and added fallback logging for missing endpoints.
src/Aspire.Cli/Program.cs Updated the knownResources type and adjusted endpoint rendering to use the new endpoint tuple.
src/Aspire.Cli/Backchannel/AppHostBackchannel.cs Updated the GetResourceStatesAsync signature to use the new endpoint tuple.
Comments suppressed due to low confidence (1)

src/Aspire.Cli/Program.cs:248

  • [nitpick] Consider renaming the lambda parameter 'e' to 'endpoint' for improved clarity when rendering endpoint links.
e => { return new Markup("[link={e.EndpointUri}]{e.EndpointUri}[/]"); }

@mitchdenny mitchdenny changed the title Endpoint display options. Show endpoints in aspire run table as the localhost addresses Mar 26, 2025
@mitchdenny mitchdenny self-assigned this Mar 26, 2025
@mitchdenny mitchdenny added this to the 9.2 milestone Mar 26, 2025
@mitchdenny mitchdenny requested a review from davidfowl March 26, 2025 02:51
@maddymontaquila
Copy link
Member

I'm assuming we'll leave the friendly name URL stuff that Damian worked on for the proper dashboard right?

@mitchdenny
Copy link
Member Author

Yes. There are two things driving this. The first is just addressing some visual noise, but the second is an issue with the way that Codespaces/Devcontainers trigger port forwarding. This makes it more reliable.

@mitchdenny mitchdenny merged commit ad2d360 into main Mar 26, 2025
164 checks passed
@mitchdenny mitchdenny deleted the mitchdenny/use-allocated-endpoints-for-cli-run branch March 26, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoints shown by aspire run should be localhost addresses, not codespaces URIs (when in codespaces)
2 participants