Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Sep 19, 2024
1 parent 677f88b commit 97ac713
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Aspire.Hosting/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Aspire.Hosting.DistributedApplicationExecutionContextOptions.ServiceProvider.get
Aspire.Hosting.DistributedApplicationExecutionContextOptions.ServiceProvider.set -> void
static Aspire.Hosting.ResourceBuilderExtensions.WaitFor<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T>! builder, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.IResource!>! dependency) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T>!
static Aspire.Hosting.ResourceBuilderExtensions.WaitForCompletion<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T>! builder, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.IResource!>! dependency, int exitCode = 0) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T>!
static Aspire.Hosting.ResourceBuilderExtensions.WithCommand<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T>! builder, string! type, string! displayName, System.Func<Aspire.Hosting.ApplicationModel.UpdateCommandStateContext!, Aspire.Hosting.ApplicationModel.ResourceCommandState>! updateState, System.Func<Aspire.Hosting.ApplicationModel.ExecuteCommandContext!, System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult!>!>! executeCommand, string? iconName = null, bool isHighlighted = false) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T>!
static Aspire.Hosting.ResourceBuilderExtensions.WithCommand<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T>! builder, string! type, string! displayName, System.Func<Aspire.Hosting.ApplicationModel.ExecuteCommandContext!, System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult!>!>! executeCommand, System.Func<Aspire.Hosting.ApplicationModel.UpdateCommandStateContext!, Aspire.Hosting.ApplicationModel.ResourceCommandState>? updateState = null, string? iconName = null, bool isHighlighted = false) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T>!
static Aspire.Hosting.ResourceBuilderExtensions.WithHealthCheck<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T>! builder, string! key) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T>!
static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.Exited -> string!
static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.FailedToStart -> string!
Expand Down
12 changes: 6 additions & 6 deletions src/Aspire.Hosting/ResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,14 @@ public static IResourceBuilder<T> WithHealthCheck<T>(this IResourceBuilder<T> bu
/// <param name="builder">The resource builder.</param>
/// <param name="type">The type of command. The type uniquely identifies the command.</param>
/// <param name="displayName">The display name visible in UI.</param>
/// <param name="updateState">
/// A callback that is used to update the command state.
/// The callback is executed when the command's resource snapshot is updated.
/// </param>
/// <param name="executeCommand">
/// A callback that is executed when the command is executed. The callback is run inside the .NET Aspire host.
/// The callback result is used to indicate success or failure in the UI.
/// </param>
/// <param name="updateState">
/// <para>A callback that is used to update the command state. The callback is executed when the command's resource snapshot is updated.</para>
/// <para>If a callback isn't specified, the command is always enabled.</para>
/// </param>
/// <param name="iconName">The icon name for the command. The name should be a valid FluentUI icon name. https://aka.ms/fluentui-system-icons</param>
/// <param name="isHighlighted">A flag indicating whether the command is highlighted in the UI.</param>
/// <returns>The resource builder.</returns>
Expand All @@ -798,8 +798,8 @@ public static IResourceBuilder<T> WithCommand<T>(
this IResourceBuilder<T> builder,
string type,
string displayName,
Func<UpdateCommandStateContext, ResourceCommandState> updateState,
Func<ExecuteCommandContext, Task<ExecuteCommandResult>> executeCommand,
Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null,
string? iconName = null,
bool isHighlighted = false) where T : IResource
{
Expand All @@ -810,6 +810,6 @@ public static IResourceBuilder<T> WithCommand<T>(
builder.Resource.Annotations.Remove(existingAnnotation);
}

return builder.WithAnnotation(new ResourceCommandAnnotation(type, displayName, updateState, executeCommand, iconName, isHighlighted));
return builder.WithAnnotation(new ResourceCommandAnnotation(type, displayName, updateState ?? (c => ResourceCommandState.Enabled), executeCommand, iconName, isHighlighted));
}
}

0 comments on commit 97ac713

Please sign in to comment.