Skip to content

Add hidden to protocol, support in dashboard#9069

Merged
davidfowl merged 3 commits into
microsoft:mainfrom
adamint:dev/adamint/add-hidden-to-protocol
May 3, 2025
Merged

Add hidden to protocol, support in dashboard#9069
davidfowl merged 3 commits into
microsoft:mainfrom
adamint:dev/adamint/add-hidden-to-protocol

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented May 2, 2025

Description

First part of #9063, adds the hidden attribute and consumes it in the dashboard. @mitchdenny

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?

repeated ResourceRelationship relationships = 20;

// Whether the resource should be visually hidden in the dashboard.
bool hidden = 21;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is optional bool a thing @JamesNK? We need to distinguish false and not set.

if you have state “Hidden” and Hidden false what does it mean @adamint ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we want a tri state bool.

IMO a resource is hidden if hidden property is true or the state is hidden (for backwards compatibility).

@mitchdenny
Copy link
Copy Markdown
Member

@adamint I'm working on a copy of your branch integrating the changes I just merged to main and its looking like the dashboard resource is showing up in the dashboard even though the Hidden field is set to true. Are we not filtering on that flag yet in the PR?

Copy link
Copy Markdown
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

All other bool properties follow is_xxx naming standard.

Comment thread src/Aspire.Dashboard/Model/ResourceViewModel.cs Outdated
Comment thread src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs Outdated
Comment thread src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/ResourceSnapshot.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/proto/resource_service.proto Outdated
@dotnet-policy-service dotnet-policy-service Bot added the needs-author-action An issue or pull request that requires more info or actions from the author. label May 2, 2025
@mitchdenny
Copy link
Copy Markdown
Member

@adamint please confirm that this works for the dashboard resource.

@adamint
Copy link
Copy Markdown
Member Author

adamint commented May 2, 2025

@adamint I'm working on a copy of your branch integrating the changes I just merged to main and its looking like the dashboard resource is showing up in the dashboard even though the Hidden field is set to true. Are we not filtering on that flag yet in the PR?

@adamint please confirm that this works for the dashboard resource.

The hidden field is only set if the AppHost launch profile doesn't set ASPIRE_SHOW_DASHBOARD_RESOURCES to true. I've tested removing that property and the dashboard resource does not show up on the dashboard itself. Are you seeing something different?

@dotnet-policy-service dotnet-policy-service Bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label May 2, 2025
@adamint adamint requested a review from JamesNK May 2, 2025 21:58
return app.ResourceNotifications.WaitForResourceAsync(resourceName, targetState, cancellationToken);
}

#pragma warning disable CS0618 // Type or member is obsolete
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can you place these just around KnownResourceStates.Hidden in the method instead of the entire method

@davidfowl
Copy link
Copy Markdown
Contributor

Looking good!

@davidfowl davidfowl merged commit 157fdd4 into microsoft:main May 3, 2025
170 checks passed
@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.

4 participants