69 references to ResourceCommandState
Aspire.Hosting (23)
ApplicationModel\CommandOptions.cs (1)
50public Func<UpdateCommandStateContext, ResourceCommandState>? UpdateState { get; set; }
ApplicationModel\CommandsConfigurationExtensions.cs (8)
34return ResourceCommandState.Disabled; 38return ResourceCommandState.Enabled; 42return ResourceCommandState.Hidden; 67return ResourceCommandState.Disabled; 71return ResourceCommandState.Enabled; 75return ResourceCommandState.Hidden; 101return ResourceCommandState.Disabled; 105return ResourceCommandState.Enabled;
ApplicationModel\CustomResourceSnapshot.cs (1)
296public sealed record ResourceCommandSnapshot(string Name, ResourceCommandState State, string DisplayName, string? DisplayDescription, object? Parameter, string? ConfirmationMessage, string? IconName, IconVariant? IconVariant, bool IsHighlighted);
ApplicationModel\ResourceCommandAnnotation.cs (2)
20Func<UpdateCommandStateContext, ResourceCommandState> updateState, 60public Func<UpdateCommandStateContext, ResourceCommandState> UpdateState { get; }
ApplicationModel\ResourceNotificationService.cs (2)
701var newState = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = _serviceProvider }); 744var state = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = serviceProvider });
Dashboard\proto\Partials.cs (4)
140private static ResourceCommandState MapCommandState(Hosting.ApplicationModel.ResourceCommandState state) 144Hosting.ApplicationModel.ResourceCommandState.Enabled => ResourceCommandState.Enabled, 145Hosting.ApplicationModel.ResourceCommandState.Disabled => ResourceCommandState.Disabled, 146Hosting.ApplicationModel.ResourceCommandState.Hidden => ResourceCommandState.Hidden,
ResourceBuilderExtensions.cs (5)
1651return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, commandOptions.UpdateState ?? (c => ResourceCommandState.Enabled), executeCommand, commandOptions.Description, commandOptions.Parameter, commandOptions.ConfirmationMessage, commandOptions.IconName, commandOptions.IconVariant, commandOptions.IsHighlighted)); 1696Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null, 1716return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, updateState ?? (c => ResourceCommandState.Enabled), executeCommand, displayDescription, parameter, confirmationMessage, iconName, iconVariant, isHighlighted)); 1911commandOptions.UpdateState = context => targetRunning ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Tests (46)
Dashboard\DashboardServiceTests.cs (1)
158UpdateState = c => ApplicationModel.ResourceCommandState.Enabled,
ResourceCommandAnnotationTests.cs (35)
11[InlineData("resource-start", "Starting", ResourceCommandState.Disabled)] 12[InlineData("resource-start", "Stopping", ResourceCommandState.Hidden)] 13[InlineData("resource-start", "Running", ResourceCommandState.Hidden)] 14[InlineData("resource-start", "Exited", ResourceCommandState.Enabled)] 15[InlineData("resource-start", "Finished", ResourceCommandState.Enabled)] 16[InlineData("resource-start", "FailedToStart", ResourceCommandState.Enabled)] 17[InlineData("resource-start", "Unknown", ResourceCommandState.Enabled)] 18[InlineData("resource-start", "Waiting", ResourceCommandState.Enabled)] 19[InlineData("resource-start", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 20[InlineData("resource-start", "", ResourceCommandState.Disabled)] 21[InlineData("resource-start", null, ResourceCommandState.Disabled)] 22[InlineData("resource-stop", "Starting", ResourceCommandState.Hidden)] 23[InlineData("resource-stop", "Stopping", ResourceCommandState.Disabled)] 24[InlineData("resource-stop", "Running", ResourceCommandState.Enabled)] 25[InlineData("resource-stop", "Exited", ResourceCommandState.Hidden)] 26[InlineData("resource-stop", "Finished", ResourceCommandState.Hidden)] 27[InlineData("resource-stop", "FailedToStart", ResourceCommandState.Hidden)] 28[InlineData("resource-stop", "Unknown", ResourceCommandState.Hidden)] 29[InlineData("resource-stop", "Waiting", ResourceCommandState.Hidden)] 30[InlineData("resource-stop", "RuntimeUnhealthy", ResourceCommandState.Hidden)] 31[InlineData("resource-stop", "", ResourceCommandState.Hidden)] 32[InlineData("resource-stop", null, ResourceCommandState.Hidden)] 33[InlineData("resource-restart", "Starting", ResourceCommandState.Disabled)] 34[InlineData("resource-restart", "Stopping", ResourceCommandState.Disabled)] 35[InlineData("resource-restart", "Running", ResourceCommandState.Enabled)] 36[InlineData("resource-restart", "Exited", ResourceCommandState.Disabled)] 37[InlineData("resource-restart", "Finished", ResourceCommandState.Disabled)] 38[InlineData("resource-restart", "FailedToStart", ResourceCommandState.Disabled)] 39[InlineData("resource-restart", "Unknown", ResourceCommandState.Disabled)] 40[InlineData("resource-restart", "Waiting", ResourceCommandState.Disabled)] 41[InlineData("resource-restart", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 42[InlineData("resource-restart", "", ResourceCommandState.Disabled)] 43[InlineData("resource-restart", null, ResourceCommandState.Disabled)] 44public void LifeCycleCommands_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 54var state = startCommand.UpdateState(new UpdateCommandStateContext
WithHttpCommandTests.cs (10)
379ResourceCommandState? commandState = null; 388if (commandState == ResourceCommandState.Enabled) 406Assert.Equal(ResourceCommandState.Disabled, commandState); 417Assert.Equal(ResourceCommandState.Enabled, commandState); 444return enableCommand ? ResourceCommandState.Enabled : ResourceCommandState.Hidden; 449ResourceCommandState? commandState = null; 458if (commandState == ResourceCommandState.Enabled) 476Assert.Equal(ResourceCommandState.Hidden, commandState); 488Assert.Equal(ResourceCommandState.Enabled, commandState);