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

Split dashboard resource snapshots from view models #1415

Closed
wants to merge 5 commits into from

Conversation

drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Dec 15, 2023

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").

Microsoft Reviewers: Open in CodeFlow

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.
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").
@drewnoakes
Copy link
Member Author

Thanks for the reviews here. I'm closing this in favour of #1476 which also adds gRPC between app host and dashboard.

@drewnoakes drewnoakes closed this Dec 21, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants