Skip to content

Conversation

@adamint
Copy link
Member

@adamint adamint commented May 1, 2025

Description

Adds a new hidden field to the resource proto definition and refactors everywhere that KnownResourceStates.Hidden was used in apphost and dashboard. Also adds a toggle to show/hide hidden resources in the dashboard on the console logs and resources page.

ex:
image

Fixes #8428

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes (added one small mapping test)
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@adamint adamint requested a review from JamesNK May 1, 2025 21:58
@adamint adamint requested review from eerhardt and radical as code owners May 1, 2025 21:58
@adamint adamint requested a review from mitchdenny as a code owner May 1, 2025 22:12

internal static class ResourceViewModelExtensions
{
public static bool IsHiddenState(this ResourceViewModel resource)
Copy link
Member

Choose a reason for hiding this comment

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

I think we keep this for now so hidden resources don't suddenly start showing up. We can still infer hidden from this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a method IsHidden that also checks for Hidden state.

public static Task WaitForResources(this DistributedApplication app, IEnumerable<string>? targetStates = null, CancellationToken cancellationToken = default)
{
targetStates ??= [KnownResourceStates.Running, KnownResourceStates.Hidden];
targetStates ??= [KnownResourceStates.Running];
Copy link
Member

Choose a reason for hiding this comment

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

I'd put this back

@JamesNK
Copy link
Member

JamesNK commented May 2, 2025

Should showing hidden resources also show those with KnownResourceStates.Hidden?

@davidfowl
Copy link
Member

davidfowl commented May 2, 2025

I think you should make 3 changes:

  1. Add the Hidden bool to the protocol and consume it in the dashboard
  2. Consume the Hidden bool in the app host (change things from Hidden state to
  3. Add the UX for the showing hidden resources

This would help us asses the risk of breaking more easily.

@mitchdenny
Copy link
Member

I agree with @davidfowl. This is a good change overall but we need to deliver the changes in small chunks. The first stage is to unlock code running inside the app host to allow it to check for running state of hidden resources (so separating hiddenness from state). That is a big enough change for one PR and then I think adding support for showing hidden resources in the dashboard would be a welcome change - but should come later.

Doing this incrementally with small tight PRs will get this change in faster.

(p.s. I was so happy when I saw you picked this up overnight @adamint !)

@adamint
Copy link
Member Author

adamint commented May 2, 2025

Should showing hidden resources also show those with KnownResourceStates.Hidden?

I can't think of a reason it shouldn't. Were you thinking of any scenario in particular?

@adamint adamint closed this May 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2025
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.

Decouple hiddenness in the dashboard from the resource state

4 participants