69 references to ResourceCommandState
Aspire.Hosting (23)
ApplicationModel\CommandOptions.cs (1)
50public Func<UpdateCommandStateContext, ResourceCommandState>? UpdateState { get; set; }
ApplicationModel\CommandsConfigurationExtensions.cs (8)
35return ResourceCommandState.Disabled; 39return ResourceCommandState.Enabled; 43return ResourceCommandState.Hidden; 68return ResourceCommandState.Disabled; 72return ResourceCommandState.Enabled; 76return ResourceCommandState.Hidden; 102return ResourceCommandState.Disabled; 106return 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)
694var newState = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = _serviceProvider }); 737var 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)
1650return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, commandOptions.UpdateState ?? (c => ResourceCommandState.Enabled), executeCommand, commandOptions.Description, commandOptions.Parameter, commandOptions.ConfirmationMessage, commandOptions.IconName, commandOptions.IconVariant, commandOptions.IsHighlighted)); 1695Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null, 1715return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, updateState ?? (c => ResourceCommandState.Enabled), executeCommand, displayDescription, parameter, confirmationMessage, iconName, iconVariant, isHighlighted)); 1910commandOptions.UpdateState = context => targetRunning ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Tests (46)
Dashboard\DashboardServiceTests.cs (1)
158UpdateState = c => ApplicationModel.ResourceCommandState.Enabled,
ResourceCommandAnnotationTests.cs (35)
12[InlineData(KnownResourceCommands.StartCommand, "Starting", ResourceCommandState.Disabled)] 13[InlineData(KnownResourceCommands.StartCommand, "Stopping", ResourceCommandState.Hidden)] 14[InlineData(KnownResourceCommands.StartCommand, "Running", ResourceCommandState.Hidden)] 15[InlineData(KnownResourceCommands.StartCommand, "Exited", ResourceCommandState.Enabled)] 16[InlineData(KnownResourceCommands.StartCommand, "Finished", ResourceCommandState.Enabled)] 17[InlineData(KnownResourceCommands.StartCommand, "FailedToStart", ResourceCommandState.Enabled)] 18[InlineData(KnownResourceCommands.StartCommand, "Unknown", ResourceCommandState.Enabled)] 19[InlineData(KnownResourceCommands.StartCommand, "Waiting", ResourceCommandState.Enabled)] 20[InlineData(KnownResourceCommands.StartCommand, "RuntimeUnhealthy", ResourceCommandState.Disabled)] 21[InlineData(KnownResourceCommands.StartCommand, "", ResourceCommandState.Disabled)] 22[InlineData(KnownResourceCommands.StartCommand, null, ResourceCommandState.Disabled)] 23[InlineData(KnownResourceCommands.StopCommand, "Starting", ResourceCommandState.Hidden)] 24[InlineData(KnownResourceCommands.StopCommand, "Stopping", ResourceCommandState.Disabled)] 25[InlineData(KnownResourceCommands.StopCommand, "Running", ResourceCommandState.Enabled)] 26[InlineData(KnownResourceCommands.StopCommand, "Exited", ResourceCommandState.Hidden)] 27[InlineData(KnownResourceCommands.StopCommand, "Finished", ResourceCommandState.Hidden)] 28[InlineData(KnownResourceCommands.StopCommand, "FailedToStart", ResourceCommandState.Hidden)] 29[InlineData(KnownResourceCommands.StopCommand, "Unknown", ResourceCommandState.Hidden)] 30[InlineData(KnownResourceCommands.StopCommand, "Waiting", ResourceCommandState.Hidden)] 31[InlineData(KnownResourceCommands.StopCommand, "RuntimeUnhealthy", ResourceCommandState.Hidden)] 32[InlineData(KnownResourceCommands.StopCommand, "", ResourceCommandState.Hidden)] 33[InlineData(KnownResourceCommands.StopCommand, null, ResourceCommandState.Hidden)] 34[InlineData(KnownResourceCommands.RestartCommand, "Starting", ResourceCommandState.Disabled)] 35[InlineData(KnownResourceCommands.RestartCommand, "Stopping", ResourceCommandState.Disabled)] 36[InlineData(KnownResourceCommands.RestartCommand, "Running", ResourceCommandState.Enabled)] 37[InlineData(KnownResourceCommands.RestartCommand, "Exited", ResourceCommandState.Disabled)] 38[InlineData(KnownResourceCommands.RestartCommand, "Finished", ResourceCommandState.Disabled)] 39[InlineData(KnownResourceCommands.RestartCommand, "FailedToStart", ResourceCommandState.Disabled)] 40[InlineData(KnownResourceCommands.RestartCommand, "Unknown", ResourceCommandState.Disabled)] 41[InlineData(KnownResourceCommands.RestartCommand, "Waiting", ResourceCommandState.Disabled)] 42[InlineData(KnownResourceCommands.RestartCommand, "RuntimeUnhealthy", ResourceCommandState.Disabled)] 43[InlineData(KnownResourceCommands.RestartCommand, "", ResourceCommandState.Disabled)] 44[InlineData(KnownResourceCommands.RestartCommand, null, ResourceCommandState.Disabled)] 45public void LifeCycleCommands_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 55var 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);