Skip to content

Interaction service #9943

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

Merged
merged 12 commits into from
Jun 22, 2025
Merged

Interaction service #9943

merged 12 commits into from
Jun 22, 2025

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jun 18, 2025

Description

Adds InteractionService. Used to prompt the user in the dashboard (included in PR) or CLI (TBD future)

Addresses #9807

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
    • 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?


<FluentDialogFooter>
<FluentButton Appearance="Appearance.Accent" OnClick="@SaveAsync">
Save
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to localize these?

Copy link
Member Author

@JamesNK JamesNK Jun 18, 2025

Choose a reason for hiding this comment

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

There will be some default button labels that are localized. But I also think there will be an option for customizing the button names from InteractionService.

}
}

public sealed class InteractionInput
Copy link
Member

Choose a reason for hiding this comment

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

In the future, do we think this is an abstract base class with concrete types for every supported output type?

Copy link
Member Author

@JamesNK JamesNK Jun 18, 2025

Choose a reason for hiding this comment

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

IMO have one class and have all properties on it for different input types. Input types will ignore properties that don't apply to them, e.g. checkbox ignores required, text ignores options, etc.

@mitchdenny
Copy link
Member

Overall, this looks good. There is a few nits like the name of InteractionService which I think we need to change just to avoid confusion within the team. No strong opinions on the alternative name. I think it's worth getting this in sooner rather than later so we can all start experimenting with it.

We can come back with API refinements and alignment for publish/deploy prompting.

@JamesNK
Copy link
Member Author

JamesNK commented Jun 19, 2025

There is a few nits like the name of InteractionService which I think we need to change just to avoid confusion within the team.

I think this is a pretty good name for what this does, and developers will use this type a lot in aspire code.

What else is called InteractionService? Does it make more sense this type changing its name or the other interaction service?

@davidfowl
Copy link
Member

We don’t have a way to mark the Proto as experimental so that’s a risk here. I’m looking to see how impactful this change is to mainline scenarios. Seems it shouldn’t have an impact unless called directly?

@JamesNK
Copy link
Member Author

JamesNK commented Jun 19, 2025

We don’t have a way to mark the Proto as experimental so that’s a risk here. I’m looking to see how impactful this change is to mainline scenarios. Seems it shouldn’t have an impact unless called directly?

Something to consider is if the new gRPC method isn't implemented. For example, dashboard is deployed to ACA but they never implement the interaction service.

gRPC throws a NotImplemented status so it's easy to detect. Just need to make sure the dashboard doesn't go into an endless retry loop if the server returns that status.

@JamesNK JamesNK force-pushed the jamesnk/interaction-service branch from ba9c0a9 to fdd6668 Compare June 19, 2025 03:31
@davidfowl
Copy link
Member

is there value in a capability check somewhere in the Proto?

{
options ??= MessageBoxInteractionOptions.CreateDefault();
options.Icon ??= MessageBoxIcon.Question;
options.PrimaryButtonText ??= "Yes";
Copy link
Member

Choose a reason for hiding this comment

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

If our default title is "Confirm command" (and we want to follow the fluent guideliens to a T) these should prob be "Confirm" and "Cancel"
https://fluent2.microsoft.design/components/web/react/core/dialog/usage#content

Copy link
Member Author

Choose a reason for hiding this comment

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

I copied Yes/No from what FluentUI does. I agree it's a little odd. Ok/Cancel would probably be better defaults.

The text can easily be customized by user when displaying a confirmation.

Copy link
Member

Choose a reason for hiding this comment

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

OK/Cancel is good then!


@inject IStringLocalizer<Dialogs> Loc

<FluentDialogHeader ShowDismiss="true">
Copy link
Member

Choose a reason for hiding this comment

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

IMO we should put the icon next to the header since it looks awkward next to the body. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using the built-in message box from FluentUI: https://www.fluentui-blazor.net/MessageBox. Moving the icon would require creating a custom dialog.

We could do it in the future, but for now I think the default is good enough.

Copy link
Member

Choose a reason for hiding this comment

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

Ooooh I was looking at DialogBox in docs. Fine by me!

@maddymontaquila
Copy link
Member

Added a couple things in a non blocking review but two other questions -

Do we want to "special case" cancelations so it doesnt say Failure and just says "Command execution canceled by user" or smthn?
image
Same w the popup (says failed canceled)
image

Do we need this blocking confirmation you think or is the top notif okay? I totally defer to you on this but I could go either way!
image

@JamesNK
Copy link
Member Author

JamesNK commented Jun 19, 2025

I'm just experimenting and testing with the interaction service in the playground app commands.

@davidfowl
Copy link
Member

davidfowl commented Jun 20, 2025

A few more things we have to consider:

  1. What happens during tests (We need to handle when the dashboard is disabled.)
  2. We need some api to know if the service is available.

@JamesNK
Copy link
Member Author

JamesNK commented Jun 20, 2025

A select's input is grayed out even after selecting a value. I think it is a bug in FluentUI. See microsoft/fluentui-blazor#3940

Fixed by changing the select binding.

@JamesNK
Copy link
Member Author

JamesNK commented Jun 20, 2025

  1. What happens during tests (We need to handle when the dashboard is disabled.)

I think we'll expose IInteractionService. Tests can mock it. We could do something like bunit does and offer a test implementation that you can register callbacks for.

  1. We need some api to know if the service is available.

What situation's wouldn't it be available? Publishing?

@davidfowl
Copy link
Member

What situation's wouldn't it be available? Publishing?

I'm thinking when the dashboard is disabled and this is running headless without a console. Interactivity is not available. We'll also have this problem when we back parameters with this.

@davidfowl
Copy link
Member

I think this change is good but we need a bool on the InteractionService to know if it's available and we should tie that to if the dashboard is enable for now. We need to be able to code around this defensively without risk of it hanging in various situations.

{
cancellationToken.ThrowIfCancellationRequested();

var inputList = inputs.ToList();
Copy link
Member

Choose a reason for hiding this comment

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

nit why not make the input IReadOnlyList<InteractionInput>?

@JamesNK JamesNK marked this pull request as ready for review June 22, 2025 06:18
@JamesNK JamesNK merged commit ff68c9c into main Jun 22, 2025
252 checks passed
@JamesNK JamesNK deleted the jamesnk/interaction-service branch June 22, 2025 07:00
@mitchdenny
Copy link
Member

🎉⌚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants