-
Notifications
You must be signed in to change notification settings - Fork 475
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
Allow dashboard to run without resource service #1815
Conversation
With the dashboard running OOP, it is configured with the resource server endpoint via an environment variable. The dashboard can actually perform useful work even without this connection, however it requires some code changes to support this. In this change, if the environment variable is not defined, then `IDashboardClient.IsEnabled` will be false, and some code paths become inactive based off the flag. To get tests passing, we introduce an abstraction for environment variables so we can inject the values we need. The navigation tree will not display the "Resources" or "Console logs" items when no resource service endpoint is available. --- Squashed from several other commits: Add singular overload of EnvironmentUtil.GetAddressUris And tidy up some code that parsed `DOTNET_DASHBOARD_GRPC_ENDPOINT_URL`. Change that code to only support a single URI for that purpose, as it only makes one connection. DashboardClient is disabled when no dashboard endpoint When the `DOTNET_DASHBOARD_GRPC_ENDPOINT_URL` variable is not in the dashboard's environment, the `DashboardClient` disables itself. In this state, it will throw when invoked, though you may query the `IsEnabled` property safely before making other calls. Add IEnvironmentVariables abstraction for unit testing Makes it possible to unit test environment variables. Make init properties Remove redundant null suppression Hide navigation items when resource service unavailable Hides the "Resources" and "Console logs" navigation menu items whenever the `DashboardClient` is not enabled (due to `DOTNET_DASHBOARD_GRPC_ENDPOINT_URL` not being available). Check if IDashboardClient is enabled before calling it
The title should have a value when there is no resource server. "Aspire dashboard"? An option to set it via argument/env var would be useful, but no one has asked for that yet. |
I like this idea! Added: string IDashboardClient.ApplicationName
{
get => _applicationName
?? _environmentVariables.GetString("DOTNET_DASHBOARD_APPLICATION_NAME")
?? "Aspire";
} |
@JamesNK PTAL. I'd like to get this merged in so there's more chance it's included in the next round of testing. |
(Replaces #1795 which closed when we merged the feature branch.)
Relates to #1556
With the dashboard running OOP, it is configured with the resource server endpoint via the
DOTNET_DASHBOARD_GRPC_ENDPOINT_URL
environment variable.The dashboard can actually perform useful work even without this connection, however it requires some code changes to support this.
In this PR, if the environment variable is not defined, then
IDashboardClient.IsEnabled
will be false, and some code paths become inactive based off the flag.To get tests passing, we introduce an abstraction for environment variables so we can inject the values we need.
The navigation tree will not display the "Resources" or "Console logs" items when no resource service endpoint is available:
Pending work:
/
which shows an empty Resources list. Route somewhere else.Microsoft Reviewers: Open in CodeFlow