-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use gRPC to communicate data from app host to dashboard (#1476)
* Model per-type resource data as extension data The UI will have a single object type for all resources, treating the uniformly. That object has both a fixed set of fields, and now its own extensible metadata. In the protocol between ResourceService and Dashboard, we'll need an extensible way to model these resource data. This allows the UI to work with resource types it hasn't seen before. * Split snapshots from view models We are moving towards removing `Aspire.Hosting`'s reference to `Aspire.Dashboard`. In this new model we will have different types on the back end and front end. - DCP has its own types (e.g. `CustomResource`), which remain untouched, and exist only on the back end. - `ResourceSnapshot` is a new abstract base class for `ContainerSnapshot`, `ExecutableSnapshot` and `ProjectSnapshot`. These are immutable, have no view-specific data, and will only be used on the back end. In the near future, these objects will be used to populate gRPC messages. - `ResourceViewModel` remains, though only on the front end. It no longer has subclasses. We are designing the dashboard to support arbitrary resource types. In the near future, these objects will be constructed and updated in response to gRPC messages. As the front end no longer has subclasses of `ResourceViewModel`, some of the hard-coded resource-specific logic has been changed to work on the additional data within a resource. We also introduce a `KnownResourceTypes` static class with consts for known resource type names (e.g. "Container"). * Remove obsolete TODOs * Rename ResourceDataKeys to KnownProperties * Move types to their own source files * Split endpoint snapshot from view model * Consistent naming in razor files * Add ctor to EnvironmentVariableViewModel * Complete ResourceViewModel construction from Resource message * Make types internal * Add words to dictionary * Use KnownResourceTypes * Pass correct type to logger factory * Rename ResourceService to DashboardClient * Dashboard receives data via gRPC Uses the gRPC `.proto` file added in a previous commit (with some small changes) to model data sent between the back end (app host) and front end (dashboard). Currently this occurs within the same process, but future work will split the dashboard out of the app host. - Object flow is now "DCP -> snapshots -> gRPC messages -> view models". - Move `DashboardWebApplication` initialization out of `DcpHostService` and into the new `DashboardWebApplicationHost` in preparation for future split. - Split `ResourceSubscription`/`ResourceChange`/`ResourceChangeType` into both snapshot and view model versions, for use on back/front ends respectively. * Add API doc * Logging * Don't treat cancellations as errors * Join async connection management on dispose * Throw on unexpected values * Log when dashboard is disabled * Remove redundant route on gRPC endpoint * Log reason when dashboard hosting is skipped * Handle null container ID * Extract common check * Specify assembly name for eShopLite's app host The app host exposes this via `Microsoft.Extensions.Hosting.IHostEnvironment.ApplicationName`, which is documented as returning the assembly name. Any `.AppHost` suffix is removed before the name returned. Because the name of this project is just `AppHost`, the dashboard for this project would only show `AppHost`, which is misleading. This sets the assembly name to have the expected naming convention, without requiring the project name to change and look different to sibling projects in eShopLite. * Ensure the page title displays With the introduction of gRPC between dashboard and app host, the dashboard can render its UI before the application information request returns. One negative consequence of this is that the UI's page title and header area do not show the application name. When this data arrives later asynchronously, the UI is not updated. This change introduces a way for the UI to refresh at a later time, once the application name is available. * Remove application version from protocol This was unused, and it's unclear how we'd populate it. We can add it back later if we want it again, but let's not bake it into the protocol just yet. * Improve parsing of application name This covers the case that the name does not have a period. For example, one of the sample apps in this repo is named `DaprAppHost`, and the name `Dapr` would be perfect, but the previous code required a period in the suffix (e.g. `.AppHost`). * Fix potential ANE due to unannotated gRPC code * Configure logging for dashboard web application * Use concurrent dictionaries * More spelling words
- Loading branch information
1 parent
9f84cd7
commit 40ebf07
Showing
54 changed files
with
1,702 additions
and
523 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.